Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Latest commit

 

History

History
167 lines (133 loc) · 9.59 KB

Documentation.md

File metadata and controls

167 lines (133 loc) · 9.59 KB

Behavioral Task Trials

All-in-one starter app with behavioral task trials

Modules

countdown

Builds a countdown transition with the given message and number of seconds.

fixation

Builds a trial with a fixation dot and optional photodiode box.

multiSurvey

Builds a multi choice/select survey trial.

showImage

Builds a trial with a onscreen message and optional photodiode box

showMessage

Builds a trial with a onscreen message, optional buttons and optional photodiode box

slider

Builds a trial with a onscreen message and allows the subject to respond by dragging a slider.

survey

Builds a trial with a question and with free response text fields. The subject types in answers.

userId

Builds a trial with set Id message and user Id input.

countdown

Builds a countdown transition with the given message and number of seconds.

Param Type Description
options Object
options.duration number trial duration in milliseconds. (default: 1000)
options.stimulus string Onscreen stimulus in HTML to be shown in the trial. If the stimulus is not provided, message should be provided as a string. (default: "")
options.message string (optional) message for the countdown. (default: "")
options.time number start number for the countdown. (default: 3)

fixation

Builds a trial with a fixation dot and optional photodiode box.

Param Type Description
config Object The configuration object for USE_PHOTODIODE, USE_EEG, USE_ELECTRON and USE_MTURK flags.
config.USE_PHOTODIODE boolean USE_PHOTODIODE flag
config.USE_EEG boolean USE_EEG flag
config.USE_ELECTRON boolean USE_ELECTRON flag
config.USE_MTURK boolean USE_MTURK flag
options Object
options.duration number trial duration in milliseconds jittered with the jitter param. (default: 1000)
options.jitter number jitter range (0-jitter) to add from to the trial duration (default: 50)
options.taskCode number Task code to be saved into data log (default: 1)
options.numBlinks number Number of times the pulse needs to be repeated for photodiode box, when USE_PHOTODIODE is set true. (default: 1)

multiSurvey

Builds a multi choice/select survey trial.

Param Type Description
options Object
options.responseType string This tells jsPsych which plugin file to use to run the trial. (default: surveyMultiChoice from "@jspsych/plugin-survey-multi-choice")
options.preamble string HTML formatted string to display at the top of the page above all the questions. (default: "")
options.prompts Array The question prompts, an Array of strings (default: [])
options.ansChoices Object Object consisting of the key as the answer choice name and value as the array of answer choices. (default: {})

showImage

Builds a trial with a onscreen message and optional photodiode box

Param Type Description
config Object The configuration object for USE_PHOTODIODE, USE_EEG, USE_ELECTRON and USE_MTURK flags.
config.USE_PHOTODIODE boolean USE_PHOTODIODE flag
config.USE_EEG boolean USE_EEG flag
config.USE_ELECTRON boolean USE_ELECTRON flag
config.USE_MTURK boolean USE_MTURK flag
image string The path of the image file to be displayed.
options Object
options.duration number trial duration in milliseconds jittered with the jitter param. (default: 1000)
options.jitter number jitter range (0-jitter) to add from to the trial duration (default: 50)
options.imageHeight number Set the height of the image in pixels. (default: 600)
options.imageWidth number Set the width of the image in pixels. (default: 600)
options.taskCode number Task code to be saved into data log (default: 1)
options.numBlinks number Number of times the pulse needs to be repeated for photodiode box, when USE_PHOTODIODE is set true. (default: 1)

showMessage

Builds a trial with a onscreen message, optional buttons and optional photodiode box

Param Type Description
config Object The configuration object for USE_PHOTODIODE, USE_EEG, USE_ELECTRON and USE_MTURK flags.
config.USE_PHOTODIODE boolean USE_PHOTODIODE flag
config.USE_EEG boolean USE_EEG flag
config.USE_ELECTRON boolean USE_ELECTRON flag
config.USE_MTURK boolean USE_MTURK flag
options Object
options.responseType string This tells jsPsych which plugin file to use to run the trial. (default: htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response")
options.duration number trial duration in milliseconds, only to be specified if the options.responseType is htmlKeyboardResponse. (default: 1000, if options.responseType is htmlKeyboardResponse, otherwise ignored)
options.stimulus string Onscreen stimulus in HTML to be shown in the trial, if not set default text is empty. If the stimulus is not provided, message should be provided as a string. (default: "")
options.message string Onscreen message to be shown in the trial. (default: "")
options.onstart boolean True if the message is to be display on start of the trial. False if the message needs to be in the stimulus.(default: false)
options.responseEndsTrial boolean True if the trial ends on response,false if the trial waits for the duration. (default: false)
options.taskCode number Task code to be saved into data log (default: 1)
options.numBlinks number Number of times the pulse needs to be repeated for photodiode box, when USE_PHOTODIODE is set true. (default: 1)
options.buttons Array This array contains the keys that the subject is allowed to press in order to respond to the stimulus. Keys can be specified as their numeric key code or as characters (e.g., 'a', 'q'). The default value of "ALL_KEYS" means that all keys will be accepted as valid responses. Specifying "NO_KEYS" will mean that no responses are allowed. Only to be specified if the options.responseType is htmlButtonResponse from "@jspsych/plugin-html-button-response" (default: ["OK"], if options.responseType is htmlButtonResponse, otherwise ignored)

slider

Builds a trial with a onscreen message and allows the subject to respond by dragging a slider.

Param Type Description
message string The string to be displayed, this can be formatted as an HTML string. (default: empty string)

survey

Builds a trial with a question and with free response text fields. The subject types in answers.

Param Type Description
options Object
options.preamble string HTML formatted string to display at the top of the page above all the questions. (default: "")
options.stimulus string Onscreen stimulus in HTML to be shown in the trial, if not set default text is empty. If the stimulus is not provided, message should be provided as a string. (default: "")
options.message string Onscreen message to be shown in the trial. (default: "")

userId

Builds a trial with set Id message and user Id input.

Param Type Description
jsPsych Object The instance of the jspsych passed as an object.
config Object The configuration object for USE_PHOTODIODE, USE_EEG, USE_ELECTRON and USE_MTURK flags.
config.USE_PHOTODIODE boolean USE_PHOTODIODE flag
config.USE_EEG boolean USE_EEG flag
config.USE_ELECTRON boolean USE_ELECTRON flag
config.USE_MTURK boolean USE_MTURK flag
options Object
options.duration number trial duration in milliseconds, when config.USE_MTURK is set to true. (default: 1000)
options.stimulus string Onscreen stimulus in HTML to be shown in the trial. If the stimulus is not provided, message should be provided as a string. (default: "")
options.setIdMessage string Onscreen text for setting user id or for the input box to enter user id. (default: "")
options.defaultId string The user id to show when requesting a user ID, when config.USE_MTURK is set to false.(default: "")