Timing problem: how to prevent lagging


Author
Message
DO0812
DO0812
Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)
Group: Forum Members
Posts: 3, Visits: 31
Hi all,

I have a procedure that involves presenting a number of trials with different set sizes of images (i.e., on some trials, the participant sees 8 images, on others they see 36, etc.).
In the task I have a value that I have set to reflect the elapsed time (time_passed) since the beginning of the procedure, and at the beginning of each trial I update this value.
I also have information relating to the duration of the trial overall. However, these values don’t seem to balance. For example, if values.time_passed = 2000 on Trial X, and Trial X’s duration is 2000, I would expect that the value of time_passed on Trial X+1 should be 4000 (or maybe 4001). However, there’s a discrepancy between these values. For example, values.time_passed at the beginning of Trial X+1 will actually be something like 4025 or 4014 (so also no constant delay). This is an issue because I am using EEG, so precise timing is crucial.

I think that the problem may lie in the fact that multiple images have to be loaded simultaneously, and there’s some buffering time for loading these images.
1.       Is it possible that loading these images could cause this kind of lagging effect?
2.       If so, is there any way that I can overcome this issue (for example, in E-Prime, you can “pre-release” images at the beginning of the procedure to prevent lagging)?

Thanks in advance,
Danna

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
DO0812 - Thursday, May 2, 2019
Hi all,

I have a procedure that involves presenting a number of trials with different set sizes of images (i.e., on some trials, the participant sees 8 images, on others they see 36, etc.).
In the task I have a value that I have set to reflect the elapsed time (time_passed) since the beginning of the procedure, and at the beginning of each trial I update this value.
I also have information relating to the duration of the trial overall. However, these values don’t seem to balance. For example, if values.time_passed = 2000 on Trial X, and Trial X’s duration is 2000, I would expect that the value of time_passed on Trial X+1 should be 4000 (or maybe 4001). However, there’s a discrepancy between these values. For example, values.time_passed at the beginning of Trial X+1 will actually be something like 4025 or 4014 (so also no constant delay). This is an issue because I am using EEG, so precise timing is crucial.

I think that the problem may lie in the fact that multiple images have to be loaded simultaneously, and there’s some buffering time for loading these images.
1.       Is it possible that loading these images could cause this kind of lagging effect?
2.       If so, is there any way that I can overcome this issue (for example, in E-Prime, you can “pre-release” images at the beginning of the procedure to prevent lagging)?

Thanks in advance,
Danna

It's impossible to say without seeing the actual code; the additional time (20ms or so) might be due to images being erased from the screen after a given trial / before the next trial begin. This would at a minimum take one display frame; additionally and separately the next trial will have to wait for the start of the next display refresh cycle before it can begin drawing stimuli, so the discrepancy might stem from that. If you want to minimize delay due to stimuli being erased after a trial, you can set your various simuli to /erase = false and instead perform a clearscreen at the beginning of each trial's stimulus presentation sequence. I doubt that the discrepancy is introduced by image loading times (all images are parsed into RAM at the start of the experiment), but you can try defining a /pretrialpause in your <trial> elements to give the trial a fixed amount of time to prepare its stimulus presentation sequence. Finally, make sure that your Inquisit installation is up to date, some older versions (prior to 5.0.11.0 if I recall correctly) could introduce additional delay under some circumstances due to performing redundant graphics operations after a trial's end.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
DO0812 - Thursday, May 2, 2019
Hi Dave,

Thanks for your quick response. I tried all of the recommendations that you made, but none of them seem to do the job. I’ve attached a zip file which includes the code and images used, and also pasted a simplified version of the script below (primarily so that future users can also see for reference; sorry for its length). Some further details for context:
On each trial, one of three different stimulus types are presented: images of normal faces, images of scrambled faces, or a generic target image. For both stimulus types involving faces, faces are randomly selected from a pool of 42 different images. However, there are some constraints: specifically, one image always needs to be presented in one of the four central portions of the 6 x 6 positions where faces can appear. I achieved this using a series of nested lists (there’s probably an easier way to do it, but I couldn’t figure it out). I’m thinking that maybe this complicated process of stimulus identity/position selection could maybe have an impact in how quickly the trials appear. 
I hope this can be of more use. Thanks again for your help. 

All the best
Danna 

************************************************
defaults ----- output EEG(??)
************************************************
<defaults>
/ screencolor = black
/ txcolor = white
/ txbgcolor = black
/ fontstyle = ("Arial", 5.00%)
/ inputdevice = keyboard
/ validkeys = (" ")
/ halign = center
/ valign = center
/ canvassize=(100%, 100%)
/ canvasaspectratio = (1366, 1366)
/ lptaddresses = (LPT3=D050)
</defaults>

************************************************
instructions
************************************************

<instruct>
/ fontstyle = ("Arial", 3.00%)
/ inputdevice = keyboard
/ nextkey = (" ")
/ nextlabel = "Press the spacebar to continue"
</instruct>

<page instructions>
^^In this task you will see a varying number of images appear of either faces, scrambles or checkerboards.
^^Your task is to press space once as quickly and accurately as possible when you see images of checkerboards appear.
^^A fixation cross will appear in the middle of the screen, keep your eyes on this fixation cross.
^^When you are ready, press the spacebar to begin.
</page>

