Can we call specific items in lists / values ?


Author
Message
eleonora_parr
eleonora_parr
Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)
Group: Forum Members
Posts: 40, Visits: 148
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.
I had no idea!! Thank you so much Dave, I never thought that I could program this task, but with your help I've managed to improve and make it possible,
Thank you very much,

ele


eleonora_parr
eleonora_parr
Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)
Group: Forum Members
Posts: 40, Visits: 148
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



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: 98K
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



If there is a question here, it's not visible.
eleonora_parr
eleonora_parr
Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)
Group: Forum Members
Posts: 40, Visits: 148
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



Dear Dave,
I followed all your advices but I’ve kept doing the task on myself until I realized that there is something wrong with the program..
I ‘ve also attached here one of the log files so that you could observe as well the double problem that we have:
-    The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed
-    The conditional if statement is not working properly: even if the new variable is = or greater than 2, the program does not display the stop trial but instead it keeps repeating the same trial over and over again.
Do you have any idea of what is going on?
Thank you again Dave,

ele

Attachments
200.png (123 views, 37.00 KB)
210.png (116 views, 37.00 KB)
215.png (119 views, 37.00 KB)
220.png (120 views, 37.00 KB)
230.png (118 views, 37.00 KB)
230.png (110 views, 37.00 KB)
240.png (112 views, 37.00 KB)
245.png (123 views, 37.00 KB)
250.png (121 views, 37.00 KB)
255.png (114 views, 37.00 KB)
psicofisica_DEFINITIVA.iqx (126 views, 97.00 KB)
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: 98K
eleonora_parr - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



Dear Dave,
I followed all your advices but I’ve kept doing the task on myself until I realized that there is something wrong with the program..
I ‘ve also attached here one of the log files so that you could observe as well the double problem that we have:
-    The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed
-    The conditional if statement is not working properly: even if the new variable is = or greater than 2, the program does not display the stop trial but instead it keeps repeating the same trial over and over again.
Do you have any idea of what is going on?
Thank you again Dave,

ele

> -  The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed

/branch and /ontrialend are not the same thing and they are executed at different times. You want to handle the increase /ontrialend, not in /branch.

eleonora_parr
eleonora_parr
Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)
Group: Forum Members
Posts: 40, Visits: 148
Dave - 4/14/2021
eleonora_parr - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



Dear Dave,
I followed all your advices but I’ve kept doing the task on myself until I realized that there is something wrong with the program..
I ‘ve also attached here one of the log files so that you could observe as well the double problem that we have:
-    The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed
-    The conditional if statement is not working properly: even if the new variable is = or greater than 2, the program does not display the stop trial but instead it keeps repeating the same trial over and over again.
Do you have any idea of what is going on?
Thank you again Dave,

ele

> -  The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed

/branch and /ontrialend are not the same thing and they are executed at different times. You want to handle the increase /ontrialend, not in /branch.
I've changed
/branch = [
  if (values.hoping_variable >= 2) {trial.stop};
  if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
  else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
  else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

to

/ontrialend = [
if (values.hoping_variable >= 2) {trial.stop};
if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

and also to:
/branch =[if (values.hoping_variable >= 2) {trial.stop};]
/ontrialend = [
    
    if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
    else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
    else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

But as soon as I complete the first trial inquisit closes the experiment ..

ele


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: 98K
eleonora_parr - 4/14/2021
Dave - 4/14/2021
eleonora_parr - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



Dear Dave,
I followed all your advices but I’ve kept doing the task on myself until I realized that there is something wrong with the program..
I ‘ve also attached here one of the log files so that you could observe as well the double problem that we have:
-    The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed
-    The conditional if statement is not working properly: even if the new variable is = or greater than 2, the program does not display the stop trial but instead it keeps repeating the same trial over and over again.
Do you have any idea of what is going on?
Thank you again Dave,

ele

> -  The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed

/branch and /ontrialend are not the same thing and they are executed at different times. You want to handle the increase /ontrialend, not in /branch.
I've changed
/branch = [
  if (values.hoping_variable >= 2) {trial.stop};
  if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
  else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
  else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

to

/ontrialend = [
if (values.hoping_variable >= 2) {trial.stop};
if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

and also to:
/branch =[if (values.hoping_variable >= 2) {trial.stop};]
/ontrialend = [
    
    if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
    else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
    else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

But as soon as I complete the first trial inquisit closes the experiment ..

ele


You need *both* /ontrialend AND /branch. Update your variables /ontrialend. Invoke the approrpiate follow-up trial per /branch. You cannot invoke a trial via /ontrialend.
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: 98K
Dave - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/14/2021
eleonora_parr - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



Dear Dave,
I followed all your advices but I’ve kept doing the task on myself until I realized that there is something wrong with the program..
I ‘ve also attached here one of the log files so that you could observe as well the double problem that we have:
-    The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed
-    The conditional if statement is not working properly: even if the new variable is = or greater than 2, the program does not display the stop trial but instead it keeps repeating the same trial over and over again.
Do you have any idea of what is going on?
Thank you again Dave,

ele

> -  The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed

/branch and /ontrialend are not the same thing and they are executed at different times. You want to handle the increase /ontrialend, not in /branch.
I've changed
/branch = [
  if (values.hoping_variable >= 2) {trial.stop};
  if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
  else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
  else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

to

/ontrialend = [
if (values.hoping_variable >= 2) {trial.stop};
if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

and also to:
/branch =[if (values.hoping_variable >= 2) {trial.stop};]
/ontrialend = [
    
    if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
    else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
    else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

But as soon as I complete the first trial inquisit closes the experiment ..

ele


You need *both* /ontrialend AND /branch. Update your variables /ontrialend. Invoke the approrpiate follow-up trial per /branch. You cannot invoke a trial via /ontrialend.


Attachments
psicofisica_DEFINITIVA.iqx (147 views, 100.00 KB)
eleonora_parr
eleonora_parr
Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)Respected Member (490 reputation)
Group: Forum Members
Posts: 40, Visits: 148
Dave - 4/14/2021
Dave - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/14/2021
eleonora_parr - 4/14/2021
eleonora_parr - 4/14/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/9/2021
eleonora_parr - 4/9/2021
eleonora_parr - 4/9/2021
Dave - 4/8/2021
Dave - 4/8/2021
(1) Please do not paste entire scripts into a post's body. Instead attach the file(s).
(2) Whenever your script requires external files to run, provide those files along with the script.
(3) Be more specific with your questions, please. What exactly are you unsure how to do?

Side note: It's an absolutely terrible idea to implement each "level" as a separate trial if the only difference between levels is the color of the circle. Is there any reason why you chose to do so, that I'm not catching?

Further, the levels you describe here:

> Here I attached the code: for the sake of simplicity I just kept three levels, but keep in mind that the levels are nine
> (i.e. 255,255,255; 250,250,250; 245,245,245; 240,240,240; 230,230,230; 220,220,220; 215,215,215; 210,210,210; 200)

do not correspond to what's in the code. There's no circle at 230, no circle at 240, and then there are gradations not mentioned in the above (e.g. 225, 235, 245).

<picture circle_245>
/ items = ("245.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_235>
/ items = ("235.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>

<picture circle_225>
/ items = ("225.png")
/ position = (50%,50%)
/size=(30%, 30%)
</picture>


What's the deal with that?

Dear Dave,
Thank you very much for your reply and sorry for the inconvenient : I’ve uploaded all the files here. If there's any problem in downloading them I also shared it at this link: https://we.tl/t-a7ItMbx1jX
Sorry for being not very clear.
You’re completely right, this is probably a terrible idea, but I would not know how to shorten this code and avoid having different trials for each level of difficulty, I explain you why:
-    Each level/different RGB code has its own timing (stimulustimes) at which the circle is presented. Then, for each level, the frequency rate at which the circle is presented is calculated. According to the “current frequency”, construct_bucket builds different time ranges within which the response given by the subject is considered correct (i.e. if the frequency is < 69.76, then a response is considered correct if that fell in a range between -750 and 125 ms compared to the appearance of the circle… etc..). So, I would not know how unify trials that have
-different timings (onsets), different latencies and different frequencies (plus, the list.frequency is resetted at the beginning of each trial, which makes possible to update the values everytime a new trial with new timings/onsets is presented)
- I would not really need all these different construct_bucket and check_latencies, but I kept them because I want to save/store all these variables for each level:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25)
-I would not really need either all these different “score_result” – participants will not be provided with feedback, but I kept it as an inter trial interval.
Finally, what do I need to do next:
All these levels should not be presented sequentially as they are now. Instead, I would need to
-    Start from the medium level (230). Then, according to the subject’s performance, a different trial should be presented: the ratio of this psychophysics is to get a STABLE performance between 0.78 and 0.82 of accuracy
-    So, if the performance was too poor/low (below 0.78)  present a trial with an higher/brighter RGB code (i.e. make the task easier)
-    If the performance was too high (above 0.82)  present a trial with a lower RGB code (i.e. make the task harder)
-    If the performance fell in the correct range that we want (between 0.78 and 0.82), then repeat that trial with that level of RGB code that produced that ideal performance and check if the subject reached the same level of accuracy TWICE (a performance is considered stable if the subject get the same level/range of accuracy TWO CONSECUTIVE TIMES with the same level of RGB code)
So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)
I hope that this was clear enough, and thank you again very much for all your support, Dave!
Eleonora

Sorry, the last file was missing!


> So, the idea would be to increase/decrease the RGB code according to a poor/high performance respectively OR to repeat the same trial (same RGB code) if that performance was in our ideal range . When the subject get two consecutive close accuracies with the same RGB code which fell in the ideal range the psychophysics is over (i.e. we identified the specific level of RGB code with which the subject demonstrated to perform stably (two consecutive times) at a range of accuracy between 0.78 and 0.82).
The thing is that this “game“ should be played for the whole psychophysics. So for each level I ‘ d probably need a conditional statement which says something like “ if the previous performance was too low, display the easier level, if it was too high, display the harder level. Finally, if it was ideal (0.78-0.82) repeat this trial and check if the subject gets again the same result/accuracy. If the same trial is repeated and the subject gets a different performance (for example, he got used to the RGB code and the second time he gets a better performance which overcomes 0.82, then re-start to decrease the contrast and so on..)

Here's the thing I can't quite get my head around: If you understand your current code, you already know how to do all this. The current code contains all the necessary ingredients, it already does things like all of the above, make conditional decisions, /branch accordingly, etc.

Basically, I'm not sure what exactly I need to explain to you, and some general description does not tell me. I could certainly simply implement the changes, but I'd rather have you get to a point where you can do so yourself.

So again: What -- in terms of code -- is unclear to you regarding the above?
So for now I've got all the levels repeated just once (one trial per level/rgb code). As I explained, the same trial could be repeated more times, so that the values in the accuracy would be replaced by the new calculation. Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance. 
I imagined that the only way to implement a conditional statement that does what I described would be to have an additive list/values that append all the accuracies calculated in the experiment everytime, and then say to the code "if the previous and the current values/ accuracies are in my ideal range, then do that.. "
But to do so, I should be able to call the position of specific items in the list / values, because I'd need to specify that I want two consecutive (ideal) scores and that those scores should be associated to a unique level of contrast (always the same rgb code). I have no idea of how to implement that, also because for what I know, we can't call specific position of values/items in a list.. 
Thank you again, Dave. Hope that you can help me and open up my mind :crying: :crazy:

ele

> Moreover, I would not be able to know which trial would be displayed next - as also this depends by the subject's performance.

Of course you know which trial to run next. The score result trials tell you the result, so you can /branch accordingly.

You start with the 230 trial. When that gets to its score result, check the result:
- If performance is within the desired range, /branch to the 230 trial for its second run. Increase a new variable to count level success by one.
- If performance is too good, /branch to the 220 trial. Reset the new variable to 0.
- If performance is too bad, /branch to the 240 trial. Reset the new variable 0.

(Same thing in the other score result trials).

Have a /stop condition in the block that terminates it when the variable indicating level success reaches 2.


Yes, that is absolutely a great solution. The only problem that I see is that when repeating the same trial these values that I want to save will be erased by the new calculation:
values.sum_acc_latencies_255_1, (number of correct responses)
values.accuracy_255_1, (the single accuracy for that single level of difficulty)
values.timeofresponse_255_1, (all latencies – timing of each given response)
values.spacebarpresscount_255_1, (number of spacebar presses)
values.corrlat_255_1, (values – timing of each response that has been considered correct)
values.lat_69_255_1, (correct responses correspondent to a frequency<69.76)
values.lat_betw_255_1, (correct responses correspondent to a 69.76<frequency<94.25)
values.lat_94_255_1 , (correct responses correspondent to a frequency<94.25) 

Is that correct?
A potential solution could be to create a bunch of trial with the same rgb code (i.e. trial 255_1, 255_2, 255_3 etc.) but this would make the code huge, and also, I won't know in advance how many repeats there will be for the same trial.. Another solution would be to have another additional value that stores (concatenates) all these values again..  unless you have other solutions to suggest.. 

Ele

Each trial gets its own row in the raw data file, so nothing is erased.



Dear Dave,
I followed all your advices but I’ve kept doing the task on myself until I realized that there is something wrong with the program..
I ‘ve also attached here one of the log files so that you could observe as well the double problem that we have:
-    The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed
-    The conditional if statement is not working properly: even if the new variable is = or greater than 2, the program does not display the stop trial but instead it keeps repeating the same trial over and over again.
Do you have any idea of what is going on?
Thank you again Dave,

ele

> -  The new variable should increase by one within the trial score results, so this means that when the next trial begins (no matters which one it is) --- if the accuracy was in our correct range--- the new variable is already = 1. Instead, it seems like there is a delay in the increase – the variable starts to increase only when the next trial is displayed

/branch and /ontrialend are not the same thing and they are executed at different times. You want to handle the increase /ontrialend, not in /branch.
I've changed
/branch = [
  if (values.hoping_variable >= 2) {trial.stop};
  if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
  else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
  else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

to

/ontrialend = [
if (values.hoping_variable >= 2) {trial.stop};
if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

and also to:
/branch =[if (values.hoping_variable >= 2) {trial.stop};]
/ontrialend = [
    
    if (values.accuracy_200_1 > 0.691 && values.accuracy_200_1 < 0.957) {values.hoping_variable += 1 ; trial.200_1;}
    else if (values.accuracy_200_1 < 0.691) {values.hoping_variable = 0 ; trial.210_1;}
    else if (values.accuracy_200_1 > 0.957) {values.hoping_variable = 0 ; trial.200_1;};
]

But as soon as I complete the first trial inquisit closes the experiment ..

ele


You need *both* /ontrialend AND /branch. Update your variables /ontrialend. Invoke the approrpiate follow-up trial per /branch. You cannot invoke a trial via /ontrialend.


Oh thank you Dave!!!
I have been fighting with it for such a long time, I am so grateful to you, I don't know how to thank you!!

Ele
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search