Stimulus onset by script.elapsedtime


Author
Message
yanyan
yanyan
Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)
Group: Forum Members
Posts: 12, Visits: 31
Dear all,

I have a question about the stimulus onset by using script.elapsedtime.

Here is my code for a block:
<block MS>
/trials = [1=focus;2-45=noreplace(neu12, neu16........)]
</block>

I got data like this:
blockcode trialnum trialcode  trialduration  script.elapsedtime
MS             1              focus         6000               43169
MS             2              neu16       12000              46392
MS             3              neu12        8000               58288
.....

I have set trialduration for each trial (e.g., 6000 for trial.focus).
<trial focus>
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

However, it is obvious that the script.elapsedtime was not consistent with trialduration (i.e.,46392-43162<6000).  This also happened to trial 2 (i.e. 58288-46392 !=12000). Why did this happen?
I need to record onset time of each trial. Can I trust the script.elapsedtime?

Best,
Yanyan




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: 104K
yanyan - Wednesday, July 12, 2017
Dear all,

I have a question about the stimulus onset by using script.elapsedtime.

Here is my code for a block:
<block MS>
/trials = [1=focus;2-45=noreplace(neu12, neu16........)]
</block>

I got data like this:
blockcode trialnum trialcode  trialduration  script.elapsedtime
MS             1              focus         6000               43169
MS             2              neu16       12000              46392
MS             3              neu12        8000               58288
.....

I have set trialduration for each trial (e.g., 6000 for trial.focus).
<trial focus>
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

However, it is obvious that the script.elapsedtime was not consistent with trialduration (i.e.,46392-43162<6000).  This also happened to trial 2 (i.e. 58288-46392 !=12000). Why did this happen?
I need to record onset time of each trial. Can I trust the script.elapsedtime?

Best,
Yanyan




You are not capturing the onset of each trial. The way have set this up, script.elapsedtime will be logged at the _end_ of each trial. If you wanted to capture elapsed time at the (approximate) time of trial onset, you would have to do something like

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

and log values.elapsedtimeattrialonset to the data file.

As for why the timings seem off, I cannot tell you why without seeing the actual code.  However, when running this

<trial neu16>
/stimulustimes = [0=focus]
/trialduration = 12000
/validresponse = (noresponse)
</trial>

<trial neu12>
/stimulustimes = [0=focus]
/trialduration = 8000
/validresponse = (noresponse)
</trial>

<block ms>
/ trials = [1=sequence(focus, neu16, neu12)]
</block>

<data>
/ columns = [blockcode trialnum trialcode trialduration script.elapsedtime]
</data>

<text focus>
/ items = ("<%script.currenttrial%>")
/ erase = false
</text>

which mimicks what you posted in terms of durations, the timings work out fine for me:

https://www.millisecond.com/forums/Uploads/Images/7f77c80a-65d3-44ba-917b-20b1.png

yanyan
yanyan
Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)
Group: Forum Members
Posts: 12, Visits: 31
Dave - Wednesday, July 12, 2017
yanyan - Wednesday, July 12, 2017
Dear all,

I have a question about the stimulus onset by using script.elapsedtime.

Here is my code for a block:
<block MS>
/trials = [1=focus;2-45=noreplace(neu12, neu16........)]
</block>

I got data like this:
blockcode trialnum trialcode  trialduration  script.elapsedtime
MS             1              focus         6000               43169
MS             2              neu16       12000              46392
MS             3              neu12        8000               58288
.....

I have set trialduration for each trial (e.g., 6000 for trial.focus).
<trial focus>
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

However, it is obvious that the script.elapsedtime was not consistent with trialduration (i.e.,46392-43162<6000).  This also happened to trial 2 (i.e. 58288-46392 !=12000). Why did this happen?
I need to record onset time of each trial. Can I trust the script.elapsedtime?

Best,
Yanyan




You are not capturing the onset of each trial. The way have set this up, script.elapsedtime will be logged at the _end_ of each trial. If you wanted to capture elapsed time at the (approximate) time of trial onset, you would have to do something like

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

and log values.elapsedtimeattrialonset to the data file.

As for why the timings seem off, I cannot tell you why without seeing the actual code.  However, when running this

<trial neu16>
/stimulustimes = [0=focus]
/trialduration = 12000
/validresponse = (noresponse)
</trial>

