Welcome! Log In Create A New Profile

Advanced

Collecting Analog Data every MS

Posted by CptCook95 
Collecting Analog Data every MS
June 14, 2024 01:25PM
Hello, I am using framework V2 and I'm trying to see if there is a way to collect analog data (From touch) every MS for each trial in a certain way. I understand that there is the analog data field in the bhv file but I would like to also anotate this data by adding a few extra fields such as if the current touch is on target, off target, or on distractor. Of course this is something I could do in post-processing with a little more effort.

This is code I have been using to test.

hold_radius = 15;

currentTask = "ShrinkingCircle";
target = 1;

crc = CircleGraphic(null_);
crc.EdgeColor = [1 1 1];
crc.FaceColor = [1 1 1];
if hold_radius < 15 %change with subject progress
hold_radius = 15;
crc.Size = 15;
else
crc.Size = 15; %- 0.10*(subjectData.TaskInfo.Progress.ShrinkingCircle.Correct));
hold_radius = crc.Size;
end

fix1 = SingleTarget(touch_);
fix1.Target = crc;
fix1.Threshold = hold_radius;

fth1 = FreeThenHold(fix1);
fth1.MaxTime = 7500;
fth1.HoldTime = 500;

shrinkingCircleTask = create_scene(fth1);
run_scene(shrinkingCircleTask);
if fth1.Success
rt = fth1.RT;
trialerror(0);
error_type = 0;
else
trialerror(2);
error_type = 2;
end

Essentially, my question is: is there a way I can annotate the analog data collection as the trial runs using an adapter?
Re: Collecting Analog Data every MS
June 14, 2024 04:04PM
You can collect some time info from adapters after a scene and store it to the datafile. In your code, for example,
on_target_time = [];
off_target_time = [];
if fth1.Success
    on_target_time = fth1.AcquiredTime;  % or fix1.Time
elseif 0<fth1.BreakCount
    off_target_time = fix1.Time;
end
bhv_variable('on_tartget',on_target_time,'off_target',off_target_time);
Re: Collecting Analog Data every MS
June 17, 2024 04:16PM
Hi Jaewon,

Thank you for the reply. I was actually thinking of something more like how it is currently represented in the trialRecord analogData structure, such that I could have a structure with this composition:

ms x y OnTarg OnDis OffTarget
1 x y TRUE FALSE TRUE
2 etc..
3
4
5
....

I would like to sample each ms of every trial to get a detailed report of touch behaviour.
I know this could be done in a post-hoc analysis but it would be helpful for me to do it trial by trial.
Re: Collecting Analog Data every MS
June 17, 2024 06:32PM
You can retrieve Touch X &Y with get_analog_data() and construct the other columns by calculating the distance from the objects.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#get_analog_data
Re: Collecting Analog Data every MS
June 18, 2024 12:39PM
Thank you Jaewon,

I will take a look. Thank you for being so quick to reply.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.