cardioception.HRD.parameters.getParameters#

cardioception.HRD.parameters.getParameters(participant='SubjectTest', session='001', serialPort='COM3', setup='behavioral', stairType='psi', exteroception=True, catchTrials=0.0, nTrials=120, device='mouse', screenNb=0, fullscr=True, nBreaking=20, resultPath=None, overwrite=False, confidenceScale=None, language='english', systole_kw={}, seed=None, autopilot=None, recorder=None, onMissedTrial='represent', maxRepresentations=3, maxHeartRateAttempts=None, triggers=None, config=None)[source]#

Create Heart Rate Discrimination task parameters.

Many task parameters, aesthetics, and options are controlled by the parameters dictionary defined herein. These are intended to provide flexibility and modularity to task. In many cases, unique versions of the task (e.g., with or without confidence ratings or choice feedback) can be created simply by changing these parameters, with no further interaction with the underlying task code.

Parameters
devicestr

Select how the participant provide responses. Can be ‘mouse’ or ‘keyboard’.

exteroceptionbool

If True, the task will include an exteroceptive (half of the trials).

fullscrbool

If True, activate full screen mode.

languagestr

The language used for the instruction. Can be “english”, “danish”, “danish_children” (a slightly simplified danish version), “french” or “german”.

nBreakingint

Number of trials to run before the break.

nTrialsint

The number of trials to run.

Note

This number indicates the total number of trials that will be presented during the experiment. If nTrials=50 and exteroception=False, the task contains 50 interoceptive trials. If nTrials=50 and exteroception=True, the task contains 25 interoceptive trials and 25 exteroceptive trials.

onMissedTrialstr

What to do when the participant does not respond in time. “represent” (the default) returns the trial to the end of the queue so the intended number of usable trials is collected, at the cost of a session whose length varies. “skip” moves on, giving a fixed number of presentations and a variable number of usable trials.

Note

Under either setting the missed trial is written to the results with DecisionProvided=False and is not used to update the staircase. Before this was fixed, a missed trial entered the staircase as a fabricated “Less” response.

maxRepresentationsint

How many times in total a trial may be presented before it is abandoned, when onMissedTrial=”represent”. Defaults to 3. Without a cap, a participant who stops responding would never reach the end.

participantstr

Subject ID. Default is ‘SubjectTest’.

catchTrialsfloat

Ratio of Psi trials replaced by catch trials at fixed differences, cycling through -30, +10, -20, +20, -10 and +30 BPM, to control for the range of stimuli presented. Default to 0.0 (no catch trials). If not 0.0, recommended value is 0.2.

recorderobject | None

A recording device to use instead of the one setup would open, e.g. cardioception.devices.LSLRecorder to read ECG from an LSL stream. Overrides setup’s choice of device but not its window.

resultPathstr | None

Root directory holding every participant. Results go to <resultPath>/sub-<participant>/ses-<session>/run-<timestamp>/. Defaults to <cwd>/data.

overwritebool

Allow writing into a run directory that already holds results. Off by default, so a repeated run cannot silently replace an earlier one.

confidenceScaleConfidenceScale | None

How confidence is collected and what its numbers mean. Defaults to a 0-100 visual analogue scale for the mouse and ten discrete steps for the keyboard. See cardioception.scales.

screenNbint

Screen number. Used to parametrize psychopy.visual.Window. Defaults to 0.

serialPort: str

The USB port where the pulse oximeter is plugged. Should be written as a string e.g. “COM3” for USB ports on Windows.

sessionstr

Session number. Default to ‘001’.

setupstr

Context of oximeter recording. “behavioral” will record through a Nonin pulse oximeter and “test” will use pre-recorded pulse time series (for testing only).

stairTypestr

Staircase type. “psi” is the only value; “updown” was removed in 1.0.0 and now raises. Kept as an argument so scripts passing it fail with an explanation rather than a TypeError.

systole_kwdict

Additional keyword arguments for systole.recording.Oximeter.

Notes

When using the behavioral setup, triggers will be sent to the PPG recording. The trigger channel is coding for different events during the task as follows:

  • 1: trial start

  • 2: listening window opens

  • 3: tone starts, decision begins

  • 4: confidence rating begins

  • 5: trial end

See cardioception.HRD._constants.Trigger. The Heartbeat Counting task writes different meanings to the same channel, so a recording has to be read knowing which task produced it.

Every one of these except the trial start also has a timestamp in the behavioural results.

Attributes
allowedKeyslist of str

The possible response keys.

confidenceScalecardioception.scales.ConfidenceScale

The confidence scale in use, and the meaning of its numbers.

devicestr

The device used for response and rating scale. Can be “keyboard” or “mouse”.

HRcutOfflist

Cut off for extreme heart rate values during recording.

ExteroConditionbool

If True, the task includes an exteroceptive (half of the trials).

isituple

Range of the inter-stimulus interval (seconds). Should be in the form of (low, high). At each trial the value is generated using a uniform distribution between these two values. Default is set to (0.25, 0.25) so the value is fixed at 0.25.

labelsRatinglist

The labels of the confidence rating scale.

listenLogo, heartLogoPsychopy visual instance

Image used for the inference and recording phases, respectively.

maxRatingTimefloat

The maximum time for a confidence rating (in seconds).

minRatingTimefloat

The minimum time before a rating can be provided during the confidence rating (in seconds).

monitorstr

The monitor used to present the task (Psychopy parameter).

nBreakingint

Number of trials to run before the break.

nConfidenceint

Number of tutorial trials that ask for a confidence rating.

nFeedbackint

Number of tutorial trials that show whether the answer was correct.

nFingerstr or None

The finger number (“1”, “2”, “3”, “4” or “5”) where the participant decided to place the pulse oximeter (if relevant).

nTrialsint

The number of trials to run. See the parameter of the same name.

participantstr

Subject ID. Default is ‘SubjectTest’.

pathstr

The task working directory.

resultPathstr | None

Where to save the results.

screenNbint

The screen number (Psychopy parameter). Default set to 0.

signal_dfpandas.DataFrame instance

Dataframe where the pulse signal recorded during the interoception condition will be stored.

stairCasedict

One psychopy.data.PsiHandler per modality, keyed ‘Intero’ and, when the exteroceptive condition is included, ‘Extero’.

staircaseType1d array-like

Which staircase drives each trial: ‘psi’ or ‘CatchTrial’.

startKeystr

The key to press to start the task and go to next steps.

response_keysdict

Mapping from trial conditions to keyboard response keys.

respMaxfloat

The maximum time for decision (in seconds).

sessionstr

Session number. Default to ‘001’.

setupstr

The context of recording. Can be ‘behavioral’ or ‘test’.

textsdict

Long text elements.

textSizefloat

Scaling parameter for text size.

triggersdict

Dictionary {str, callable or None}. The function will be executed before the corresponding trial sequence. The default values are None (no trigger sent).

  • “trialStart”

  • “trialStop”

  • “listeningStart”

  • “listeningStop”

  • “decisionStart”

  • “decisionStop”

  • “confidenceStart”

  • “confidenceStop”

winpsychopy.visual.window

The window in which to draw objects.