Randomisation of target onset and resetstimulusframes() problems


Author
Message
Matilda Cederblad
Matilda Cederblad
New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)
Group: Forum Members
Posts: 2, Visits: 22
Hi all,

I’ve run into a problem with my script and would be grateful for some advice. I’ve included the relevant code at the bottom of this post.
I use Inquisit 6.
The experiment I’m building has the following trial structure:
A target is shown at a random time [800-1200 ms after the trial begins]. A mask comes on 100ms after the target onset. There is only one target and mask presentation per trial.
I’ve run into some problems that I think are connected.

1)    If I don’t use the “resetstimulusframes()” function the target and mask are drawn several times in one trial. This only happens in later trials (i.e., never in trial 1) and it seems like the previous target + mask onsets are stored and reused in the values.target_onset variable

2)    If I implement the “resetstimulusframes()” function the target + mask are only displayed once per trial but they seem to be displayed at the same time in each trial, thus breaking the onset randomisation. I can’t see for certain when they are displayed because another problem is that the data is deleted (specifically the stimulusnumber, stimulusitem, stimulusonset) and replaced with zeros which doesn’t happen when I delete the “resetstimulusframes()” function from the script.

I can add the intended display time variable into the <data> code directly, but I want to be able to cross reference the intended onset with the timestamp for the actual target onset (which would be in one of the stimulusonset columns) in the raw data so this unfortunately doesn’t solve that problem.

I’ve tried a number of things including:
-Varying the fixation duration instead of the target onset time (essentially the same thing as below in the script but approached from a different angle)
-I’ve tried to select the onset times with lists, expressions, and parameter+list for randomising the target onset. All had the same problem.
-I’ve tried resetting the “values.target_onset” variable to zero at the end of each trial to ‘empty’ it but this didn’t work.
-I tried to include a counter and I’ve also tried to use the trial number to index in the list of randomised starting times (this works in other programming languages) but this didn’t work.
Here is a schematic example of what I mean:
values.target_onset = list.TargetOnset.nextvalue;  values.target_onset = list.TargetOnset[trialnum];
-Erasing the target and mask after they’ve been displayed did not work either. They were still drawn several times in a trial.
-Drawing a blank screen after the mask is finished has not stopped the target and mask from appearing multiple times in a trial.


To summarise:
I need to randomise the onset of a visual target followed by a mask (the temporal relationship between these currently work like they should).
I need to record the timestamp for the target onset in the raw data (in stimulusnumber, stimulusitem, stimulusonset).
I need to prevent the target from appearing several times in one trial (only one target per trial). At the moment old target onsets seem to be stored and re-used.

Code:
<list TargetOnset>
/items = [round(rand(800, 1200))]
/ selectionrate = trial
/selectionmode = random
/poolsize = 90
</list>

<values>
/target_onset = 0;
</values>

/<data>
/columns = [build, date, time, group, subject,
trialcode, trialnum, blockcode, blocknum,
response, responsetext, latency,
values.target_onset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset]
</data> //added extra columns of stimulusnumber/item/onset to see if there weren’t enough columns for the data but that didn’t seem to be the problem

<trial rtTarget1Mask2>
/ ontrialbegin = [
values.target_onset = list.TargetOnset.nextvalue;

trial.rtTarget1Mask2.insertstimulustime(picture.target1, values.target_onset);
trial.rtTarget1Mask2.insertstimulustime(picture.mask2, values.target_onset+100);
]

/ stimulustimes = [1= fixation]
/ inputdevice = keyboard

/ ontrialend = [
//trial.rtTarget1Mask2.resetstimulusframes(); // currently commented out
//values.target_onset = 0;  //attempt to reset target onset didn’t work
]

</trial>



I would appreciate any help with this,
Matilda

Dave
Dave
Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)Supreme Being (929K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
Matilda Cederblad - 4/20/2021
Hi all,

I’ve run into a problem with my script and would be grateful for some advice. I’ve included the relevant code at the bottom of this post.
I use Inquisit 6.
The experiment I’m building has the following trial structure:
A target is shown at a random time [800-1200 ms after the trial begins]. A mask comes on 100ms after the target onset. There is only one target and mask presentation per trial.
I’ve run into some problems that I think are connected.

1)    If I don’t use the “resetstimulusframes()” function the target and mask are drawn several times in one trial. This only happens in later trials (i.e., never in trial 1) and it seems like the previous target + mask onsets are stored and reused in the values.target_onset variable

2)    If I implement the “resetstimulusframes()” function the target + mask are only displayed once per trial but they seem to be displayed at the same time in each trial, thus breaking the onset randomisation. I can’t see for certain when they are displayed because another problem is that the data is deleted (specifically the stimulusnumber, stimulusitem, stimulusonset) and replaced with zeros which doesn’t happen when I delete the “resetstimulusframes()” function from the script.

I can add the intended display time variable into the <data> code directly, but I want to be able to cross reference the intended onset with the timestamp for the actual target onset (which would be in one of the stimulusonset columns) in the raw data so this unfortunately doesn’t solve that problem.

