Welcome! Log In Create A New Profile

Advanced

How to control total time of all Trials?

Posted by _Richard_ 
How to control total time of all Trials?
February 15, 2023 11:00AM
Hi Jaewon,
I would like to using MonekeyLogic with task-fMRI.
For example, one scan duration is 240s , I would like monkeylogic program to have the matching duration.
The trial block paradigm is (Fixation center Scene 4 sec + Fixation center Grating Scene 6 sec + MultiTarget Scene 2 sec)
Each program consists of 20 trials ,so that’s 240s in total.

-20230215_run02_trial5_ITI0.bhv2 – 63s
-20230215_run03_trial5_ITI1000.bhv2 – 66s
Take 5 trials as example, I set ITI (Inter-trial Interval) to be 0 ms, without showing traces or records in ITI, It still took 3s more than expected for each program, eg 5trials*12s + 3 s.
I found even I set ITI=1000ms , the difference of total time still varied from trial to trial.
For 20 trials , it will cause more uncertainty, which is unexpected and causes problems for me to align it with fmri data.

- What I tried
I have tried to modify the elegant LBC-fMRI demo code first, but it seems complicated for me to modify LBC_ImageChanger to SineGrating directly.
So I reused built-in adapter of Concurrent and RewardScheduler to create scenes. And I also set “goodmonkey” with 'nonblocking’,2 to save time.
The codes are attached.
Q1 – How could I control the total time of all trials, to match a fixed duration of fMRI scan?
Q2 – For RewardScheduler, how to set the allowing-break-fixation duration ? For example ,first the subject fixates for 300ms, then breaks fixation for more than 500ms(the duration I would like to modify), then reset the hold time back to be initial 1500ms.
Q3 - 2 warning showed when ITI = 0,
Warning 1 - Trial 2 : Desired ITI exceeded
Warning 2 – Trial3: 1 skipped frames occurred.
I am not sure whether these warnings also effects the total time.
Q4: In my bhv2 file, from “Start trial” to first scene “Fix Cue” , it have about 300ms interval time. Is it possible to shorten it?
The frame interval and drawing time are at 30ms level, which seems not to be the main issue?
Q5: Or do you have a better idea for implementing the task?
My ML version is 2.2.31.
Thank you.
Attachments:
open | download - Design_submit.zip (131.9 KB)
Re: How to control total time of all Trials?
February 15, 2023 01:27PM
The length of ITI depends on the external variables (e.g., speed of the CPU and disk) too much and cannot be exactly the duration that you set.

You can run one trial of which length is 240 s. Just repeat the paradigm sequence 20 times in that one trial.
Re: How to control total time of all Trials?
February 15, 2023 09:43PM
Thanks for you reply.
Previously, I used TrialError() to know whether the subject choose Target with MultiTarget() , trial by trial.
If I only have one trial, how could I know the performance of choosing the Target for each paradigm sequence?
Re: How to control total time of all Trials?
February 16, 2023 01:58AM
You can use dashboard() or whatever way you want to display the information.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#dashboard

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.