<page break1>
^Good! This is a break. Press the spacebar when you're ready to continue.
</page>

<page break2>
^Good! This is a break. Press the spacebar when you're ready to continue.
</page>

<page end>
This is the end of the experiment. Thank you for participating!
</page>


**********************
<values>
/ time_passed = expt.experiment.elapsedtime
</values>

**************************
counter elements for effective randomisation and
selection of face stimuli
************************************************

<counter face_selector>
/ select = noreplace(1-42)
/ selectionrate = always
</counter>

<item stimulus_faces>
/ 1 = "f01.bmp"
/ 2 = "f02.bmp"
/ 3 = "f03.bmp"
/ 4 = "f05.bmp"
/ 5 = "f06.bmp"
/ 6 = "f07.bmp"
/ 7 = "f08.bmp"
/ 8 = "f09.bmp"
/ 9 = "f10.bmp"
/ 10 = "f11.bmp"
/ 11 = "f12.bmp"
/ 12 = "f13.bmp"
/ 13 = "f14.bmp"
/ 14 = "f15.bmp"
/ 15 = "f16.bmp"
/ 16 = "f17.bmp"
/ 17 = "f18.bmp"
/ 18 = "f19.bmp"
/ 19 = "f20.bmp"
/ 20 = "f21.bmp"
/ 21 = "f22.bmp"
/ 22 = "f23.bmp"
/ 23 = "f24.bmp"
/ 24 = "f25.bmp"
/ 25 = "f26.bmp"
/ 26 = "f28.bmp"
/ 27 = "f29.bmp"
/ 28 = "f30.bmp"
/ 29 = "f31.bmp"
/ 30 = "f32.bmp"
/ 31 = "f33.bmp"
/ 32 = "f34.bmp"
/ 33 = "f35.bmp"
/ 34 = "f36.bmp"
/ 35 = "f37.bmp"
/ 36 = "f38.bmp"
/ 37 = "f39.bmp"
/ 38 = "f40.bmp"
/ 39 = "f41.bmp"
/ 40 = "f42.bmp"
/ 41 = "f43.bmp"
/ 42 = "f45.bmp"
</item>

<item stimulus_scrambled>
/ 1 = "s01.bmp"
/ 2 = "s02.bmp"
/ 3 = "s03.bmp"
/ 4 = "s05.bmp"
/ 5 = "s06.bmp"
/ 6 = "s07.bmp"
/ 7 = "s08.bmp"
/ 8 = "s09.bmp"
/ 9 = "s10.bmp"
/ 10 = "s11.bmp"
/ 11 = "s12.bmp"
/ 12 = "s13.bmp"
/ 13 = "s14.bmp"
/ 14 = "s15.bmp"
/ 15 = "s16.bmp"
/ 16 = "s17.bmp"
/ 17 = "s18.bmp"
/ 18 = "s19.bmp"
/ 19 = "s20.bmp"
/ 20 = "s21.bmp"
/ 21 = "s22.bmp"
/ 22 = "s23.bmp"
/ 23 = "s24.bmp"
/ 24 = "s25.bmp"
/ 25 = "s26.bmp"
/ 26 = "s28.bmp"
/ 27 = "s29.bmp"
/ 28 = "s30.bmp"
/ 29 = "s31.bmp"
/ 30 = "s32.bmp"
/ 31 = "s33.bmp"
/ 32 = "s34.bmp"
/ 33 = "s35.bmp"
/ 34 = "s36.bmp"
/ 35 = "s37.bmp"
/ 36 = "s38.bmp"
/ 37 = "s39.bmp"
/ 38 = "s40.bmp"
/ 39 = "s41.bmp"
/ 40 = "s42.bmp"
/ 41 = "s43.bmp"
/ 42 = "s45.bmp"
</item>

<item stimulus_target>
/ 1 = "target.bmp"
/ 2 = "target.bmp"
/ 3 = "target.bmp"
/ 4 = "target.bmp"
/ 5 = "target.bmp"
/ 6 = "target.bmp"
/ 7 = "target.bmp"
/ 8 = "target.bmp"
/ 9 = "target.bmp"
/ 10 = "target.bmp"
/ 11 = "target.bmp"
/ 12 = "target.bmp"
/ 13 = "target.bmp"
/ 14 = "target.bmp"
/ 15 = "target.bmp"
/ 16 = "target.bmp"
/ 17 = "target.bmp"
/ 18 = "target.bmp"
/ 19 = "target.bmp"
/ 20 = "target.bmp"
/ 21 = "target.bmp"
/ 22 = "target.bmp"
/ 23 = "target.bmp"
/ 24 = "target.bmp"
/ 25 = "target.bmp"
/ 26 = "target.bmp"
/ 27 = "target.bmp"
/ 28 = "target.bmp"
/ 29 = "target.bmp"
/ 30 = "target.bmp"
/ 31 = "target.bmp"
/ 32 = "target.bmp"
/ 33 = "target.bmp"
/ 34 = "target.bmp"
/ 35 = "target.bmp"
/ 36 = "target.bmp"
/ 37 = "target.bmp"
/ 38 = "target.bmp"
/ 39 = "target.bmp"
/ 40 = "target.bmp"
/ 41 = "target.bmp"
/ 42 = "target.bmp"
</item>