I’ve tried a number of things including:
-Varying the fixation duration instead of the target onset time (essentially the same thing as below in the script but approached from a different angle)
-I’ve tried to select the onset times with lists, expressions, and parameter+list for randomising the target onset. All had the same problem.
-I’ve tried resetting the “values.target_onset” variable to zero at the end of each trial to ‘empty’ it but this didn’t work.
-I tried to include a counter and I’ve also tried to use the trial number to index in the list of randomised starting times (this works in other programming languages) but this didn’t work.
Here is a schematic example of what I mean:
values.target_onset = list.TargetOnset.nextvalue;  values.target_onset = list.TargetOnset[trialnum];
-Erasing the target and mask after they’ve been displayed did not work either. They were still drawn several times in a trial.
-Drawing a blank screen after the mask is finished has not stopped the target and mask from appearing multiple times in a trial.


To summarise:
I need to randomise the onset of a visual target followed by a mask (the temporal relationship between these currently work like they should).
I need to record the timestamp for the target onset in the raw data (in stimulusnumber, stimulusitem, stimulusonset).
I need to prevent the target from appearing several times in one trial (only one target per trial). At the moment old target onsets seem to be stored and re-used.

Code:
<list TargetOnset>
/items = [round(rand(800, 1200))]
/ selectionrate = trial
/selectionmode = random
/poolsize = 90
</list>

<values>
/target_onset = 0;
</values>

/<data>
/columns = [build, date, time, group, subject,
trialcode, trialnum, blockcode, blocknum,
response, responsetext, latency,
values.target_onset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset]
</data> //added extra columns of stimulusnumber/item/onset to see if there weren’t enough columns for the data but that didn’t seem to be the problem

<trial rtTarget1Mask2>
/ ontrialbegin = [
values.target_onset = list.TargetOnset.nextvalue;

trial.rtTarget1Mask2.insertstimulustime(picture.target1, values.target_onset);
trial.rtTarget1Mask2.insertstimulustime(picture.mask2, values.target_onset+100);
]

/ stimulustimes = [1= fixation]
/ inputdevice = keyboard

/ ontrialend = [
//trial.rtTarget1Mask2.resetstimulusframes(); // currently commented out
//values.target_onset = 0;  //attempt to reset target onset didn’t work
]

</trial>



I would appreciate any help with this,
Matilda

> 1)  If I don’t use the “resetstimulusframes()” function the target and mask are drawn several times in one trial. This only happens in later trials (i.e., never in trial 1) and it seems like the previous target + mask onsets are stored and reused in the values.target_onset variable.

This is the intended behavior. If you do not reset a trial's stimulusframes, all changes made via insertstimulustime() will persist, i.e. the trial will permanently display the stimuli you inserted in any future instances of the trial.

> 2)  If I implement the “resetstimulusframes()” function the target + mask are only displayed once per trial but they seem to be displayed at the same time in each trial, thus breaking the onset randomisation. I can’t see for certain when they are displayed because another problem is that the data is deleted (specifically the stimulusnumber, stimulusitem, stimulusonset) and replaced with zeros which doesn’t happen when I delete the “resetstimulusframes()” function from the script.

You ought to call resetstimulusframes() first thing /ontrialbegin.

Example code:
<list TargetOnset>
/items = [round(rand(800, 1200))]
/ selectionrate = trial
/selectionmode = random
/poolsize = 90
</list>

<values>
/target_onset = 0;
</values>

/<data>
/columns = [build, date, time, group, subject,
trialcode, trialnum, blockcode, blocknum,
response, responsetext, latency,
values.target_onset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset,
stimulusnumber, stimulusitem, stimulusonset, stimulusnumber, stimulusitem, stimulusonset]
</data> //added extra columns of stimulusnumber/item/onset to see if there weren’t enough columns for the data but that didn’t seem to be the problem

<trial rtTarget1Mask2>
/ ontrialbegin = [
trial.rtTarget1Mask2.resetstimulusframes();
values.target_onset = list.TargetOnset.nextvalue;

trial.rtTarget1Mask2.insertstimulustime(text.target1, values.target_onset);
trial.rtTarget1Mask2.insertstimulustime(text.mask2, values.target_onset+100);
]

/ stimulustimes = [1= fixation]
/ inputdevice = keyboard
/ validresponse = (57)
</trial>

<text fixation>
/ items = ("+")
</text>

<text target1>
/ items = ("target")
</text>

<text mask2>
/ items = ("mask")
</text>

<block example>
/ trials = [1-4 = rtTarget1Mask2]
</block>


Example data generated with that code attached. The onsets vary just like they are supposed to.
Attachments
Matilda Cederblad
Matilda Cederblad
New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)New Member (7 reputation)
Group: Forum Members
Posts: 2, Visits: 22
Thank you so much for your help and quick response. Moving the resetstimulusframes() to the beginning of the trial solved the problem. Thanks again!
Matilda

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search