How to set stimulus times after a stimuli after a stimuli with a random presentation length + having...


Author
Message
Lewis99
Lewis99
Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)
Group: Forum Members
Posts: 9, Visits: 73
Hi everyone,
I'm trying to have a trial that goes like this:
Fixation cross jittering between 2100-2900ms, then text with an emotion regulation strategy (distraction or reappraisal) is presented for 2000ms, a blank screen jittering between 400-800ms and finally an image is presented for 3000ms.

I have figured out so far (i think) how to get my fixation cross to have a random presentation time, but what I am unsure of is how to present stimuli after that. If I don't know when the fixation cross will end, how do I know what time to write in /stimulustimes in my trial. See my code below:

<trial regulationone>
/ontrialbegin = [
    values.fixationrand = rand(2100, 2900);
    trial.regulationone.insertstimulustime(text.fixation, values.fixationrand):
    ]
/ stimulustimes = [0=fixation]
/ ontrialend = [
trial.priming.resetstimulusframes(); ]
</trial>

For example, i don't think I can have "/ stimulustimes = [0=fixation; 2900=strategy]" as then there may be a gap between the cross disappearing and the stimuli popping up.

My second question, is how do I then include other stimuli that jitter (e.g., the blank screen) later in this trial as I assume I can't use the same line of code that follows the /ontrailbegin?
Thanks for your help,
Lewis


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: 13K, Visits: 103K
Lewis99 - 12/10/2023
Hi everyone,
I'm trying to have a trial that goes like this:
Fixation cross jittering between 2100-2900ms, then text with an emotion regulation strategy (distraction or reappraisal) is presented for 2000ms, a blank screen jittering between 400-800ms and finally an image is presented for 3000ms.

I have figured out so far (i think) how to get my fixation cross to have a random presentation time, but what I am unsure of is how to present stimuli after that. If I don't know when the fixation cross will end, how do I know what time to write in /stimulustimes in my trial. See my code below:

<trial regulationone>
/ontrialbegin = [
    values.fixationrand = rand(2100, 2900);
    trial.regulationone.insertstimulustime(text.fixation, values.fixationrand):
    ]
/ stimulustimes = [0=fixation]
/ ontrialend = [
trial.priming.resetstimulusframes(); ]
</trial>

For example, i don't think I can have "/ stimulustimes = [0=fixation; 2900=strategy]" as then there may be a gap between the cross disappearing and the stimuli popping up.

My second question, is how do I then include other stimuli that jitter (e.g., the blank screen) later in this trial as I assume I can't use the same line of code that follows the /ontrailbegin?
Thanks for your help,
Lewis


You display your fixation cross at t0. Calculate its on-screen duration (the jitter) /ontrialbegin and store it in a variable. That gives you the onset time for the next stimulus (emotion regulation strategy), so you use the insertstimulustime() function to put it at that time. That stimulus has an on-screen duration of 2000, which gives you the onset of the next stimulus (blank screen), so you again use insertstimulustime() to put it there. Calculate the blank jitter, and that gives you the onset for the final stimulus, the image. That stimulus has an on-screen duration of 3000, so you blank the screen after that, again using insertstimulustime().

<values>
/ fixationduration = 0
/ blankduration = 0
</values>

<trial exampletrial>
/ ontrialbegin = [
    trial.exampletrial.resetstimulusframes(); // reset stimulus presentation sequence to its original state
    values.fixationduration = round(rand(2100, 2900)); // random fixation on-screen duration
    values.blankduration = round(rand(400, 800)); // random blank duration
    // clear the screen after fixation period and display emo reg stimulus at that time
    trial.exampletrial.insertstimulustime(clearscreen, values.fixationduration);
    trial.exampletrial.insertstimulustime(text.emoreg, values.fixationduration);
    // clear the screen 2000 ms after emo reg
    trial.exampletrial.insertstimulustime(clearscreen, values.fixationduration + 2000);
    // display image after random blank period
    trial.exampletrial.insertstimulusframe(picture.image, values.fixationduration + 2000 + values.blankduration);
    // clear screen after 3000 ms image duration
    trial.exampletrial.insertstimulustime(clearscreen, values.fixationduration + 2000 + values.blankduration + 3000);
]
/ stimulustimes = [0=fixation;]
...
</trial>


Edited 10 Months Ago by Dave
Lewis99
Lewis99
Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)
Group: Forum Members
Posts: 9, Visits: 73

That worked fantastic thank you for your help Dave!
Lewis99
Lewis99
Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)
Group: Forum Members
Posts: 9, Visits: 73

Sorry Dave, just wanted to check, you wrote "Resetstimulusframes" instead of "Resetstimulustimes" at the start there. Is it meant to be frame or times there as all the others are times.
Thanks again,
Lewis

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: 13K, Visits: 103K
Lewis99 - 12/12/2023

Sorry Dave, just wanted to check, you wrote "Resetstimulusframes" instead of "Resetstimulustimes" at the start there. Is it meant to be frame or times there as all the others are times.
Thanks again,
Lewis

/stimulustimes just map onto /stimulusframes, because displays work at a discrete refresh interval  (e.g. 20ms for a display running at 50Hz, 10ms for a display running at 100Hz; one single such refresh interval is a display frame). When you specify timings in /stimulustimes, Inquisit picks the display frame that falls closest to the specified time, given the display's refresh interval. There is no separate resetstimulustimes() function -- there is only resetstimulusframes(), which is all that is needed.

Edited 10 Months Ago by Dave
Lewis99
Lewis99
Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)Associate Member (96 reputation)
Group: Forum Members
Posts: 9, Visits: 73

Awesome thanks for clarifying Dave :)

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search