How to specify a variable trial duration


Author
Message
thomas.biba
thomas.biba
Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)
Group: Forum Members
Posts: 9, Visits: 37
Whoops I noticed there is an error in the code that works [section B]. It should be (the only change is adding parameters.respDur to total trial time computation):

<trial testT_1>
/ ontrialbegin = [
  trial.testT_1.resetstimulusframes();
  trial.testT_1.insertstimulustime(text.cue, parameters.start);
  values.SOA = round(rand(200, 1100));
  trial.testT_1.insertstimulustime(picture.ObjectsP_t1, parameters.cueDur + values.SOA);
  trial.testT_1.insertstimulustime(shape.blank, parameters.cueDur + values.SOA + parameters.targDur);
  values.ITI = parameters.respDur + round(rand(1200, 1800));
]
/ stimulustimes = [0=clearscreen]
/ beginresponsetime = parameters.cueDur + values.SOA + parameters.targDur
/ trialduration = parameters.cueDur + values.SOA + parameters.targDur + parameters.respDur + values.ITI
/ validresponse = (anyresponse)
</trial>
thomas.biba
thomas.biba
Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)
Group: Forum Members
Posts: 9, Visits: 37
Hi David, 

Thanks this is very helpful! However, while close, this is not exactly what I am looking to do (see my code at the end [section B] for how I implemented what was outlined in that previous thread). One additional thing I am hoping to do is to pseudo-randomize the SOA interval (and ITI), and also have a certain number of trials for each SOA bin in discrete SOA time bins (one bin every two frames.. e.g. 200, 233.33, 266.66 ...1100 etc..). It doesn't seem this level of control is possible within Inquisit so I was thinking of preparing list elements that contain all the SOA values for subsequent trials that I want and inputing that in on a trial-wise basis. I tried to implement this below [section A], and while it doesn't crash, the total trial times it produces seem to be off (I presume this might have to do with incorrectly resetting the stimulus frames at the beginning of the trial?). I am wondering how to resolve this. 

Many thanks, 

Thomas

[section A] ------------------------ additional step I am looking to implement ----------------------

<list SOA>
/ items = (200, 1100, 200, 1100)
</list>

<list ITI>
/ items = (1200, 1800, 1200, 1800)
</list>

<trial testT_1>
/ ontrialbegin = [
    trial.testT_1.resetstimulusframes();
    trial.testT_1.insertstimulustime(text.cue, parameters.start);
    trial.testT_1.insertstimulustime(picture.ObjectsP_t1, parameters.cueDur + list.SOA.nextvalue);
    trial.testT_1.insertstimulustime(shape.blank, parameters.cueDur + list.SOA.nextvalue + parameters.targDur);
]
/ stimulustimes = [0=clearscreen]
/ beginresponsetime = parameters.cueDur + list.SOA.nextvalue + parameters.targDur
/ trialduration = parameters.cueDur + list.SOA.nextvalue + parameters.targDur + parameters.respDur + list.ITI.nextvalue
/ validresponse = (anyresponse)
</trial>

[section B] ----------------------- code that runs (fully randomizing SOA and ITI) ---------------------

<parameters>
/ start = 0
/ cueDur = 200
/ targDur = 500
/ respDur = 2000
</parameters>

<values>
/ SOA = -1
/ ITI = -1
</values>

<trial testT_1>
/ ontrialbegin = [
    trial.testT_1.resetstimulusframes();
    trial.testT_1.insertstimulustime(text.cue, parameters.start);
    values.SOA = round(rand(200, 1100));
    trial.testT_1.insertstimulustime(picture.ObjectsP_t1, parameters.cueDur + values.SOA);
    trial.testT_1.insertstimulustime(shape.blank, parameters.cueDur + values.SOA + parameters.targDur);
    values.ITI = parameters.respDur + round(rand(1200, 1800));
]
/ stimulustimes = [0=clearscreen]
/ beginresponsetime = parameters.cueDur + values.SOA + parameters.targDur
/ trialduration = parameters.cueDur + values.SOA + parameters.targDur + values.ITI
/ validresponse = (anyresponse)
</trial>

<block TestB_1>
/ trials = [1-4 = sequence(testT_1)]
/ errormessage = false
</block>

