nakayama


Group: Forum Members
Posts: 64,
Visits: 374

Hi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance



Dave


Group: Administrators
Posts: 9.9K,
Visits: 49K

+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data>



nakayama


Group: Forum Members
Posts: 64,
Visits: 374

+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you



Dave


Group: Administrators
Posts: 9.9K,
Visits: 49K

+x+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you That's just simple math and conditional logic; you can do this in any number of ways. <block example> / trials = [190 = exampletrial] </block> <values> / trialcounter = 0 </values> <list latencies_1st_30> </list> <list latencies_2nd_30> </list> <list latencies_3rd_30> </list> <trial exampletrial> / pretrialpause = 500 / ontrialbegin = [ values.trialcounter += 1; ] / stimulusframes = [1=exampletext] / validresponse = (57) / ontrialend = [ if (values.trialcounter <= 30) { list.latencies_1st_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 30 && values.trialcounter <= 60) { list.latencies_2nd_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 60 && values.trialcounter <= 90) { list.latencies_3rd_30.appenditem(trial.exampletrial.latency); }; ] </trial> <text exampletext> / items = ("Press SPACE as quickly as possible") </text> <summarydata> / columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean) / separatefiles = true </summarydata>



nakayama


Group: Forum Members
Posts: 64,
Visits: 374

+x+x+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you That's just simple math and conditional logic; you can do this in any number of ways. <block example> / trials = [190 = exampletrial] </block> <values> / trialcounter = 0 </values> <list latencies_1st_30> </list> <list latencies_2nd_30> </list> <list latencies_3rd_30> </list> <trial exampletrial> / pretrialpause = 500 / ontrialbegin = [ values.trialcounter += 1; ] / stimulusframes = [1=exampletext] / validresponse = (57) / ontrialend = [ if (values.trialcounter <= 30) { list.latencies_1st_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 30 && values.trialcounter <= 60) { list.latencies_2nd_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 60 && values.trialcounter <= 90) { list.latencies_3rd_30.appenditem(trial.exampletrial.latency); }; ] </trial> <text exampletext> / items = ("Press SPACE as quickly as possible") </text> <summarydata> / columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean) / separatefiles = true </summarydata> Hi, Dave thank you for the syntax, that's quite helpful I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like: / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}] But the data value turned out with blank. Is there a way to fix it? Best



Dave


Group: Administrators
Posts: 9.9K,
Visits: 49K

+x+x+x+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you That's just simple math and conditional logic; you can do this in any number of ways. <block example> / trials = [190 = exampletrial] </block> <values> / trialcounter = 0 </values> <list latencies_1st_30> </list> <list latencies_2nd_30> </list> <list latencies_3rd_30> </list> <trial exampletrial> / pretrialpause = 500 / ontrialbegin = [ values.trialcounter += 1; ] / stimulusframes = [1=exampletext] / validresponse = (57) / ontrialend = [ if (values.trialcounter <= 30) { list.latencies_1st_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 30 && values.trialcounter <= 60) { list.latencies_2nd_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 60 && values.trialcounter <= 90) { list.latencies_3rd_30.appenditem(trial.exampletrial.latency); }; ] </trial> <text exampletext> / items = ("Press SPACE as quickly as possible") </text> <summarydata> / columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean) / separatefiles = true </summarydata> Hi, Dave thank you for the syntax, that's quite helpful I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like: / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}] But the data value turned out with blank. Is there a way to fix it? Best / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30 _mean}] is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is list.listname .meanwhere listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply:



nakayama


Group: Forum Members
Posts: 64,
Visits: 374

+x+x+x+x+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you That's just simple math and conditional logic; you can do this in any number of ways. <block example> / trials = [190 = exampletrial] </block> <values> / trialcounter = 0 </values> <list latencies_1st_30> </list> <list latencies_2nd_30> </list> <list latencies_3rd_30> </list> <trial exampletrial> / pretrialpause = 500 / ontrialbegin = [ values.trialcounter += 1; ] / stimulusframes = [1=exampletext] / validresponse = (57) / ontrialend = [ if (values.trialcounter <= 30) { list.latencies_1st_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 30 && values.trialcounter <= 60) { list.latencies_2nd_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 60 && values.trialcounter <= 90) { list.latencies_3rd_30.appenditem(trial.exampletrial.latency); }; ] </trial> <text exampletext> / items = ("Press SPACE as quickly as possible") </text> <summarydata> / columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean) / separatefiles = true </summarydata> Hi, Dave thank you for the syntax, that's quite helpful I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like: / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}] But the data value turned out with blank. Is there a way to fix it? Best / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30 _mean}] is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is list.listname .meanwhere listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply: oh, I see .thank you for your clarification



nakayama


Group: Forum Members
Posts: 64,
Visits: 374

