How to store values that keep changing after every trial in data of a trial? #1520
Replies: 3 comments 1 reply
-
I am not sure if I understand the problem but do you have to change anything as function of previous trials or can you pretty much set everything up before? If the latter is the case, you can just create it in an array before:
|
Beta Was this translation helpful? Give feedback.
-
Just to be clear. You can have the contrast level different every trial with that but what would not work with my suggestion is changing it as a function of previous trails (e.g. performance). Hope you'll find your solution.
…On 17 February 2021 20:45:45 GMT, prashantig25 ***@***.***> wrote:
Hi @JAQuent
Thank you but I can't pre-define. The contrast level is supposed to be
different for every trial and it needs to change on every trial. I do
that using the on_start function. But I want to store that value in the
data for every trial. I hope that is clear.
Thanks.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#1520 (reply in thread)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Beta Was this translation helpful? Give feedback.
-
Hi @prashantig25, sorry for the delayed response. I'm not sure if this is still helpful, but I thought I'd reply anyway. data: function() {
return {condition: 'HH', state: '0', reward: '1', prob: '60_40', con: jsPsych.currentTrial().contrast};
} If that doesn't work, another way to do this is to use a global variable to store the current contrast value during the experiment. You would change the value of this variable in the var curr_contrast = null;
var s0_r1_high60 = {
type: 'canvas-keyboard-response',
on_start: function(s0_r1_high60){
s0_r1_high60.contrast = Math.random(); s0_r1_high60.contrast1 = jsPsych.currentTrial().contrast + randbet(0.05,0.35);
curr_contrast = s0_r1_high60.contrast;
},
stimulus: gabor,
data: function() {
return {condition: 'HH', state: '0', reward: '1', prob: '60_40', con: curr_contrast};
},
// etc.
}; Finally, are you using a modified version of the var s0_r1_high60 = {
type: 'canvas-keyboard-response',
on_start: function(s0_r1_high60){
s0_r1_high60.contrast = Math.random(); s0_r1_high60.contrast1 = jsPsych.currentTrial().contrast + randbet(0.05,0.35);
curr_contrast = s0_r1_high60.contrast;
},
stimulus: gabor,
data: function() {
return {condition: 'HH', state: '0', reward: '1', prob: '60_40'};
},
save_trial_parameters: {
contrast: true
},
// etc.
}; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear All,
I am trying to store data for each trial. In each trial, 2 gabor patches are displayed which have varying contrast levels. The contrast level changes after every trial through the on_start function. I want to store the contrast level for each trial in data. I am trying to do that by defining 'con' inside data and trying to store the value in it. But, when I run the experiment in Cognition.run, the column with 'con' is empty in the .csv file. Is there anyway I can fix it? Or is there any other way to store the contrast levels of each trial so that the data is stored for each trial? Here is part of the code:
Any help is appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions