- JsPsych base base
- Experiment Factory ready
- Open Bases deploy and publish option
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.
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!
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.
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.
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.
We use jquery to control the timeline. This isn't totally necessary, but rather a preference of this author.
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
}
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
- Write your experiment timeline in experiment.js
- Make sure all javascript and style dependencies are in assets
- Add dependencies as
script
andlink
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!