# Coming from Ibex and PCIbex: Importing a Reading Experiment into Potato

Source: https://www.potatoannotator.com/docs/guides/coming-from-ibex

**`potato import -f ibex` reads an [Ibex](https://github.com/addrummond/ibex) or PCIbex (PennController) experiment and builds a Potato project with the same items, Latin-square lists and main trial type. From Potato 2.12.0, a self-paced reading, maze, acceptability or two-key task can run with Potato's recruitment, surveys and export, or alongside an annotation task.**

Ibex runs sentence-processing experiments in the browser, and PCIbex Farm hosts PennController scripts written in JavaScript. Potato has no scripting layer, so the importer reads the parts of a script that have a fixed shape and lists the rest for you to rebuild by hand.

## Import an experiment

Point the importer at the experiment folder, the one with `data_includes/` and `chunk_includes/`, as in a PCIbex Farm or Ibex project download:

```bash
potato import -f ibex -i my_experiment/ -o my-study/
python potato/flask_server.py start my-study/config.yaml -p 8000
```

## Ibex constructs the importer translates

| Ibex or PCIbex | Potato |
|---|---|
| `Template("table.csv", row => newTrial(...))` | One item per CSV row, with every column kept |
| `newController("DashedSentence", {s: row.X})`, or classic `DashedSentence` | [Self-paced reading](/docs/experiments/self-paced-reading) in moving-window mode |
| `newController("Maze", {s: row.X, a: row.Y})` | The maze task, with the distractors from `row.Y` |
| `newScale(N)` with `.before` and `.after` texts, or classic `AcceptabilityJudgment` | An N-point `likert` scale with those end labels |
| `newKey("F", "J")` with `newText(row.X)` | A [timed trial](/docs/experiments/timed-trials) with those keys. Rename the labels to what they mean |
| Classic `"Question"` after a sentence | A comprehension question, with F and J for the first two answers |
| A `Group` or `List` column, or classic `["condition", N]` labels | A between-subjects factor `list`, one data file per list, and `batch_assignment.group_by_condition: list` |

Classic Ibex items labelled `["condition", N]` share group N, and list k gets the condition at position (k + N) mod (number of conditions), the usual Latin-square rotation. Items outside the square go in every list, under a different ID in each, because Potato needs item IDs to be unique across data files ([Experiment Flow](/docs/experiments/experiment-flow#different-items-for-each-cell)).

Lists keep the names the experiment gives them, such as `L1` or `List1`.

## Parts left for you to rebuild

These parts of an experiment are left out, and the output and `IMPORT_REPORT.md` list each one:

- practice items and templates;
- `Message`, `Form` and `Html` screens;
- `newTimer`, `Sequence` and `shuffleSequence` ordering;
- `Header` and `Footer`;
- `newFunction` and other custom JavaScript;
- images, audio and video elements, and recording;
- any template whose table is not in `chunk_includes/`.

A trial that is none of the translated types is refused with a message, and so is an import that would have no items, or a PCIbex template whose stimulus column is missing from its table. These are reported as warnings:

- a column the template reads that the table lacks;
- empty stimulus cells;
- two classic items with the same label in one group. Both are kept, since Ibex rotates a group by position.

Put consent and instructions on [survey pages](/docs/features/surveyflow). For stimulus timing that timed trials do not cover, run the task on a [jsPsych page](/docs/experiments/runtime-phases#jspsych-pages).

## Further Reading

- [Self-Paced Reading and Maze](/docs/experiments/self-paced-reading) - Presentation modes, region data and server checks
- [Experiment Flow](/docs/experiments/experiment-flow) - Conditions, lists and counterbalancing
- [Coming from jsPsych](/docs/guides/coming-from-jspsych) - jsPsych concepts mapped to Potato config keys
- [Importing Projects](/docs/tools/importing-projects) - Every format `potato import` reads

For implementation details, see the [source documentation](https://github.com/davidjurgens/potato/blob/master/docs/guides/coming-from-ibex.md).
