[solved] Is it possible to go back while running an experiment?
Hi Sebastiaan, I am running an fMRI experiment where the timing of the stimuli have to be synched with the scanner. However, if a participants needs a break in the middle of a run, the only way to synch back again is by restarting the experiment completely. Is there a way to go back to the beginning of a block without having to restart?
Thanks
Comments
Hi Frank,
A good point, which I hadn't really considered.
There's no straight-forward way to do this, but it can be done with clever use of inline scripting and some conditional statements. I'm away from office at the moment, but when I get back I'll whip together a demo experiment to show what I mean.
Regards,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Frank,
Sorry for the delay! I attached a demo experiment that shows how to skip the first couple of blocks. Hopefully you'll be able to apply the general idea to your own experiment. Please note that this only makes sense if the order of the blocks is fixed!
http://files.cogsci.nl/software/opensesame/examples/misc/skip_demo.opensesame
I also filed a feature request, since this is probably a useful feature for many users.
Regards,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
I hadn't picked up on this for a while...
I tried a simple thing like this:
if self.get('response') == (my_response):
self.experiment.set('count_Trial_sequence', (number for first trial of block))
However, since this is done during the run phase it doesn't seem to affect the trial ordering that was created during the prepare phase.
Do you have any insights?
Hi Frank,
If you want to reset the counter of an item, please see this discussion: http://forum.cogsci.nl/index.php?p=/discussion/147/solved-resetting-counters
But I'm guessing that this is not actually what you want to do? Are you still trying to skip the first couple of blocks? If so, you might like to know that an option to skip the first X cycles had been added to the loop as of OpenSesame 0.26.
Please let me know if this doesn't answer your question.
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
your suggestion kind of did the trick and I could reset the trial number to the first trial of the block. However what I really want is to start the block sequence from the begining.
What I did was:
if self.get('response') == '9':
self.experiment.items['Trial_sequence'].count = block_index * 57
which corresponds to the first trial of a block, since each block has 57 trials. However, I want to start with the instruction screen for the block but I am not sure what counter corresponds to this screen.
I tried
self.experiment.items['block_sequence'].count = 0
but it didn't work...
Ok... I finally got your skip suggestion. I think it is the simpler way to solve the problem but it doesn't quite work for my code because I randomly generate the order of conditions inside the script so if I restart the experiment and skip blocks the program will generate a new set of conditions.
best
Right, changing the counter doesn't affect the actual trial progression, only the counter itself. So that might be convenient if you want the counter to start at 0 with each new block (for example to facilitate analysis) but you cannot use the counter to skip trials etc.
If I understand correctly you want to be able to resume an experiment, but the trial progression is randomly generated for each experimental session? In that case, you would have to save the conditions to a file, and read them from disk when you want to resume the experiment later on. I don't see any other way, although it might become a bit messy. The pickle module might come in handy though: http://docs.python.org/library/pickle.html
Check out SigmundAI.eu for our OpenSesame AI assistant!
So why did
self.experiment.items['Trial_sequence'].count = block_index * 57
did the work of bringing me back to the first trial of the block, but I can't go back to the instructions of that block? My question is how come I can go to the first trial on my trial sequence but I can't go back to the first sketchpad of the block_sequence?
If changing the trial sequence has an effect in your experiment, that must be because of the custom structure that you use to set the loop variables. Does this involve an inline_script that uses the counter?
There is no very simple way to break out of a loop, although suggestions have been offered to improve this. But if I understand your question correctly, it is very similar to the one discussed here: http://forum.cogsci.nl/index.php?p=/discussion/149/open-breaking-from-a-staircase-loop
In that post there is a piece of inline code that shows how you can repeat an item (a trial_sequence, for example) until some criterion is satisfied. That might do, or be a starting point for, what you want to do. If not, perhaps you can describe exactly how your experiment works at the moment and exactly what you want to do.
Cheers!
Check out SigmundAI.eu for our OpenSesame AI assistant!