<expt>
/ blocks = [1=TestB_1]
</expt>
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: 108K
thomas.biba - 11/24/2020
Greetings, 

I am looking to create a task (assuming a 60 Hz refresh rate) that A) presents a cue for 13 frames (200 ms), then B) implements a variable SOA from 13 - 67 frames (200 - 1100 ms), then C) presents a target for 31 frames (500 ms), then D) allows for a response for 124 frames (2000 ms), and E) a variable ITI of 78 - 117 frames (1200-1800 ms). I was able to get A,B, and C, yet I am struggling to implement D and E. My code implementing those steps is below (note that this code ends the trial once a response is make which is not what I am looking for). Any suggestions on how to implement D and E? 

Many thanks, 

Thomas

<item Objects_t1>
/1 = "8ball.jpg"
/2 = "50dollarbill.jpg"
/3 = "accordion01.jpg"
/4 = "aceofdiamond.jpg"
</item>

<picture ObjectsP_t1>
/ items = ObjectsI_t1
/ select = sequence
/ size = (550, 550)
/ position = (50%, 45%)
/ erase = false
</picture>

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

<shape blank>
/ color = (175, 175, 175)
/ shape = rectangle
/ size = (2000, 1000)
</shape>

<defaults>
/ screencolor = (175, 175, 175)
/ fontstyle = ("arial")
</defaults>

<list SOAduration>
/ items = (26, 67, 26, 67)
</list>

<list StimEnd>
/ items = (57, 98, 57, 98)
</list>

<trial testT_1>
/ ontrialbegin = [trial.testT_1.insertstimulusframe(picture.ObjectsP_t1, list.SOAduration.nextvalue);
      trial.testT_1.insertstimulusframe(shape.blank, list.StimEnd.nextvalue);]
/ ontrialend = [trial.mytrial.resetstimulusframes()]
/ stimulusframes = [1=cue; 13=blank]
/ validresponse = (anyresponse)
</trial>

<block TestB_1>
/ trials = [1-4 = sequence(testT_1)]
/ errormessage = false
</block>

<expt>
/ blocks = [1=TestB_1]
</expt>

See this recent thread:

https://www.millisecond.com/forums/Topic30232.aspx
thomas.biba
thomas.biba
Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)Associate Member (120 reputation)
Group: Forum Members
Posts: 9, Visits: 37
Greetings, 

I am looking to create a task (assuming a 60 Hz refresh rate) that A) presents a cue for 13 frames (200 ms), then B) implements a variable SOA from 13 - 67 frames (200 - 1100 ms), then C) presents a target for 31 frames (500 ms), then D) allows for a response for 124 frames (2000 ms), and E) a variable ITI of 78 - 117 frames (1200-1800 ms). I was able to get A,B, and C, yet I am struggling to implement D and E. My code implementing those steps is below (note that this code ends the trial once a response is make which is not what I am looking for). Any suggestions on how to implement D and E? 

Many thanks, 

Thomas

<item Objects_t1>
/1 = "8ball.jpg"
/2 = "50dollarbill.jpg"
/3 = "accordion01.jpg"
/4 = "aceofdiamond.jpg"
</item>

<picture ObjectsP_t1>
/ items = ObjectsI_t1
/ select = sequence
/ size = (550, 550)
/ position = (50%, 45%)
/ erase = false
</picture>

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

<shape blank>
/ color = (175, 175, 175)
/ shape = rectangle
/ size = (2000, 1000)
</shape>

<defaults>
/ screencolor = (175, 175, 175)
/ fontstyle = ("arial")
</defaults>

<list SOAduration>
/ items = (26, 67, 26, 67)
</list>

<list StimEnd>
/ items = (57, 98, 57, 98)
</list>

<trial testT_1>
/ ontrialbegin = [trial.testT_1.insertstimulusframe(picture.ObjectsP_t1, list.SOAduration.nextvalue);
      trial.testT_1.insertstimulusframe(shape.blank, list.StimEnd.nextvalue);]
/ ontrialend = [trial.mytrial.resetstimulusframes()]
/ stimulusframes = [1=cue; 13=blank]
/ validresponse = (anyresponse)
</trial>

<block TestB_1>
/ trials = [1-4 = sequence(testT_1)]
/ errormessage = false
</block>

<expt>
/ blocks = [1=TestB_1]
</expt>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search