<trial neu12>
/stimulustimes = [0=focus]
/trialduration = 8000
/validresponse = (noresponse)
</trial>

<block ms>
/ trials = [1=sequence(focus, neu16, neu12)]
</block>

<data>
/ columns = [blockcode trialnum trialcode trialduration script.elapsedtime]
</data>

<text focus>
/ items = ("<%script.currenttrial%>")
/ erase = false
</text>

which mimicks what you posted in terms of durations, the timings work out fine for me:

https://www.millisecond.com/forums/Uploads/Images/7f77c80a-65d3-44ba-917b-20b1.png

Many thanks, Dave.

As you said, the script.elapsedtime logged at each end of a trial.Then it should also be the onset of next trial, because I didn't set any interval between trials, right?

It was weird that when I ran the same program, the script.elapsedtime of the 1st trial (i.e. focus) were different, sometimes near 6000, sometimes > or <. 6000.

My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration (e.g., onset_ms1=0, onset_ms2=6000, onset_ms3=18000). I was doing like this, however, when I found the script.elapsedtime was not consistent with trialduration, I am unsure.

Cheers,
Yan
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: 104K
yanyan - Thursday, July 13, 2017
Dave - Wednesday, July 12, 2017
yanyan - Wednesday, July 12, 2017
Dear all,

I have a question about the stimulus onset by using script.elapsedtime.

Here is my code for a block:
<block MS>
/trials = [1=focus;2-45=noreplace(neu12, neu16........)]
</block>

I got data like this:
blockcode trialnum trialcode  trialduration  script.elapsedtime
MS             1              focus         6000               43169
MS             2              neu16       12000              46392
MS             3              neu12        8000               58288
.....

I have set trialduration for each trial (e.g., 6000 for trial.focus).
<trial focus>
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

However, it is obvious that the script.elapsedtime was not consistent with trialduration (i.e.,46392-43162<6000).  This also happened to trial 2 (i.e. 58288-46392 !=12000). Why did this happen?
I need to record onset time of each trial. Can I trust the script.elapsedtime?

Best,
Yanyan




You are not capturing the onset of each trial. The way have set this up, script.elapsedtime will be logged at the _end_ of each trial. If you wanted to capture elapsed time at the (approximate) time of trial onset, you would have to do something like

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

and log values.elapsedtimeattrialonset to the data file.

As for why the timings seem off, I cannot tell you why without seeing the actual code.  However, when running this

<trial neu16>
/stimulustimes = [0=focus]
/trialduration = 12000
/validresponse = (noresponse)
</trial>

<trial neu12>
/stimulustimes = [0=focus]
/trialduration = 8000
/validresponse = (noresponse)
</trial>

<block ms>
/ trials = [1=sequence(focus, neu16, neu12)]
</block>

<data>
/ columns = [blockcode trialnum trialcode trialduration script.elapsedtime]
</data>

<text focus>
/ items = ("<%script.currenttrial%>")
/ erase = false
</text>

which mimicks what you posted in terms of durations, the timings work out fine for me:

https://www.millisecond.com/forums/Uploads/Images/7f77c80a-65d3-44ba-917b-20b1.png

Many thanks, Dave.

As you said, the script.elapsedtime logged at each end of a trial.Then it should also be the onset of next trial, because I didn't set any interval between trials, right?

It was weird that when I ran the same program, the script.elapsedtime of the 1st trial (i.e. focus) were different, sometimes near 6000, sometimes > or <. 6000.

My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration (e.g., onset_ms1=0, onset_ms2=6000, onset_ms3=18000). I was doing like this, however, when I found the script.elapsedtime was not consistent with trialduration, I am unsure.

Cheers,
Yan

> My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration
> (e.g., onset_ms1=0, onset_ms2=6000, > onset_ms3=18000.

You can approximate things like that, but there'll be some wiggle room. I don't know why timings appear off when you log script.elapsedtime and infer the durations from that -- as I said, I would need more info here. Questions:
#1: Do you get the same problem, i.e. script.elapsedtime showing timings that seem "off", when running the simple example code I provided at the end of my previous reply?
#2: Do you see the same problem when you log the onset as described at the beginning of my previous reply?

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>
yanyan
yanyan
Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)Partner Member (990 reputation)
Group: Forum Members
Posts: 12, Visits: 31
Dave - Thursday, July 13, 2017
yanyan - Thursday, July 13, 2017
Dave - Wednesday, July 12, 2017
yanyan - Wednesday, July 12, 2017
Dear all,