************************************************
stimuli position
************************************************

<list position_selector>
/ items = (1; 2; 3; 4)
/ replace = true
</list>

<list position_selector_2>
/ items = (1; 2; 3; 4; 5; 6;
           7; 8; 9; 10; 11; 12;
                                  13; 14; 15; 16; 17; 18;
                                  19; 20; 21; 22; 23; 24;
                                  25; 26; 27; 28; 29; 30;
                                  31; 32; 33; 34; 35; 36)
/ not = (list.position_selector.currentindex)
</list>

<list position_selector_3>
/ items = (1; 2; 3; 4; 5; 6;
           7; 8; 9; 10; 11; 12;
                                  13; 14; 15; 16; 17; 18;
                                  19; 20; 21; 22; 23; 24;
                                  25; 26; 27; 28; 29; 30;
                                  31; 32; 33; 34; 35; 36)
/ not = (list.position_selector.currentindex,
                                list.position_selector_2.currentindex)
</list>

<list position_selector_4>
/ items = (1; 2; 3; 4; 5; 6;
           7; 8; 9; 10; 11; 12;
                                  13; 14; 15; 16; 17; 18;
                                  19; 20; 21; 22; 23; 24;
                                  25; 26; 27; 28; 29; 30;
                                  31; 32; 33; 34; 35; 36)
/ not = (list.position_selector.currentindex,
                                list.position_selector_2.currentindex,
                                list.position_selector_3.currentindex)
</list>

****************************
first order position lists
****************************

<list v_position_1>
/ items = [47%; 47%; 53%; 53%]
/ selectionmode = list.position_selector.nextindex
</list>

<list h_position_1>
/ items = [47%; 53%; 47%; 53%]
/ selectionmode = list.position_selector.nextindex
</list>

<list v_position_2>
/ items = [47%; 47%; 53%; 53%; 35%; 41%;
           47%; 53%; 59%; 65%; 35%; 41%;
           47%; 53%; 59%; 65%; 35%; 41%;
                       59%; 65%; 35%; 41%; 59%; 65%;
                       35%; 41%; 47%; 53%; 59%; 65%;
                       35%; 41%; 47%; 53%; 59%; 65%]
/ selectionmode = list.position_selector_2.nextindex
</list>

<list h_position_2>
/ items = [47%; 53%; 47%; 53%; 35%; 35%;
                                  35%; 35%; 35%; 35%; 41%; 41%;
                                  41%; 41%; 41%; 41%; 47%; 47%;
                                  47%; 47%; 53%; 53%; 53%; 53%;
                                  59%; 59%; 59%; 59%; 59%; 59%;
                                  65%; 65%; 65%; 65%; 65%; 65%]
/ selectionmode = list.position_selector_2.nextindex
</list>

<list v_position_3>
/ items = [47%; 47%; 53%; 53%; 35%; 41%;
           47%; 53%; 59%; 65%; 35%; 41%;
           47%; 53%; 59%; 65%; 35%; 41%;
                       59%; 65%; 35%; 41%; 59%; 65%;
                       35%; 41%; 47%; 53%; 59%; 65%;
                       35%; 41%; 47%; 53%; 59%; 65%]
/ selectionmode = list.position_selector_3.nextindex
</list>

<list h_position_3>
/ items = [47%; 53%; 47%; 53%; 35%; 35%;
                                  35%; 35%; 35%; 35%; 41%; 41%;
                                  41%; 41%; 41%; 41%; 47%; 47%;
                                  47%; 47%; 53%; 53%; 53%; 53%;
                                  59%; 59%; 59%; 59%; 59%; 59%;
                                  65%; 65%; 65%; 65%; 65%; 65%]
/ selectionmode = list.position_selector_3.nextindex
</list>


<list v_position_4>
/ items = [47%; 47%; 53%; 53%; 35%; 41%;
           47%; 53%; 59%; 65%; 35%; 41%;
           47%; 53%; 59%; 65%; 35%; 41%;
                       59%; 65%; 35%; 41%; 59%; 65%;
                       35%; 41%; 47%; 53%; 59%; 65%;
                       35%; 41%; 47%; 53%; 59%; 65%]
/ selectionmode = list.position_selector_4.nextindex
</list>

<list h_position_4>
/ items = [47%; 53%; 47%; 53%; 35%; 35%;
                                  35%; 35%; 35%; 35%; 41%; 41%;
                                  41%; 41%; 41%; 41%; 47%; 47%;
                                  47%; 47%; 53%; 53%; 53%; 53%;
                                  59%; 59%; 59%; 59%; 59%; 59%;
                                  65%; 65%; 65%; 65%; 65%; 65%]
/ selectionmode = list.position_selector_4.nextindex
</list>
>>>>>>> stimulus-selection-solution:Materials/Task Inquisit/TaskMultiple_faces.iqx

************************************************
Text
************************************************



faces
************************************************

<picture face_1>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_1
/ vposition = v_position_1
/ size = (6%, 6%)
</picture>

<picture face_2>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_2
/ vposition = v_position_2
/ size = (6%, 6%)
</picture>

