+x+x+xHi,
I'm running a version of the rotor task and getting too many nans in my results. Sometimes this is when the person doesn't move their mouse, but sometimes it's when they get a perfect score. I can't figure out how to differentiate between the two, or how to make it so I'm capturing true time on task. I've attached my script for reference. Thanks.
I've done a number of test runs with that script now and am not seeing any nans under those conditions (not moving mouse and/or (near) perfect target tracking).
Perhaps it would help if you could provide some data files that show the issue. That might provide some pointers as to what may be going wrong and where.
Here's a data file with the nans. Under trialcode (column M), test 1 is the hardest and test 7 is the easiest.
Thanks for the data -- after turning it left to right and upside down, I think the following holds:
- The "nan" issue predominantly occurs in the "slow" rotation trials, i.e. mostly trial5 to trial7. The slower the rotation speed, the higher the rate of occurrence.
- It indeed appears to be due to the participant tracking the target _perfectly_, i.e. without slipping off-target even a single time during the entire 20 seconds of rotation. The consequence is that no values/items are ever entered into the per-trial "off distance" and "off duration" <list>s.
<trial test7>
/ stimulusframes = [1 = clearscreen, innerTrack, animatedCircle7]
/ validresponse = (mousemove)
/ isvalidresponse = [
if (trial.test7.response == "mousemove" && expressions.distance7 > parameters.targetDiscSize) {
list.targetDistances_total.insertitem(expressions.distance7, 1);
list.targetDistances_trial.insertitem(expressions.distance7, 1);
list.offTargetDistance_trial.insertitem(expressions.distance7, 1);
list.offTargetDistance_total.insertitem(expressions.distance7, 1);
if (values.previous_targetlocation == 1) {
values.startOffTarget = script.elapsedtime;
values.previous_targetlocation = 0;
} ;
1 == 1;
} else if (trial.test7.response == "mousemove" && expressions.distance7 <= parameters.targetDiscSize) {
list.targetDistances_total.insertitem(expressions.distance7, 1);
list.targetDistances_trial.insertitem(expressions.distance7, 1);
if (values.previous_targetlocation == 0) {
values.offDuration = script.elapsedtime - values.startOffTarget;
list.
offDurations_total.insertitem(values.offDuration, 1);
list.
offDurations_trial.insertitem(values.offDuration, 1);
values.previous_targetlocation = 1;
} ;
1 == 1;
}
]
...
</trial>
They remain empty (i.e. contain zero items), and consequently expressions.sum_offDurations_trial
<expressions>
...
/ sum_offDurations_trial = list.offDurations_trial.mean * list.offDurations_trial.itemcount
...
</expressions>
returns "not a number" ( nan ) with all the follow-on effects.
In most cases, however, it *should* be possible to verify those instances of perfect target tracking with the data you have at hand nonetheless.
Even though expressions.timeOnTarget
_trial does not capture the duration for the reason sketched out above, what *does* capture the relevant information regardless is expressions.timeOnTarget
_total. To illustrate, take subject # 185835477 from your data set:

You can see the "nan" occurence in trial7, but calculating the difference between the value of expressions.timeOnTarget_total in trial7 and its value in the preceding trial verifies that the full time was spent "on target": (71018 - 51018) = 20000.