Contributing experiment code

Once you have an initial draft of your experiment code and wish to start testing it, collect all the files related to your experiment into one directory, and name that directory after your experiment.

The contribution is submitted for review through GitHub. If you already have a GitHub account, sign in to it, otherwise create one first.

  • Fork the current repository to your account.

  • On the created fork, create a new branch named after the feature you are developing or the change you are making.

  • Add the directory containing your experiment files under experiments/psychopy or experiments/psychtoolbox according to which framework you are using.

  • Create a pull request from your branch to the main branch of the source repository (not your fork, but the original repo).

  • Add any comments you want the reviewer to know about.

  • A reviewer will review your code and either approve it or ask for changes.

  • If changes are needed, make them and push your new code to the same branch. Your pull request will then update automatically.

  • Consider adding a page describing your experiment, see Documenting your experiment below.

  • Once your branch is merged to the main branch (meaning your experiment is approved), your code will be available on the MEG lab stimulus computer.

Documenting your experiment

The page describing an experiment lives in the experiment folder, next to the code, not in the docs folder. For example:

experiments/psychtoolbox/attention_task_worden/
    main.m
    ...
    attention-worden.rst          <- the page
    figures-attention-worden/     <- images used by the page

The first line of the page names the gallery section it is shown in (psychopy, psychtoolbox, general or presentation):

.. gallery-section: psychtoolbox

.. _attention_worden_exp:

---------------------------
Attention task (Worden)
---------------------------

At every docs build, docs/source/_ext/experiment_pages.py copies each page carrying this line, with the figures-* folders next to it, to docs/source/4-meg-experiments-gallery/experiments/<section>/. The page is then published at 4-meg-experiments-gallery/experiments/<section>/<page>.html.

  • Name the page after the experiment (the file name becomes the URL) and the figures folder figures-<page name>. Two pages or figure folders that would land on the same name in a section stop the build with an error.

  • Figures are referenced relative to the page (figures-attention-worden/x.png).

  • To include code or images from elsewhere in the repository, start the path with / (the docs/source folder), for example .. literalinclude:: /../../experiments/psychtoolbox/general/trigger_template.m.

  • The copies in the docs folder are listed in a generated .gitignore and are never committed: always edit the page in the experiment folder.

  • Any other .rst file in an experiment folder (a README.rst for example) is not published.

Building your processing pipeline

Follow the same fork and branch steps as above, naming the branch experiment_name-analysis.

Submit an initial notebook under docs/source/6-meg-pipeline-gallery/notebooks or simply a code file for your pipeline under pipeline/experiment_name.