<picture face_3>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_3
/ vposition = v_position_3
/ size = (6%, 6%)
</picture>

<picture face_4>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_4
/ vposition = v_position_4
/ size = (6%, 6%)
</picture>

scrambled
************************************************

<picture scrambled_1>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_1
/ vposition = v_position_1
/ size = (6%, 6%)
</picture>

<picture scrambled_2>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_2
/ vposition = v_position_2
/ size = (6%, 6%)
</picture>

<picture scrambled_3>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_3
/ vposition = v_position_3
/ size = (6%, 6%)
</picture>

<picture scrambled_4>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_4
/ vposition = v_position_4
/ size = (6%, 6%)
</picture>

target
************************************************

<picture target_1>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_1
/ vposition = v_position_1
/ size = (6%, 6%)
</picture>

<picture target_2>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_2
/ vposition = v_position_2
/ size = (6%, 6%)
</picture>

<picture target_3>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_3
/ vposition = v_position_3
/ size = (6%, 6%)
</picture>

<picture target_4>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_4
/ vposition = v_position_4
/ size = (6%, 6%)
</picture>

**********************************************************************************

<shape blank>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
</shape>

<text cross>
/ items = ("+")
/ txcolor = white
/ fontstyle = ("Arial", 5%)
</text>


************************************************
Trials
************************************************
<trial ITI>
/ stimulusframes = [1 = cross]
/ trialduration = noreplace(0, 100, 200, 300)
/ validresponse = (0)
</trial>


<trial face_4>
/ stimulustimes = [0 = face_8trig, face_1, face_2, face_3, face_4;
                                                                  500 = blank, cross; 2000 = blank, cross]
/ beginresponsetime = 0
/ trialduration = 2000
/ responseinterrupt = trial
/ branch = [trial.ITI]
/ validresponse = (" ")
/ correctresponse = (noresponse)
/ responsemessage = (" ", responsetrig, 0)
/ ontrialbegin = [values.time_passed = expt.experiment.elapsedtime]
</trial>

<trial scrambled_4>
/ stimulustimes = [0 = scrambled_4trig, scrambled_1, scrambled_2, scrambled_3,
                                                                                  scrambled_4;
                                                                  500 = blank, cross; 2000 = blank, cross]
/ beginresponsetime = 0
/ trialduration = 2000
/ responseinterrupt = trial
/ branch = [trial.ITI]
/ validresponse = (" ")
/ correctresponse = (noresponse)

/ responsemessage = (" ", responsetrig, 0)
/ ontrialbegin = [values.time_passed = expt.experiment.elapsedtime]
</trial>


<trial target_4>
/ stimulustimes = [0 = target_4trig, target_1, target_2, target_3,
                                                                                  target_4;
                                                                  500 = blank, cross; 2000 = blank, cross]
/ beginresponsetime = 0
/ trialduration = 2000
/ responseinterrupt = trial
/ branch = [trial.ITI]
/ validresponse = (" ")
/ correctresponse = (" ")
/ responsemessage = (" ", responsetrig, 0)
/ ontrialbegin = [values.time_passed = expt.experiment.elapsedtime]
</trial>
************************************************
Block lists
************************************************
<list trials>
/ items = (trial.face_4, trial.scrambled_4, trial.target_4)
/ poolsize = 30
/ itemprobabilities = (.4, .4, .2)
</list>

************************************************
data file
************************************************
<data>
/ columns = (subject, blocknum, trialnum, blockcode, correct, date, values.time_passed,
trialcode, latency, trialduration)
/ separatefiles = true
</data>


************************************************
Blocks
************************************************

<block block1>
/ preinstructions = (instructions)
/ trials = [1-10 = list.trials]
</block>

<block block2>
/ preinstructions = (break1)
/ trials = [1-10 = list.trials]
</block>

<block block3>
/ preinstructions = (break2)
/ trials = [1-10 = list.trials]
</block>

<block end>
/ preinstructions = (end)
</block>


************************************************
Experiment conditions
************************************************
<expt experiment>
/ blocks = [1 = block1; 2 = block2; 3 = block3; 4 = end]
</expt>

************************************************
EEG triggers
************************************************
<port face_4trig>
/ port = LPT3
/ subport = data
/ items = (1)
/ erase = true("00000000")
</port>

<port scrambled_4trig>
/ port = LPT3
/ subport = data
/ items = (8)

<port target_4trig>
/ port = LPT3
/ subport = data
/ items = (15)
/ erase = true("00000000")
</port>

<port responsetrig>
/ port = LPT3
/ subport = data
/ items = (29)
/ erase = true("00000000")
</port>


Thanks for the code. There are a couple of areas where your code introduces additional frames.
(1) As I noted, your stimuli are all either implicitly or explicitly set to /erase = true, which will introduce a minimum of one additional display frame after each trial (this is true for the experimental trials as well as the ITI trial).
(2) Allowing for a zero duration for trial ITI will be misleading. Since that trial displays a stimulus, it cannot have a zero duration; it, too, will have a minimum duration of a single display frame.
(3) Your experimental trials are actually and subtly longer than 2000ms, because they are set to draw stimuli at 2000ms, i.e. they cannot actually terminate after 2000ms, the stimuli have to be drawn first, and only then will the trial end.

