OpenSesame videos
Python videos
Supported by Supported by

Running experiments online

OSWeb

About OSWeb

OSWeb is an online runtime for OpenSesame experiments. That is, it is a JavaScript library that interprets and executes OpenSesame experiments.

The OSWeb extension

The OSWeb extension for OpenSesame (Figure 1) allows you to test experiments in a browser, and to export experiments in a format that you can import into JATOS (desribed below).

The extension is pre-installed in the Windows and Mac OS packages of OpenSesame 3.2.6 and later.

Alternatively, you can install the extension manually. It is available on PyPi as opensesame-extension-osweb and can be installed as described here:

/pages/manual/img/osweb/osweb-extension.png

Figure 1. The OSWeb extension for OpenSesame.

Testing the experiment in a browser

  • In OpenSesame, open the OSWeb extension (Menu → Tools → OSWeb).
  • The extension will perform a simple (and incomplete) check to see if your experiment appears to be compatible with OSWeb.
  • If no problems are detected, click 'Test experiment in external browser'.
  • This will open the experiment in your default browser so that you can check if the experiment runs as expected (Figure 2).
  • As of OSWeb 1.3, you can also click the 'Run in browser' button in the main toolbar (Alt+Ctrl+W)

/pages/manual/img/osweb/testrun.png

Figure 2. The welcome screen of OSWeb when testing the experiment in a browser.

Supported functionality

The following items are supported by OSWeb:

  • advanced_delay
  • feedback (named elements not supported)
  • inline_javascript
  • keyboard (key release not supported)
  • logger
  • loop (except 'Resume after break', 'Evaluate on first cycle', and 'file' source)
  • mouse (mouse release not supported; linked sketchpad not supported)
  • notepad (does nothing)
  • repeat_cycle
  • reset_feedback
  • sampler
  • sequence
  • sketchpad (named elements not supported)
  • synth
  • touch_response

Inline JavaScript

The inline_javascript item is available as of OSWeb 1.3

The inline_javascript item works similarly to the regular inline_script item, except that it runs JavaScript instead of Python code. Important considerations:

  • You can get and set experimental variables using the vars object, which works similarly to the var object in Python.
  • You cannot create Canvas, Keyboard objects, etc.
  • The JavaScript workspace is not persistent. That is, if you define a variable in one script, it will not be accessible in another script. The only exception is the vars object, which is persistent.

Example:

if (vars.subject_nr % 2 == 0) {
  vars.target_color = 'blue'
} else {
  vars.target_color = 'red'
}

Upgrading OSWeb

OSWeb is under active development. If you want to make sure that you're running the latest version, you can upgrade the OSWeb extension by running the command below in the OpenSesame debug window. This may require you to run OpenSesame as administrator on Windows.

!pip install opensesame-extension-osweb --upgrade

JATOS

Currently, you need to host your own JATOS installation to manage experiments.

About JATOS

JATOS is a system for managing online experiments. It allows you to create accounts for experimenters, upload experiments, and generate links that you can distribute to participants. JATOS needs to be installed on your own web server. However, for testing purposes, you can use the JATOS test server (Figure 3).

Exporting your experiment to a JATOS study

  • In OpenSesame, open the OSWeb extension (Menu → Tools → OSWeb)
  • Click on 'Export experiment as JATOS study'
  • Save your experiment as a .zip file

Importing your experiment in JATOS

  • In JATOS, click on 'Import study' (Figure 4)
  • Select the .zip file that you have exported from OpenSesame
  • Once the file has been uploaded to the server, JATOS will ask you to confirm that you want to import the study
  • Click on 'Import' to confirm
  • The study now appears in the list of studies on the left-hand side (Figure 5)

/pages/manual/img/osweb/jatos-1.png

Figure 3. For testing purposes, you can use the JATOS test server.

/pages/manual/img/osweb/jatos-2.png

Figure 4. Click on 'Import study' and select the .zip file that you have exported with the OSWeb extension.

/pages/manual/img/osweb/jatos-3.png

Figure 5. Once the experiment has been successfully imported in JATOS, it appears in the list of experiments.

Video tutorial

Video 1. Run your OpenSesame experiment online!

Example experiments

Supported by Supported by