+xYes I have.
I attached them to this post.
Thank you.
In essence, the problem is this: The skip times are generated by calculating the average interval between skip events (values.avg_event_interval; that works out to ~56 seconds in your case), constructing an interval around the average (+/- values.max_event_offset; the offset works out to ~50 seconds in your case), and then selecting a random value from within that interval.
With the specific parameter values you have chosen, these intervals overlap substantially. I.e. it is possible for the time generated for the 2nd skip event to end up being before the time generated for the 1st skip event. (Another perhaps desirable, perhaps undesirable for your purposes consequence of this interval overlap is that you may end up with skip events that are relatively close in time to each other.)
Two possible fixes for this:
(1) Make the allowable interval smaller, such that intervals cannot overlap. For example, if you want to allow the average +/- 10 seconds, you could do
<trial GenerateSkipTimes>
/ ontrialbegin = [
if ( values.current_event_num <= parameters.total_skip_events )
values.skip_time = values.blockstarttime +
(values.avg_event_interval*values.current_event_num +
rand(-10000, 10000))
else
values.skip_time = values.blockendtime;
list.SkipEvent_Time.insertitem(values.skip_time, values.current_event_num);
values.current_event_num += 1;
]
...
</trial>
(2) If you're okay with the large interval overlap and some consecutive skip events potentially falling close together in time (a few seconds apart), then you can leave everything as-is and simply sort the skipevent list in ascending order after the generation of the event times:
<trial GenerateSkipTimes>
/ ontrialbegin = [
if ( values.current_event_num <= parameters.total_skip_events )
values.skip_time = values.blockstarttime +
(values.avg_event_interval*values.current_event_num + rand(-1*values.max_event_offset, values.max_event_offset))
else
values.skip_time = values.blockendtime;
list.SkipEvent_Time.insertitem(values.skip_time, values.current_event_num);
values.current_event_num += 1;
]
/ response = noresponse
/ recorddata = true
/ branch = [
if (values.current_event_num <= parameters.total_skip_events + 1) {
return trial.GenerateSkipTimes;
} else {
return trial.sortskiplist; }
]
</trial>
<trial sortskiplist>
/ ontrialbegin = [
list.SkipEvent_Time.sort(true, false);
]
/ trialduration = 0
/ validresponse = (0)
/ recorddata = false
</trial>