<trial face_4>
/ stimulustimes = [0 = blank, face_4trig, face_1, face_2, face_3, face_4;
                      500 = blank, cross; 2000= blank, cross]
...
</trial>

If you eliminate all these things, you should get much tighter timining. You may still experience some drift if your timings aren't exactly aligned with your display's refresh rate and Inquisit has to occasionally wait for the start of a refresh cycle to begin drawing stimuli as a consequence.


************************************************
defaults ----- output EEG(??)
************************************************
<defaults>
/ screencolor = black
/ txcolor = white
/ txbgcolor = black
/ fontstyle = ("Arial", 5.00%)
/ inputdevice = keyboard
/ validkeys = (" ")
/ halign = center
/ valign = center
/ canvassize=(100%, 100%)
/ canvasaspectratio = (1366, 1366)
/ lptaddresses = (LPT3=D050)
</defaults>

************************************************
instructions
************************************************

<instruct>
/ fontstyle = ("Arial", 3.00%)
/ inputdevice = keyboard
/ nextkey = (" ")
/ nextlabel = "Press the spacebar to continue"
</instruct>

<page instructions>
^^In this task you will see a varying number of images appear of either faces, scrambles or checkerboards.
^^Your task is to press space once as quickly and accurately as possible when you see images of checkerboards appear.
^^A fixation cross will appear in the middle of the screen, keep your eyes on this fixation cross.
^^When you are ready, press the spacebar to begin.
</page>

<page break1>
^Good! This is a break. Press the spacebar when you're ready to continue.
</page>

<page break2>
^Good! This is a break. Press the spacebar when you're ready to continue.
</page>

<page end>
This is the end of the experiment. Thank you for participating!
</page>


**********************
<values>
/ time_passed = expt.experiment.elapsedtime
/ timestamp = ""
</values>

**************************
counter elements for effective randomisation and
selection of face stimuli
************************************************

<counter face_selector>
/ select = noreplace(1-42)
/ selectionrate = always
</counter>

<item stimulus_faces>
/ 1 = "f01.bmp"
/ 2 = "f02.bmp"
/ 3 = "f03.bmp"
/ 4 = "f05.bmp"
/ 5 = "f06.bmp"
/ 6 = "f07.bmp"
/ 7 = "f08.bmp"
/ 8 = "f09.bmp"
/ 9 = "f10.bmp"
/ 10 = "f11.bmp"
/ 11 = "f12.bmp"
/ 12 = "f13.bmp"
/ 13 = "f14.bmp"
/ 14 = "f15.bmp"
/ 15 = "f16.bmp"
/ 16 = "f17.bmp"
/ 17 = "f18.bmp"
/ 18 = "f19.bmp"
/ 19 = "f20.bmp"
/ 20 = "f21.bmp"
/ 21 = "f22.bmp"
/ 22 = "f23.bmp"
/ 23 = "f24.bmp"
/ 24 = "f25.bmp"
/ 25 = "f26.bmp"
/ 26 = "f28.bmp"
/ 27 = "f29.bmp"
/ 28 = "f30.bmp"
/ 29 = "f31.bmp"
/ 30 = "f32.bmp"
/ 31 = "f33.bmp"
/ 32 = "f34.bmp"
/ 33 = "f35.bmp"
/ 34 = "f36.bmp"
/ 35 = "f37.bmp"
/ 36 = "f38.bmp"
/ 37 = "f39.bmp"
/ 38 = "f40.bmp"
/ 39 = "f41.bmp"
/ 40 = "f42.bmp"
/ 41 = "f43.bmp"
/ 42 = "f45.bmp"
</item>

<item stimulus_scrambled>
/ 1 = "s01.bmp"
/ 2 = "s02.bmp"
/ 3 = "s03.bmp"
/ 4 = "s05.bmp"
/ 5 = "s06.bmp"
/ 6 = "s07.bmp"
/ 7 = "s08.bmp"
/ 8 = "s09.bmp"
/ 9 = "s10.bmp"
/ 10 = "s11.bmp"
/ 11 = "s12.bmp"
/ 12 = "s13.bmp"
/ 13 = "s14.bmp"
/ 14 = "s15.bmp"
/ 15 = "s16.bmp"
/ 16 = "s17.bmp"
/ 17 = "s18.bmp"
/ 18 = "s19.bmp"
/ 19 = "s20.bmp"
/ 20 = "s21.bmp"
/ 21 = "s22.bmp"
/ 22 = "s23.bmp"
/ 23 = "s24.bmp"
/ 24 = "s25.bmp"
/ 25 = "s26.bmp"
/ 26 = "s28.bmp"
/ 27 = "s29.bmp"
/ 28 = "s30.bmp"
/ 29 = "s31.bmp"
/ 30 = "s32.bmp"
/ 31 = "s33.bmp"
/ 32 = "s34.bmp"
/ 33 = "s35.bmp"
/ 34 = "s36.bmp"
/ 35 = "s37.bmp"
/ 36 = "s38.bmp"
/ 37 = "s39.bmp"
/ 38 = "s40.bmp"
/ 39 = "s41.bmp"
/ 40 = "s42.bmp"
/ 41 = "s43.bmp"
/ 42 = "s45.bmp"
</item>

