esi-neuroscience / ARCADE

ARCADE is a modular suite of Applications for Real-time Control of subject Actions and stimulus Diplay for behavioral Experiments.
GNU General Public License v3.0
3 stars 4 forks source link

consider reset state runNumber when max run number is reached #13

Open yfcc opened 4 years ago

yfcc commented 4 years ago

https://github.com/esi-neuroscience/ARCADE/blob/b609bdf123cc3d17ba38f7885c5d49455ddda625/arcade/Core/State.m#L113-L114

Currently runNumber will no be reset in any case. A reset method would be helpful if the next state after max run number is some state before the current state. In this case the counter should be reset to zero.

Certainly a bit dangerous because it could results in infinite loop

joschaschmiedt commented 4 years ago

The obj.runNumber counter is reset for every trial, but indeed not within trial. Do you have a working example where that would be necessary, risking that you run into an infinite loop?

Implementing such a feature is not so difficult, but as a safeguard I'd want to provide an interactive cancel functionality with it.

yfcc commented 4 years ago

The obj.runNumber counter is reset for every trial, but indeed not within trial. Do you have a working example where that would be necessary, risking that you run into an infinite loop?

The senerio i wanted to do this: at the start of a given trial show Klecks a image to relax and then after the freee viewing for 10 seconds do drift correction, and after that in the same trial to acquire fixation three times so taht i can validate the corrected gaze position. The flow would look like this:

pictureOn -> acqFix -> holdFix -> reward -> acqFix -> holdFix -> reward -> acqFix -> holdFix ->reward->ITI

In practice, because acqFix may fail and i usually give the monkeys 3 chances. So it may look like this:

acqFix -> tempStateWhenAcqFixFailed -> acqFix -> holdFix

In this case after the first reward i need to reset the counter for the acqFix state.

(i have implemented it in a different way so it is not particular important for this case)