Welcome! Log In Create A New Profile

Advanced

Task Proceeds If Meets Requirements

Posted by dianaaa 
Task Proceeds If Meets Requirements
June 25, 2020 08:54PM
Hello!

I am currently working on a touch task based on the dms (touch) in the MonkeyLogic package. We have an IR barrier input into our DAQ, that send pulses when broken. Essentially, we would like to read the pulses from the DAQ and use it to determine whether our task proceeds.

Essentially, we would like the animal to break the IR barriers before the task and have them remain broken in order for the task to proceed, while completing the touch trial. Something for our DAQ input along the lines of while istouching(), end

except, for us we would like:
if (pulse from DAQ), proceed

and

if (no pulse from DAQ) in 200ms, keep proceeding
or
if (second pulse from DAQ) in 200ms, abort trial



Is this something the code is capable of?
Thanks!
Re: Task Proceeds If Meets Requirements
June 26, 2020 05:38PM
Please take a look at the get_analog_data function. You can read and analyze the IR barrier signal in the script and decide whether to proceed or not.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#get_analog_data
Re: Task Proceeds If Meets Requirements
June 30, 2020 06:53PM
Thanks for your help!

The get_analog_data works great if we are trying to detect a beam break, and helps with our trial initiation for sure!

Is there a code function along the lines of eyejoytrack, that after the first initial break, would continue the trial unless the beam was un-broken? We would use the analog input from the IR beam breaking, to have the animal keep the beam broken (i.e. no signal sent from the DAQ) for a certain period of time.

Similar to eye fixation but with the breaking of the IR barriers, we would like them to keep the beam broken and simultaneously play the game by touching
Re: Task Proceeds If Meets Requirements
July 01, 2020 12:09PM
Yes, there is. Use eyejoytrack(). Use the "function" signal type.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#eyejoytrack

Since the "broken" state should be maintained, use 'holdfunc' and make the function return 1 if the IR barrier is broken and 0 otherwise. Your function needs to access get_analog_data(), so place the function at the end of your timing script, not in a separate file.

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.