<item stimulus_target>
/ 1 = "target.bmp"
/ 2 = "target.bmp"
/ 3 = "target.bmp"
/ 4 = "target.bmp"
/ 5 = "target.bmp"
/ 6 = "target.bmp"
/ 7 = "target.bmp"
/ 8 = "target.bmp"
/ 9 = "target.bmp"
/ 10 = "target.bmp"
/ 11 = "target.bmp"
/ 12 = "target.bmp"
/ 13 = "target.bmp"
/ 14 = "target.bmp"
/ 15 = "target.bmp"
/ 16 = "target.bmp"
/ 17 = "target.bmp"
/ 18 = "target.bmp"
/ 19 = "target.bmp"
/ 20 = "target.bmp"
/ 21 = "target.bmp"
/ 22 = "target.bmp"
/ 23 = "target.bmp"
/ 24 = "target.bmp"
/ 25 = "target.bmp"
/ 26 = "target.bmp"
/ 27 = "target.bmp"
/ 28 = "target.bmp"
/ 29 = "target.bmp"
/ 30 = "target.bmp"
/ 31 = "target.bmp"
/ 32 = "target.bmp"
/ 33 = "target.bmp"
/ 34 = "target.bmp"
/ 35 = "target.bmp"
/ 36 = "target.bmp"
/ 37 = "target.bmp"
/ 38 = "target.bmp"
/ 39 = "target.bmp"
/ 40 = "target.bmp"
/ 41 = "target.bmp"
/ 42 = "target.bmp"
</item>

************************************************
stimuli position
************************************************

<list position_selector>
/ items = (1; 2; 3; 4)
/ replace = true
</list>

<list position_selector_2>
/ items = (1; 2; 3; 4; 5; 6;
    7; 8; 9; 10; 11; 12;
            13; 14; 15; 16; 17; 18;
            19; 20; 21; 22; 23; 24;
            25; 26; 27; 28; 29; 30;
            31; 32; 33; 34; 35; 36)
/ not = (list.position_selector.currentindex)
</list>

<list position_selector_3>
/ items = (1; 2; 3; 4; 5; 6;
    7; 8; 9; 10; 11; 12;
            13; 14; 15; 16; 17; 18;
            19; 20; 21; 22; 23; 24;
            25; 26; 27; 28; 29; 30;
            31; 32; 33; 34; 35; 36)
/ not = (list.position_selector.currentindex,
           list.position_selector_2.currentindex)
</list>

<list position_selector_4>
/ items = (1; 2; 3; 4; 5; 6;
    7; 8; 9; 10; 11; 12;
            13; 14; 15; 16; 17; 18;
            19; 20; 21; 22; 23; 24;
            25; 26; 27; 28; 29; 30;
            31; 32; 33; 34; 35; 36)
/ not = (list.position_selector.currentindex,
           list.position_selector_2.currentindex,
           list.position_selector_3.currentindex)
</list>

****************************
first order position lists
****************************

<list v_position_1>
/ items = [47%; 47%; 53%; 53%]
/ selectionmode = list.position_selector.nextindex
</list>

<list h_position_1>
/ items = [47%; 53%; 47%; 53%]
/ selectionmode = list.position_selector.nextindex
</list>

<list v_position_2>
/ items = [47%; 47%; 53%; 53%; 35%; 41%;
    47%; 53%; 59%; 65%; 35%; 41%;
    47%; 53%; 59%; 65%; 35%; 41%;
        59%; 65%; 35%; 41%; 59%; 65%;
        35%; 41%; 47%; 53%; 59%; 65%;
        35%; 41%; 47%; 53%; 59%; 65%]
/ selectionmode = list.position_selector_2.nextindex
</list>

<list h_position_2>
/ items = [47%; 53%; 47%; 53%; 35%; 35%;
            35%; 35%; 35%; 35%; 41%; 41%;
            41%; 41%; 41%; 41%; 47%; 47%;
            47%; 47%; 53%; 53%; 53%; 53%;
            59%; 59%; 59%; 59%; 59%; 59%;
            65%; 65%; 65%; 65%; 65%; 65%]
/ selectionmode = list.position_selector_2.nextindex
</list>

<list v_position_3>
/ items = [47%; 47%; 53%; 53%; 35%; 41%;
    47%; 53%; 59%; 65%; 35%; 41%;
    47%; 53%; 59%; 65%; 35%; 41%;
        59%; 65%; 35%; 41%; 59%; 65%;
        35%; 41%; 47%; 53%; 59%; 65%;
        35%; 41%; 47%; 53%; 59%; 65%]
/ selectionmode = list.position_selector_3.nextindex
</list>

<list h_position_3>
/ items = [47%; 53%; 47%; 53%; 35%; 35%;
            35%; 35%; 35%; 35%; 41%; 41%;
            41%; 41%; 41%; 41%; 47%; 47%;
            47%; 47%; 53%; 53%; 53%; 53%;
            59%; 59%; 59%; 59%; 59%; 59%;
            65%; 65%; 65%; 65%; 65%; 65%]
/ selectionmode = list.position_selector_3.nextindex
</list>


