psychopy.org | Reference | Downloads | Github

Trial number is not included in output

I’m looking at the output generated by some trials (JSON format because this is exported to JS but I’m not sure if this is web-specific), and it doesn’t seem like any of the field record the actual trial number (e.g., has value 1 for the first stimulus/response, 2 for the second, etc.). Here’s what I get for a single trial:

    "pre_continuum_key.keys": "j",
    "pre_continuum_key.rt": 0.27500009536743164,
    "pre_continuum_trials.thisRepN": 1,
    "pre_continuum_trials.thisTrialN": 0,
    "pre_continuum_trials.thisN": 16,
    "pre_continuum_trials.thisIndex": 13,
    "pre_continuum_trials.ran": 1,
    "pre_continuum_trials.order": 15,
    "items": "the_continuum/continuum_75.wav",

I thought (naively?) that thisTrialN would be the trial number, but it’s still 0 for the next trial:

    "pre_continuum_key.keys": "j",
    "pre_continuum_key.rt": 0.24300003051757812,
    "pre_continuum_trials.thisRepN": 1,
    "pre_continuum_trials.thisTrialN": 0,
    "pre_continuum_trials.thisN": 16,
    "pre_continuum_trials.thisIndex": 15,
    "pre_continuum_trials.ran": 1,
    "pre_continuum_trials.order": 15,
    "items": "the_continuum/continuum_85.wav",

and the next:

    "pre_continuum_key.keys": "j",
    "pre_continuum_key.rt": 0.1419999599456787,
    "pre_continuum_trials.thisRepN": 1,
    "pre_continuum_trials.thisTrialN": 0,
    "pre_continuum_trials.thisN": 16,
    "pre_continuum_trials.thisIndex": 0,
    "pre_continuum_trials.ran": 1,
    "pre_continuum_trials.order": 15,
    "items": "the_continuum/continuum_10.wav",

I’m assuming that thisIndex is giving me the index into the list of items, and order is somehow linked to the particular randomization used for this repetition of the items. But I can’t see any way to recover the actual presentation order from these records (unless of course they remain sorted, which they might not if they get dumped into a database or something).

I should add that this is output produced from psychojs code generated by builder, so maybe there’s some option I’m missing? Here’s the trials loop for this bit of the experiment from the .psyexp file:

    <LoopInitiator loopType="TrialHandler" name="pre_continuum_trials">
      <Param name="Selected rows" updates="None" val="" valType="str"/>
      <Param name="conditions" updates="None" val="[OrderedDict([('items', 'the_continuum/continuum_10.wav')]), OrderedDict([('items', 'the_continuum/continuum_15.wav')]), OrderedDict([('items', 'the_continuum/continuum_20.wav')]), OrderedDict([('items', 'the_continuum/continuum_25.wav')]), OrderedDict([('items', 'the_continuum/continuum_30.wav')]), OrderedDict([('items', 'the_continuum/continuum_35.wav')]), OrderedDict([('items', 'the_continuum/continuum_40.wav')]), OrderedDict([('items', 'the_continuum/continuum_45.wav')]), OrderedDict([('items', 'the_continuum/continuum_50.wav')]), OrderedDict([('items', 'the_continuum/continuum_55.wav')]), OrderedDict([('items', 'the_continuum/continuum_60.wav')]), OrderedDict([('items', 'the_continuum/continuum_65.wav')]), OrderedDict([('items', 'the_continuum/continuum_70.wav')]), OrderedDict([('items', 'the_continuum/continuum_75.wav')]), OrderedDict([('items', 'the_continuum/continuum_80.wav')]), OrderedDict([('items', 'the_continuum/continuum_85.wav')])]" valType="str"/>
      <Param name="conditionsFile" updates="None" val="continuum_test_conds.csv" valType="str"/>
      <Param name="endPoints" updates="None" val="[0, 1]" valType="num"/>
      <Param name="isTrials" updates="None" val="True" valType="bool"/>
      <Param name="loopType" updates="None" val="random" valType="str"/>
      <Param name="nReps" updates="None" val="8" valType="code"/>
      <Param name="name" updates="None" val="pre_continuum_trials" valType="code"/>
      <Param name="random seed" updates="None" val="" valType="code"/>
    </LoopInitiator>

Hi @kleisnchmidt, which version of PsychoPy are you using?

3.1.2 it looks like (based on the json).

Actually, this looks like a bug now to me, maybe related to https://github.com/psychopy/psychojs/issues/49. It seems like save is pulling in some trial data that reflects the last scheduled trial, not the last run trial (hence the maxed out values of order and thisN (there are 16 trials in this loop).

Yes, it was an issue where the scheduler was not saving trial by trial index data. If you use version 3.2.4, this issue will have been resolved.

1 Like