Pack&Go
Breadcrumbs

Uploading your experiment to Pack&Go

Now that you have created an account, you can upload an experiment onto Pack&Go. Below are some programming language-specific tips for preparing your study. Click on the arrow to expand the section.


Recommendations for preparing your MATLAB/Psychtoolbox study for Pack&Go

Here are a few things you should keep in mind when preparing your MATLAB experiment for Pack&Go:

  • If your experiment contains subfolders, remember to replace any local file paths in your code with relative paths. Do not hardcode your file paths. For more details, see Best Practices for Designing and Implementing Pack&Go Studies

  • Pack&Go does not support the MATLAB addpath function.

  • The MATLAB command window will not be visible, or accessible, in online experiments; avoid using functions like ‘input()’ which prompts users to enter input in the command window.

  • Save all result files in the main experiment folder. Do not create result subfolders.

  • Pack&Go runs on a remote server with an optimized Linux X64 operating system. If you are using third-party MEX files in your experiment, make sure you specifically include Linux X64 MEX files.

Pack&Go will automatically point to the main experiment folder; when setting up relative paths to subfolders, you can start indexing from the first subfolder and use, for example, the MATLAB filesep function to add platform-specific file separators when needed.

Recommendations for preparing your Python and PsychoPy study for Pack&Go

Here are a few things you should keep in mind when preparing your Python/PsychoPy experiment for Pack&Go:

  • If your experiment contains subfolders, remember to replace any local file paths in your code with relative paths. Do not hardcode your file paths. For more details, see Best Practices for Designing and Implementing Pack&Go Studies

  • If you are using keyboard input in your study, use the Keyboard class from PsychoPy, not the event class. E.g.
    Bad:

    Python
    from psychopy import event
    
    # Wait for spacebar press to start
    event.waitKeys(keyList=['space'])
    

    Good:

    from psychopy.hardware import keyboard   
    kb = keyboard.Keyboard()
    
    # Wait for spacebar press to exit
    kb.waitKeys(keyList=['space'])
    
  • If you are playing audio in your PsychoPy experiment, you must initialize the audio by including the following lines at the start of your code:

    Python
    from psychopy import prefs
    prefs.hardware['audioLib'] = ['pygame']
    from psychopy import sound
    
  • Our service uses the X Window System and therefore you will need to add the following at the beginning of the experiment script for optimal timing:

    Python
    import ctypes
    xlib = ctypes.cdll.LoadLibrary("libX11.so")
    xlib.XInitThreads()
    
  • If your experiment uses any libraries besides Python’s standard library and PsychoPy (e.g. numpy and matplotlib), you must also include in the zipped folder, a requirements text file (named “requirements.txt”) which specifies which packages will need to be included on the server to run your experiment. This file should be in the root of the zipped folder, not a subfolder. For example, the following in a text file will tell us to include the version of ‘matplotlib’ 3.7.3 and ‘numpy’ 1.24.4:

    matplotlib==3.7.3
    numpy==1.24.4
    
  • For a general explanation about the requirements.txt file and how to create it see this resource: https://learnpython.com/blog/python-requirements-file/

  • If you’re not sure which versions exist for a module, you can search for it here: https://pypi.org/

  • Python IDE users can try the following to automatically generate their requirements.txt:

    Python
    pip freeze > requirements.txt
    

    This will generate a list of ALL dependencies currently installed. We recommend reviewing this .txt and eliminating any packages not used in your experiment, in order to optimize performance.


Once you have successfully tested your code on your local computer, and are ready to upload the experiment to Pack&Go, follow these steps:

  1. Create a zip file containing all of your experiment programs, image files, input data files and everything you would need to run your experiment locally. The main experiment file should be:

    1. A script, not a function

    2. Located in the root of the zipped folder and not in subfolder(s)

  2. Navigate to the Scientist Portal and log in to your account, and click on the Experiments tab. Add a new experiment by clicking the Add Experiment “+” Icon

    image-20240219-195825.png
    The main Experiments page


  3. Enter the name (A) and description (B) of the experiment. Specify the region where you would like your data to be saved (C). Choose the platform you want to use (e.g. MATLAB-Psychtoolbox, Python, or Python with PsychoPy) (D).

    image-20240219-200513.png
    New experiment interface


  4. Indicate whether this experiment is a follow-up study of a previously published experiment on Pack&Go. Previous studies must be either published or completed. If you specify this is a follow-up study, Pack&Go will automatically generate single-use invitation links for each link created in the previous study. Any output files in the previous experiment will be transferred to the new experiment.

    image-20240219-200709.png
    Follow-up section


  5. Choose which aspect to prioritize under the “Strategy” heading. At the moment, we only offer the option to prioritize latency. This means the study will be optimized to introduce the lowest possible end-to-end latency, which is the time it takes for the experiment to update in the participant view following a participant input.

    image-20240219-201023.png
    Streaming Strategy section


  6. Set the hard time limit of your experiment, after which the experiment will be automatically terminated. This places a cap on the credits spent per participant. The default time limit is 30 minutes. The minimum time limit that can be set is 15 minutes and maximum time limit that can be set is 1 hour. Extended sessions are possible, but not reccommended. Save intermediate data files often in case subjects surpass the set limit.

    image-20240219-203801.png
    Time Limit section


  7. Upload the experiment by navigating to the Upload File section and click the icon next to File. Find and select the zipped experiment folder created in step 1; click Create to upload the file.

    image-20240219-203900.png
    Upload File section


  8. After the experiment has been uploaded you will see a summary of the Experiment information, you may edit the information or delete the experiment.

    image-20240219-204010.png
    Experiment Information review section


  1. You will also see the experiment’s associated files under the Files heading. Double check that all associated files are here.

    image-20240219-204051.png
    Files section


  1. If everything looks correct, pack the experiment by clicking Pack under the Actions heading

    image-20240219-204117.png
    Actions section for a new study


  2. Once the experiment is successfully packed, the status of the experiment will change to “Ready to publish”

    image-20240219-204420.png
    Actions section for a new study, once experiment file has been uploaded successfully