<list v_position_4>
/ items = [47%; 47%; 53%; 53%; 35%; 41%;
    47%; 53%; 59%; 65%; 35%; 41%;
    47%; 53%; 59%; 65%; 35%; 41%;
        59%; 65%; 35%; 41%; 59%; 65%;
        35%; 41%; 47%; 53%; 59%; 65%;
        35%; 41%; 47%; 53%; 59%; 65%]
/ selectionmode = list.position_selector_4.nextindex
</list>

<list h_position_4>
/ items = [47%; 53%; 47%; 53%; 35%; 35%;
            35%; 35%; 35%; 35%; 41%; 41%;
            41%; 41%; 41%; 41%; 47%; 47%;
            47%; 47%; 53%; 53%; 53%; 53%;
            59%; 59%; 59%; 59%; 59%; 59%;
            65%; 65%; 65%; 65%; 65%; 65%]
/ selectionmode = list.position_selector_4.nextindex
</list>
>>>>>>> stimulus-selection-solution:Materials/Task Inquisit/TaskMultiple_faces.iqx

************************************************
Text
************************************************



faces
************************************************

<picture face_1>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_1
/ vposition = v_position_1
/ size = (6%, 6%)
/ erase = false
</picture>

<picture face_2>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_2
/ vposition = v_position_2
/ size = (6%, 6%)
/ erase = false
</picture>

<picture face_3>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_3
/ vposition = v_position_3
/ size = (6%, 6%)
/ erase = false
</picture>

<picture face_4>
/ items = stimulus_faces
/ select = face_selector
/ hposition = h_position_4
/ vposition = v_position_4
/ size = (6%, 6%)
/ erase = false
</picture>

scrambled
************************************************

<picture scrambled_1>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_1
/ vposition = v_position_1
/ size = (6%, 6%)
/ erase = false
</picture>

<picture scrambled_2>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_2
/ vposition = v_position_2
/ size = (6%, 6%)
/ erase = false
</picture>

<picture scrambled_3>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_3
/ vposition = v_position_3
/ size = (6%, 6%)
/ erase = false
</picture>

<picture scrambled_4>
/ items = stimulus_scrambled
/ select = face_selector
/ hposition = h_position_4
/ vposition = v_position_4
/ size = (6%, 6%)
/ erase = false
</picture>

target
************************************************

<picture target_1>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_1
/ vposition = v_position_1
/ size = (6%, 6%)
/ erase = false
</picture>

<picture target_2>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_2
/ vposition = v_position_2
/ size = (6%, 6%)
/ erase = false
</picture>

<picture target_3>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_3
/ vposition = v_position_3
/ size = (6%, 6%)
/ erase = false
</picture>

<picture target_4>
/ items = stimulus_target
/ select = face_selector
/ hposition = h_position_4
/ vposition = v_position_4
/ size = (6%, 6%)
/ erase = false
</picture>

**********************************************************************************

<shape blank>
/ shape = rectangle
/ color = black
/ size = (100%, 100%)
/ erase = false
</shape>

<text cross>
/ items = ("+")
/ txcolor = white
/ fontstyle = ("Arial", 5%)
/ erase = false
</text>


************************************************
Trials
************************************************
<trial ITI>
/ stimulusframes = [1 = cross, allbitstolow]
/ trialduration = 100
/ validresponse = (0)
</trial>


<trial face_4>
/ stimulustimes = [0 = blank, face_4trig, face_1, face_2, face_3, face_4;
                      500 = blank, cross; 1950 = blank, cross]
/ beginresponsetime = 0
/ trialduration = 2000
/ responseinterrupt = trial
/ branch = [trial.ITI]
/ validresponse = (" ")
/ correctresponse = (noresponse)
/ responsemessage = (" ", responsetrig, 0)
/ ontrialbegin = [
values.timestamp = trial.face_4.timestamp;
]
/ ontrialbegin = [values.time_passed = expt.experiment.elapsedtime]
</trial>

<trial scrambled_4>
/ stimulustimes = [0 = blank, scrambled_4trig, scrambled_1, scrambled_2, scrambled_3,
                            scrambled_4;
                      500 = blank, cross; 1950 = blank, cross]
/ beginresponsetime = 0
/ trialduration = 2000
/ responseinterrupt = trial
/ branch = [trial.ITI]
/ validresponse = (" ")
/ correctresponse = (noresponse)

/ responsemessage = (" ", responsetrig, 0)
/ ontrialbegin = [
values.timestamp = trial.scrambled_4.timestamp;
]
/ ontrialbegin = [values.time_passed = expt.experiment.elapsedtime]
</trial>


<trial target_4>
/ stimulustimes = [0 = blank, target_4trig, target_1, target_2, target_3,
                            target_4;
                      500 = blank, cross; 1950 = blank, cross]
/ beginresponsetime = 0
/ trialduration = 2000
/ responseinterrupt = trial
/ branch = [trial.ITI]
/ validresponse = (" ")
/ correctresponse = (" ")
/ responsemessage = (" ", responsetrig, 0)
/ ontrialbegin = [
values.timestamp = trial.target_4.timestamp;
]
/ ontrialbegin = [values.time_passed = expt.experiment.elapsedtime]
</trial>
************************************************
Block lists
************************************************
<list trials>
/ items = (trial.face_4, trial.scrambled_4, trial.target_4)
/ poolsize = 30
/ itemprobabilities = (.4, .4, .2)
</list>

