Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Geenaianni

Junior Member
Registered:
Posts: 27
Reply with quote  #1 

Hi All, 

I am attempting to present movies while requiring fixation using the "loosehold" adapter. In order to minimize ITI time, we are using the userloop functionality, &the runtime V2.  Now, I would like to send eventmarkers at particular frame #s in those movies, to our neural acquisition system using "FrameCounter". My confusion arises with how to integrate the FrameCounter adapter into the existing chain of adapters (which are eye_ --> waitthenHold in the 1st scene, and then eye_ --> looseHold, in the second scene). 

My understanding is that create_scene only takes 1 adapter as input, and thus the chain structure. The "Adapter Hierarchy" pptx seems to suggest FrameCounter can exist on it's own, outside of this chain structure -- but I'd like to run it simultaneously as the movies. 

My question is, is there a way to integrate FrameCounter into my existing adapter chain, or do I need to create a new scene all together, which somehow will run simultaneously with scene2?

Code is attached for clarity ("fixate_reward_v2.m", other one titled lh_expFaces I attached by accident and cannot delete!) , line 62 is relevant, taken from ML documentation.
Thanks much as always.
best,
Geena

 
Attached Files
m fixate_reward_userloop.m (3.70 KB, 5 views)
m fixate_reward_v2.m (6.08 KB, 5 views)

0
Jaewon

Administrator
Registered:
Posts: 689
Reply with quote  #2 
The purpose of FrameCounter is to run the scene for a certain number of frames. To send eventmarkers in the way you wrote, the scene has to be terminated after Frame 90 is presented. I guess what you want is to send the code while the movie is still playing. FrameCounter cannot do that and you need to make your own adapter for this.

I added a new adapter, FrameMarker, to the new ML package. Please download and see if it works for you.

ftp://helix.nih.gov/lsn/monkeylogic/ML2_doc/runtimefunctions.html#FrameMarker

http://forums.monkeylogic.org/post/nimh-monkeylogic-2-8444337?trail=225#221
0
Geenaianni

Junior Member
Registered:
Posts: 27
Reply with quote  #3 
yes, this works perfectly, thank you so much!
for anyone using FrameMarker in the future in a similar way -- the adapter chain I used to send eventmarkers during movie presentation (without terminating the scene) is eye_ --> loosehold --> frameMarker.

thanks Jaewon

0
Jaewon

Administrator
Registered:
Posts: 689
Reply with quote  #4 
Actually FrameMarker can be anywhere in the chain, since it does not change the status of the underlying adapter.

FYI, you can combine multiple chains with AndAdapter or OrAdapter.

ftp://helix.nih.gov/lsn/monkeylogic/ML2_doc/runtimefunctions.html#AndAdapter
0
Geenaianni

Junior Member
Registered:
Posts: 27
Reply with quote  #5 
Hi again, 

a related question -- now that we can send eventmarkers during a particular frame in a movie (thanks for that), I am trying offline, to return the eyeposition of the animal during that particular frame. I'm doing this by 1) constructing an EyeTimeAxis (of length(AnalogData.Eye) divided by AI sr, 1khz), and then 2) finding the index of the FrameEventMarker CodeTime within EyeTimeAxis, and finally 3) using this index to return the eyePosition at CodeTime. (see attached code).

In doing this, I noticed that EyeTimeAxis is always slightly longer than the trial length, as defined by the codetimes of eventmarkers 9&18. my understanding is that codeTime '9' marks the 1st analog signal of the trial, ie, some amount of time after the 1st analog signal is acquired from the DAQ card.

so I wanted to check 1) if this is actually why the length of AnalogData.Eye is slightly longer than would be expected given the 8/19 timestamps, and 2) if you think this is a reasonable way to recooperate eye position at a given frame (or if there is a better way to do it). My understanding is that if FrameEventMarker codetime = 200 ms, this means 200 ms after the 1st analog signal is acquired, and thus the index of FramEventMarker in EyeTimeAxis still matches up appropriately with AnalogData.Eye.

PS -- doesnt appear we can attach .mat files here, so .m file only 

thanks!
best,
Geena


 
Attached Files
m ML_eyeTime_vs_eventTime.m (942 Bytes, 1 views)

0
Jaewon

Administrator
Registered:
Posts: 689
Reply with quote  #6 
How much longer is the EyeTimeAxis? The time of Code 9 is NOT the time of the 1st analog sample of the trial, although they should be pretty close. Code 9 & 18 are stamped after data acquisition starts and before it ends, respectively. Therefore, the length(AnalogData.Eye) is supposed to be longer than the interval between Code 9 and 18.

It seems that you choose MAT as the file format. Although MAT is usable, it becomes slow as more variables are stored. So it is not recommended, if your experiment is long and has a short ITI. And you can still read the MAT file with mlread.
0
Geenaianni

Junior Member
Registered:
Posts: 27
Reply with quote  #7 
the eyeTimeAxis is ~15-18 ms longer than EventCodeTime(18) - EventCodeTime(9).

As to the meaning of code 9 -- right, as you stated, my understanding is that the data acquisition starts, ML initializes what's needed for the task, then at X time after the data acquisition starts, code9 is stamped. My confusion was how to accurately align subsequent eventmarkers with AnalogData.Eye, given their unequal lengths. If the extra length in AnalogData.Eye is due to the samples before/after codes 8/19, then the approach outlined above (construct EyeTimeAxis -->find EventMarker CodeTime index in EyetimeAxis --> index into AnalogData.Eye) should return eye position at a given eventmarker time, regardless of unequal lengths, I think?
0
Jaewon

Administrator
Registered:
Posts: 689
Reply with quote  #8 
Forget about Code 9 & 18. They have nothing to do with the trial length. Pretend they don't exist.

The sample acquisition starts at Time 0, so you can just use the time of the event to calculate the corresponding sample position.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.