+x+x+x+x+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you That's just simple math and conditional logic; you can do this in any number of ways. <block example> / trials = [190 = exampletrial] </block> <values> / trialcounter = 0 </values> <list latencies_1st_30> </list> <list latencies_2nd_30> </list> <list latencies_3rd_30> </list> <trial exampletrial> / pretrialpause = 500 / ontrialbegin = [ values.trialcounter += 1; ] / stimulusframes = [1=exampletext] / validresponse = (57) / ontrialend = [ if (values.trialcounter <= 30) { list.latencies_1st_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 30 && values.trialcounter <= 60) { list.latencies_2nd_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 60 && values.trialcounter <= 90) { list.latencies_3rd_30.appenditem(trial.exampletrial.latency); }; ] </trial> <text exampletext> / items = ("Press SPACE as quickly as possible") </text> <summarydata> / columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean) / separatefiles = true </summarydata> Hi, Dave thank you for the syntax, that's quite helpful I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like: / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}] But the data value turned out with blank. Is there a way to fix it? Best / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30 _mean}] is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is list.listname .meanwhere listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply: Hi, Dave I have another question regarding the mean calculation. I calculated values.latencyplus at ontrialend and wish to also calculate the mean of "values.latencyplus" at the same time. however, the first "list.latencies_1st_30.mean" returned with 0, resulting in the calculated 30th list.latencies_1st_30.mean taking 0 in. is there a way to avoid this? Thank you for your attention i attached the data as well as the script below.



Dave


Group: Administrators
Posts: 9.9K,
Visits: 49K

+x+x+x+x+x+x+xHi Inquisit Community, I am looking for s syntax to store the reponse.latency from the (previous) n1 trial and compare it (for example, to calculate the latency difference between the n1 trial and the n trial) with the latency of current trial. Is there a way to do this? Thank you in advance <values> / previouslatency = 1 / currentlatency = 1 </values> <trial sound> / ontrialbegin = [ values.previouslatency = trial.sound.latency; ] / ontrialend = [ values.currentlatency = trial.sound.latency; ] / ontrialbegin = [trial.sound.resetstimulusframes()] / stimulustimes = [0=screen, tone; 50=circleshape;2000=tone] / inputdevice = mouse / validresponse = (circleshape) / beginresponsetime = 50 / responseinterrupt = frames / branch = [trial.release] </trial> <data> / columns = (date time subject group blocknum blockcode trialnum trialcode response correct latency values.currentlatency values.previouslatency) </data> thank you for your advice. may I add one more question down here? is there a syntax to calculate the mean (average) of response.latency every , say, 30 trials? thank you That's just simple math and conditional logic; you can do this in any number of ways. <block example> / trials = [190 = exampletrial] </block> <values> / trialcounter = 0 </values> <list latencies_1st_30> </list> <list latencies_2nd_30> </list> <list latencies_3rd_30> </list> <trial exampletrial> / pretrialpause = 500 / ontrialbegin = [ values.trialcounter += 1; ] / stimulusframes = [1=exampletext] / validresponse = (57) / ontrialend = [ if (values.trialcounter <= 30) { list.latencies_1st_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 30 && values.trialcounter <= 60) { list.latencies_2nd_30.appenditem(trial.exampletrial.latency); } else if (values.trialcounter > 60 && values.trialcounter <= 90) { list.latencies_3rd_30.appenditem(trial.exampletrial.latency); }; ] </trial> <text exampletext> / items = ("Press SPACE as quickly as possible") </text> <summarydata> / columns = (script.startdate script.starttime script.subjectid script.groupid list.latencies_1st_30.mean list.latencies_2nd_30.mean list.latencies_3rd_30.mean) / separatefiles = true </summarydata> Hi, Dave thank you for the syntax, that's quite helpful I wish to use the calculated list.latencies_1st_30.mean for further calculation in the trial. Like: / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30_mean}] But the data value turned out with blank. Is there a way to fix it? Best / ontrialbegin = [if (values.trialcounter > 30 && values.trialcounter <= 60){values.mean_x=1px*list.latencies_1st_30 _mean}] is clearly wrong. There is no list called "latencies_1st_30_mean". The syntax to access a list's mean property is list.listname .meanwhere listname is the name of the given <list> element, exactly as exemplified in the code in my previous reply: Hi, Dave I have another question regarding the mean calculation. I calculated values.latencyplus at ontrialend and wish to also calculate the mean of "values.latencyplus" at the same time. however, the first "list.latencies_1st_30.mean" returned with 0, resulting in the calculated 30th list.latencies_1st_30.mean taking 0 in. is there a way to avoid this? Thank you for your attention i attached the data as well as the script below. /ontrialend statements are e xecuted in the order given, top to bottom:<trial exampletrial> ... / ontrialend = [ if (values.trialcounter <= 30) {list.latencies_1st_30.appenditem(values.latencyplus);} else if (values.trialcounter > 30 && values.trialcounter <= 60) {list.latencies_2nd_30.appenditem(values.latencyplus);} else if (values.trialcounter > 60 && values.trialcounter <= 90) {list.latencies_3rd_30.appenditem(values.latencyplus);}; ] / ontrialend = [values.latencyplus=trial.exampletrial.latency+200 ] </trial> That is, you first add the value of values.larencyplus to the list, and only then actually calculate the value. You obviously need to do the exact opposite. <trial exampletrial> ... / ontrialend = [values.latencyplus=trial.exampletrial.latency+200 ] / ontrialend = [ if (values.trialcounter <= 30) {list.latencies_1st_30.appenditem(values.latencyplus);} else if (values.trialcounter > 30 && values.trialcounter <= 60) {list.latencies_2nd_30.appenditem(values.latencyplus);} else if (values.trialcounter > 60 && values.trialcounter <= 90) {list.latencies_3rd_30.appenditem(values.latencyplus);}; ] </trial>



nakayama


Group: Forum Members
Posts: 64,
Visits: 374

Thank you Dave! I didn’t realized ontrialend have orders too