************************************************
data file
************************************************
<data>
/ columns = (subject, blocknum, trialnum, blockcode, correct, date, values.time_passed,
trialcode, latency, trialduration, values.timestamp)
/ separatefiles = true
</data>


************************************************
Blocks
************************************************

<block block1>
/ preinstructions = (instructions)
/ trials = [1-10 = list.trials]
</block>

<block block2>
/ preinstructions = (break1)
/ trials = [1-10 = list.trials]
</block>

<block block3>
/ preinstructions = (break2)
/ trials = [1-10 = list.trials]
</block>

<block end>
/ preinstructions = (end)
</block>


************************************************
Experiment conditions
************************************************
<expt experiment>
/ blocks = [1 = block1; 2 = block2; 3 = block3; 4 = end]
</expt>

************************************************
EEG triggers
************************************************
<port allbitstolow>
/ port = LPT3
/ subport = data
/ items = (0)
/ erase = false
</port>

<port face_4trig>
/ port = LPT3
/ subport = data
/ items = (1)
/ erase = false
</port>

<port scrambled_4trig>
/ port = LPT3
/ subport = data
/ items = (8)
</port>

<port target_4trig>
/ port = LPT3
/ subport = data
/ items = (15)
/ erase = false
</port>

<port responsetrig>
/ port = LPT3
/ subport = data
/ items = (29)
/ erase = false
</port>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
DO0812 - Wednesday, May 15, 2019
Hi Dave,

Thank you for the help. I’ve implemented all the recommendations that you made, which indeed resulted in much tighter timing. We also included a petrialpause and a postrialpause (each of 100ms) which eliminated all lagging: so for example, if values.time_passed = 2000 on Trial X, and Trial X’s duration is 2000, the value of  time_passed on Trial X+1 is 4000 (or maybe 4001), which is great.

However, when I ran the experiment with EEG triggers(/makers) I noticed a (inconstant) delay in trigger timing. So for some trials the trigger is send 16, 17 or 18ms later after the beginning of the trial (and other trials are accurate). Is there any way that I can overcome this issue?

I’ve attached a zip file again which includes the code and images used. I also included an Excel file with the timing output of inquisit, the timing output of the triggers (from a vmrk file), and the comparison and discrepancies in timing between inquisit and triggers. Thanks again for your help.

 All the best,
Danna


> So for some trials the trigger is send 16, 17 or 18ms later after the beginning of the trial (and other trials are accurate). Is there any way that I can overcome this issue?

No, I don't think so. If the given trial's stimulus presentation sequence, after the pretrialpause, doesn't *exactly* coincide with the start of a display refresh cycle, there is no way for Inquisit to start displaying stimuli. That is, Inquisit then has to wait for the beginning of the next refresh cycle, and you'll incur a short delay on the order of approximately the duration of a single display refresh cycle. The delays you pointed out, around 17ms, would be consistent with the duration of a refresh cycle on a display running at 50-60Hz. Would that match the refresh rate of the system in question?


DO0812
DO0812
Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)
Group: Forum Members
Posts: 3, Visits: 31
Hi Dave,

Yes, it probably has to do with the refresh rate of the computer (60Hz). However, I didn't expect this to occur as the pretrialpause and the postrialpause eliminated this same lag of around 17ms in Inquisit so that values.time_passed doesn't show a lag anymore (or a maximum lag of +1). So the problem isn't so much that there is a lag of around 17ms - but that there is a discrepancy between the lag in inquisit (max of +1) and the lag in triggers (around 17ms). In a way that it is unclear to me which output gives the accurate timing (inquisit or trigger output), or whether they both give an accurate timing in which case the triggers are send later than the actual onset time of the stimuli. I would like to see both timings (i.e. inquisit, trigger) to be the same.  

All the best, 
Danna
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
DO0812 - Wednesday, May 15, 2019
Hi Dave,

Yes, it probably has to do with the refresh rate of the computer (60Hz). However, I didn't expect this to occur as the pretrialpause and the postrialpause eliminated this same lag of around 17ms in Inquisit so that values.time_passed doesn't show a lag anymore (or a maximum lag of +1). So the problem isn't so much that there is a lag of around 17ms - but that there is a discrepancy between the lag in inquisit (max of +1) and the lag in triggers (around 17ms). In a way that it is unclear to me which output gives the accurate timing (inquisit or trigger output), or whether they both give an accurate timing in which case the triggers are send later than the actual onset time of the stimuli. I would like to see both timings (i.e. inquisit, trigger) to be the same.  

All the best, 
Danna

The time the <trial> object starts executing is one thing, and the time when that <trial> object *can* start displaying a given stimulus is another thing. The first isn't strictly tied to the start of a display refresh cycle, the latter one is, though. Both measurements you have should be accurate, they just measure two related, but still different things.

DO0812
DO0812
Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)Associate Member (241 reputation)
Group: Forum Members
Posts: 3, Visits: 31
That makes a lot of sense. 

Thank you for all the help!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search