Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 4.2 KB

README.md

File metadata and controls

91 lines (66 loc) · 4.2 KB

Experiment Factory Experiment

Hi Friend! This is a jspsych base for an Experiment that is friendly for use in the Experiment Factory, and optionally reproducibly deploy and publish with Open Bases. You can run it locally by putting these files in a web server, or use the Experiment Factory to generate a reproducible container. Check out the documentation above for more information, or post an issue if you have any questions.

https://expfactory.github.io/expfactory/img/expfactoryticketyellow.png

How was it changed?

There were very minimal changes to the tutorial provided and we will discuss them here so you know you you can prepare any experiment for this template!

1. The organization of css and js files is different.

We place all assets under an "assets" folder, and create subfolders "js" and "css." We do this so there is consistency with regard to the level of the files, and so that they are easy to find based on the folder names.

2. The experiment is in experiment.js

Instead of writing the javascript to control the experiment all in the index.html, We've moved it to experiment.js. This component is for the creation of the timeline, which we call timeline. We move it to its own file so that it's "movable" in the case that we want to use the code in a different deployment context (e.g., the index.html assumes a particular URL to post to, and way to start the experiment.

3. We've added a LICENSE and README.md

Adding the LICENSE and this README are standard (and good!) practice for open source experiments. You should choose a permissive license so that others can easily use (and give you credit for) your work.

4. We are using Jquery

We use jquery to control the timeline. This isn't totally necessary, but rather a preference of this author.

5. We've added a config.json

The config.json is a metadata file that belongs at the top of the folder. You can change the values for your experiment. See te Experiment Factory documentation for how to define these fields.

{
    "cognitive_atlas_task_id": "tsk_4a57abb949dc8",
    "instructions":"Respond to the stimuli on the screen.",
    "description":"The reaction time task in Jspsych, as an example",
    "url":"https://www.github.com/openbases/experiment_jspsych",
    "contributors": [
        "Vanessa Sochat",
        "Josh de Leeuw",
        "Felix Henninger",
        "Arfon Smith",
        "Tyler Burleigh"
    ],
    "exp_id": "experiment_jspsych",
    "name": "Simple Reaction Time Example with JSpsych",
    "reference": ["http://www.sciencedirect.com/science/article/pii/0001691869900651"],
    "template": "jspsych",
    "time": 8
}

How was it deployed for preview?

Once on github, we deploy the master branch to Github pages so that the experiment renders (for preview) at https://openbaes.github.io/experiment_jspsych

Locally, you can start a local web server in the present working directory and open your browser to the port to preview! E.g., here is how to do it with Python 3 on port 9999:

python -m http.server 9999

Then open to http://127.0.0.1:9999

How would I customize this task?

  1. Write your experiment timeline in experiment.js
  2. Make sure all javascript and style dependencies are in assets
  3. Add dependencies as script and link tags in the <head> of index.html

And you should use the JsPsych docs as a resource to understand the plugins and functions available to you!