Clock Task - Moving dot around clockwise in Inquisit


Author
Message
AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
Hello Inquisit Team:

Would it be possible to get a moving dot to go clockwise around a central stimulus in Inquisit?  The paradigm is called the clock task (https://www.jneurosci.org/content/28/47/12294).  The subject would stop the dot at a point during its motion and then receive feedback.

Thanks,
Andrew



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: 12K, Visits: 90K
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

One more thing, in case it isn't obvious:

The current trial's latency is available /ontrialend, so you can absolutely perform calculations based on that latency /ontrialend in <trial experiment> -- no need to have a separate <trial> for that. To display those results on-screen, however, you would require a separate trial, it can't be done via /responsemessage or the like in the running instance of <trial experiment>.


AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.
AndrewPapale
AndrewPapale
Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)Associate Member (81 reputation)
Group: Forum Members
Posts: 26, Visits: 101
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

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: 12K, Visits: 90K
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

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

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

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

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search