Welcome! Log In Create A New Profile

Advanced

ComplementaryWindow-moving target

Posted by bt2 
bt2
ComplementaryWindow-moving target
June 02, 2020 08:12AM
Hello Jaewon,

I am working on a task in which monkeys should intercept a moving target on a touchscreen.
I am using SingleTarget and CurveTracer as in the following script:
trace1 = CurveTracer(touch_);
trace1.Target = 1;
trace1.Trajectory = [x y];
fix1 = SingleTarget(trace1);
fix1.Threshold = 1.5;
scene1 = create_scene(fix1,1);
run_scene(scene1);

It seems to me that the time interval between frames equals the refresh rate of the touchscreen; is it right?

I tried creating a complementary window to detect touches outside the window and interrupt the task. I used the following script:
trace1 = CurveTracer(touch_);
trace1.Target = 1;
trace1.Trajectory = [x y];
fix1 = SingleTarget(trace1);
fix1.Threshold = 1.5;
wth = WaitThenHold(fix1);
wth.WaitTime = 5000;
wth.HoldTime = 10;

out = ComplementaryWindow(trace1);
out.setTarget(fix1);
ac = AllContinue(wth);
ac.add(out);
scene = create_scene(ac,1);
run_scene(scene);
but unfortunately this did not work. Can ComplementaryWindow work with a moving stimulus?

I am going to use some webcams to film the animals, and I saw that it is possible to synchronize the start of each video with a new trial.
Is it possible to make an "if" statement in my script and lauch the recording of video only in certain conditions?

Many thanks
Re: ComplementaryWindow-moving target
June 05, 2020 01:42PM
The time interval between frames equals 1 / (refresh rate). If the refresh rate is 60 Hz, the interval is 1 / 60 = 16.67 msec.

I made ComplementaryWindow work with a moving window created with CurveTracer + SingleTarget. Please overwrite the files in the ext directory of your NIMH ML with the attached ones. TouchTracker needs to be updated as well. Or just download the new packages.

You used trace1 as an input to ComplementaryWindow in the code you posted. It will work, but ComplementaryWindow is a chain separate from the one ending with WaitThenHold and combined later by AllContinue, so technically you should use a tracker (touch_, in this case) there.

out = ComplementaryWindow(touch_);

All data acquisition is initiated and aligned slightly earlier than the execution of the user script, so any attempt to change it in the script will disrupt the synchronization for now.
Attachments:
open | download - TouchTracker.m (2.2 KB)
open | download - ComplementaryWindow.m (2.9 KB)
bt2
Re: ComplementaryWindow-moving target
June 08, 2020 07:50AM
Thank you very much!

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.