I have a question about the stimulus onset by using script.elapsedtime.

Here is my code for a block:
<block MS>
/trials = [1=focus;2-45=noreplace(neu12, neu16........)]
</block>

I got data like this:
blockcode trialnum trialcode  trialduration  script.elapsedtime
MS             1              focus         6000               43169
MS             2              neu16       12000              46392
MS             3              neu12        8000               58288
.....

I have set trialduration for each trial (e.g., 6000 for trial.focus).
<trial focus>
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

However, it is obvious that the script.elapsedtime was not consistent with trialduration (i.e.,46392-43162<6000).  This also happened to trial 2 (i.e. 58288-46392 !=12000). Why did this happen?
I need to record onset time of each trial. Can I trust the script.elapsedtime?

Best,
Yanyan




You are not capturing the onset of each trial. The way have set this up, script.elapsedtime will be logged at the _end_ of each trial. If you wanted to capture elapsed time at the (approximate) time of trial onset, you would have to do something like

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

and log values.elapsedtimeattrialonset to the data file.

As for why the timings seem off, I cannot tell you why without seeing the actual code.  However, when running this

<trial neu16>
/stimulustimes = [0=focus]
/trialduration = 12000
/validresponse = (noresponse)
</trial>

<trial neu12>
/stimulustimes = [0=focus]
/trialduration = 8000
/validresponse = (noresponse)
</trial>

<block ms>
/ trials = [1=sequence(focus, neu16, neu12)]
</block>

<data>
/ columns = [blockcode trialnum trialcode trialduration script.elapsedtime]
</data>

<text focus>
/ items = ("<%script.currenttrial%>")
/ erase = false
</text>

which mimicks what you posted in terms of durations, the timings work out fine for me:

https://www.millisecond.com/forums/Uploads/Images/7f77c80a-65d3-44ba-917b-20b1.png

Many thanks, Dave.

As you said, the script.elapsedtime logged at each end of a trial.Then it should also be the onset of next trial, because I didn't set any interval between trials, right?

It was weird that when I ran the same program, the script.elapsedtime of the 1st trial (i.e. focus) were different, sometimes near 6000, sometimes > or <. 6000.

My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration (e.g., onset_ms1=0, onset_ms2=6000, onset_ms3=18000). I was doing like this, however, when I found the script.elapsedtime was not consistent with trialduration, I am unsure.

Cheers,
Yan

