Callable tasks

Monetary risk & ambiguity (RA)

PTF.RA(subjectId)

Main task script for the monetary risk and ambiguity task in gains and losses

Loads config and DataObject, generates and executes requisite blocks, and records data for the subject whose subjectId is passed as an argument.

If subjectId is not given, the task runs a shorter practice version of itself.

Parameters:subjectId (int, optional) -- A participant ID
Returns:A DataObject with a record of the participant's choices.
Return type:DataObject struct
PTF.tasks.RA.RA_blockDefaults()

Return general block config for the monetary risk & ambiguity task by modifying the default ones from configDefaults.

Only small modifications are necessary, as config caters to this paradigm.

Returns:Config struct with settings shared across all R&A conditions.
PTF.tasks.RA.RA_lossConfig(gains_config)

Returns loss block config for the monetary R&A task by modifying the ones created for the gains block.

Parameters:gains_config -- Config returned from RA_gainsConfig
Returns:Config struct specific to the RA loss condition

Medical decision-making task (MDM)

PTF.MDM(subjectId)

Main task script for the medical & monetary decision-making task (MDM).

Loads config and DataObject, generates and executes requisite blocks, and records data for the subject whose subjectId is passed as an argument.

If subjectId is not given, the task runs a shorter practice version of itself.

Parameters:subjectId (int, optional) -- A participant ID
Returns:A DataObject with a record of the participant's choices.
Return type:DataObject struct

Note

Like RA, MDM utilizes the risk-and-ambiguity framework; unlike RA, it displays symbols for its payoffs. (Historically, the task scripts developed together.)

PTF.tasks.MDM.MDM_blockDefaults()

Return general block config for the medical decision-making task by modifying the default ones from configDefault.

Returns:Config struct with settings shared across all MDM conditions.
PTF.tasks.MDM.MDM_medicalConfig(initial_config)

Return config specific to the medical portion of MDM by modifying the general MDM_blockDefaults pass as argument.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the MDM medical condition
PTF.tasks.MDM.MDM_monetaryConfig(initial_config)

Return config specific to the monetary portion of MDM by modifying the general MDM_blockDefaults pass as argument.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the MDM monetary condition

Self/other decision-making task (SODM)

PTF.SODM(subjectId)

Runs a self-other monetary and medical decision-making task and records its results for the subject whose subject number is passed in. Modeled on (and largely copy-pasted from) RA.m, to test out image implementation (#5).

PTF.tasks.SODM.SODM_blockDefaults()

Return general block config for the medical decision-making task by modifying the default ones from configDefaults.

Returns:The config struct with settings shared across all SODM conditions.
PTF.tasks.SODM.SODM_drawCondition(blockConfig)

Draw the designation of a self-rewarding vs. other-rewarding task.

This can either be set in blockConfig.task.fnHandles.bgrDrawCallbackFn, or called directly from a draw function.

Parameters:blockConfig -- The block settings

Todo

Extract position into config

PTF.tasks.SODM.SODM_extractBeneficiary(blockConfig)

Extracts the beneficiary (self or other) for each block.

Parameters:blockConfig -- The block settings
Returns:String naming the beneficiary for the current condition
Return type:beneficiary
PTF.tasks.SODM.SODM_medicalConfig(initial_config)

Configure medical blocks of the self/other task.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the medical conditions of the self/other task
PTF.tasks.SODM.SODM_monetaryConfig(initial_config)

Configure monetary blocks of the self/other task.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the monetary conditions of the self/other task
PTF.tasks.SODM.SODM_preBlock(Data, blockConfig)

Insert beneficiary condition into blockName, then call preBlock with it.

Parameters:
  • Data -- The information collected from task trials
  • blockConfig -- The block settings
Returns:

2-element tuple containing

  • Data: The information collected from task trials.
  • blockConfig: The block settings with updated runSetup.blockName

PTF.tasks.SODM.SODM_showChoice(trialData, blockConfig, phaseConfig)
Executes the SODM trial phase of showing the task choice to
the subject and collecting their response.

Choice values are derived from trialData and, if need be, blockConfig.

Parameters:
  • trialData -- The information collected from trials
  • blockConfig -- The block settings
  • phaseConfig -- The phase settings
Returns:

The information collected from trials.

Return type:

trialData

Uniform vertical decision-making task (UVRA)

PTF.UVRA(subjectId)

Task script for a monetary R&A task with relaxed test-taking conditions. ("U" stands for "unlimited", "V" for vertical layout of the choices.)

Like all main tasks scripts, this function loads config, executes requisite blocks, and records data for the subject whose ID is passed as an argument.

PTF.tasks.UVRA.UVRA_blockDefaults()

Return general block config for the UVRA task by modifying the default ones from configDefaults.

Returns:Config struct with settings shared across all UVRA conditions.
PTF.tasks.UVRA.UVRA_feedback(trialData, blockConfig)

Draws feedback of choice for a specified time.

Based on the value in trialData.choice, it draws the feedback that confirms to the player which option they chose (or whether they chose at all) and displays it for blockConfig.trial.legacyPhases.feedback.duration. Can be re-used for tasks that offer two options in a choice.

UVRA_feedback differs from phase_feedback by drawing the feedback vertically.

Parameters:
  • trialData -- The participant data from a trial
  • blockConfig -- The block settings
Returns:

The information collected from trials.

Return type:

trialData

Todo

Modularize drawFeedback so that it can draw things vertically in order to render this function unnecessary

PTF.tasks.UVRA.UVRA_showChoice(trialData, blockConfig, phaseConfig)

Executes the monetary R&A trial stage of showing the task choice to the subject.

Choice values are derived from trialData and, if need be, blockConfig. They are displayed vertically and expect a subject response.

Parameters:
  • trialData -- The information collected from trials
  • blockConfig -- The block settings
  • phaseConfig -- The phase settings
Returns:

The information collected from trials.

Return type:

trialData

High-/low-fat food decision-making task (HLFF)

PTF.HLFF(subjectId)

Task script for the high-/low-fat food task designed by Sarah Healy.

Parameters:subjectId (optional) -- A participant ID
Returns:A record of the participant's choices.
Return type:Data
PTF.tasks.HLFF.HLFF_HFConfig(initial_config)

Configure high-fat blocks of high-/low-fat food task.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the HLFF high-fat condition
PTF.tasks.HLFF.HLFF_LFConfig(initial_config)

Configure low-fat blocks of high-/low-fat food task.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the HLFF low-fat condition
PTF.tasks.HLFF.HLFF_blockDefaults()

Return general block config for the high-/low-fat food task designed by Sarah Healy by modifying the default ones from config.

Returns:Config struct with settings shared across all HLFF conditions.
PTF.tasks.HLFF.HLFF_monetaryConfig(initial_config)

Configure monetary blocks of high-/low-fat food task.

Parameters:initial_config -- Task config struct to modify
Returns:Config struct specific to the HLFF monetary condition