> My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration
> (e.g., onset_ms1=0, onset_ms2=6000, > onset_ms3=18000.

You can approximate things like that, but there'll be some wiggle room. I don't know why timings appear off when you log script.elapsedtime and infer the durations from that -- as I said, I would need more info here. Questions:
#1: Do you get the same problem, i.e. script.elapsedtime showing timings that seem "off", when running the simple example code I provided at the end of my previous reply?
#2: Do you see the same problem when you log the onset as described at the beginning of my previous reply?

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

Thank you, Dave.

> My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration
> You can approximate things like that, but there'll be some wiggle room. 
Why there'll be some wiggle room? Where does it come from? Does it mean the timing (e.g., trialduration) of inquisit is not accurate? 
Btw, my text of focus is picture.

> #1 & #2
I have run the code you provided, and got following data. 
 
I am confused. There seems to be a 52 ms delay of onset of each trial? Also, why our script.elapsedtime differ?

Best,
Yan 
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: 104K
yanyan - Friday, July 14, 2017
Dave - Thursday, July 13, 2017
yanyan - Thursday, July 13, 2017
Dave - Wednesday, July 12, 2017
yanyan - Wednesday, July 12, 2017
Dear all,

I have a question about the stimulus onset by using script.elapsedtime.

Here is my code for a block:
<block MS>
/trials = [1=focus;2-45=noreplace(neu12, neu16........)]
</block>

I got data like this:
blockcode trialnum trialcode  trialduration  script.elapsedtime
MS             1              focus         6000               43169
MS             2              neu16       12000              46392
MS             3              neu12        8000               58288
.....

I have set trialduration for each trial (e.g., 6000 for trial.focus).
<trial focus>
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

However, it is obvious that the script.elapsedtime was not consistent with trialduration (i.e.,46392-43162<6000).  This also happened to trial 2 (i.e. 58288-46392 !=12000). Why did this happen?
I need to record onset time of each trial. Can I trust the script.elapsedtime?

Best,
Yanyan




You are not capturing the onset of each trial. The way have set this up, script.elapsedtime will be logged at the _end_ of each trial. If you wanted to capture elapsed time at the (approximate) time of trial onset, you would have to do something like

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

and log values.elapsedtimeattrialonset to the data file.

As for why the timings seem off, I cannot tell you why without seeing the actual code.  However, when running this

<trial neu16>
/stimulustimes = [0=focus]
/trialduration = 12000
/validresponse = (noresponse)
</trial>

<trial neu12>
/stimulustimes = [0=focus]
/trialduration = 8000
/validresponse = (noresponse)
</trial>

<block ms>
/ trials = [1=sequence(focus, neu16, neu12)]
</block>

<data>
/ columns = [blockcode trialnum trialcode trialduration script.elapsedtime]
</data>

<text focus>
/ items = ("<%script.currenttrial%>")
/ erase = false
</text>

which mimicks what you posted in terms of durations, the timings work out fine for me:

https://www.millisecond.com/forums/Uploads/Images/7f77c80a-65d3-44ba-917b-20b1.png

Many thanks, Dave.

As you said, the script.elapsedtime logged at each end of a trial.Then it should also be the onset of next trial, because I didn't set any interval between trials, right?

It was weird that when I ran the same program, the script.elapsedtime of the 1st trial (i.e. focus) were different, sometimes near 6000, sometimes > or <. 6000.

My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration (e.g., onset_ms1=0, onset_ms2=6000, onset_ms3=18000). I was doing like this, however, when I found the script.elapsedtime was not consistent with trialduration, I am unsure.

Cheers,
Yan

> My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration
> (e.g., onset_ms1=0, onset_ms2=6000, > onset_ms3=18000.

You can approximate things like that, but there'll be some wiggle room. I don't know why timings appear off when you log script.elapsedtime and infer the durations from that -- as I said, I would need more info here. Questions:
#1: Do you get the same problem, i.e. script.elapsedtime showing timings that seem "off", when running the simple example code I provided at the end of my previous reply?
#2: Do you see the same problem when you log the onset as described at the beginning of my previous reply?

<values>
/ elapsedtimeattrialonset = 0
...
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

Thank you, Dave.

> My question is that since I have set  trialduration of each trial, can I compute the onset time of each trial  based on the trialduration
> You can approximate things like that, but there'll be some wiggle room. 
Why there'll be some wiggle room? Where does it come from? Does it mean the timing (e.g., trialduration) of inquisit is not accurate? 
Btw, my text of focus is picture.

> #1 & #2
I have run the code you provided, and got following data. 
 
I am confused. There seems to be a 52 ms delay of onset of each trial? Also, why our script.elapsedtime differ?

Best,
Yan 

> Why there'll be some wiggle room?

When trial A ends per its /trialduration, that does not mean that the next trial can immediately start. Stuff from trial A has to be de-allocated from memory, stuff trial B is supposed to do has to be prepared, and Inquisit has to wait for the start of the next display refresh cycle before trial B can actually begin displaying anything on-screen.

> There seems to be a 52 ms delay of onset of each trial?

No. You have forgotten to update values.elapsedtimeattrialonset at the start of <trial neu16> and <trial neu12>. The code needs to read

<values>
/ elapsedtimeattrialonset = 0
</values>

<trial focus>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 6000
/validresponse = (noresponse)
</trial>

<trial neu16>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 12000
/validresponse = (noresponse)
</trial>

<trial neu12>
/ ontrialbegin = [values.elapsedtimeattrialonset = script.elapsedtime]
/stimulustimes = [0=focus]
/trialduration = 8000
/validresponse = (noresponse)
</trial>

<block ms>
/ trials = [1=sequence(focus, neu16, neu12)]
</block>

<data>
/ columns = [blockcode trialnum trialcode trialduration script.elapsedtime values.elapsedtimeattrialonset]
</data>

<text focus>
/ items = ("<%script.currenttrial%>")
/ erase = false
</text>

for that to work.

> Also, why our script.elapsedtime differ?

Because every computer is slightly different. Different displays with different refresh cycles, faster vs slower memory, faster vs slower processor, plus whatever else is going on on the system at any given point in time (more vs less other applications running in the background and taking up resources etc.).


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search