Saving incomplete runs
I have the following lines at the end of my expyriment script in order to declare the variables I'd like to save, and save the updated data file at the end of each trial:
Add data to file
experiment.data.add([block.name, trial.get_factor("correctresponse"), key, trial.id, rt, acc, trial.get_factor("trialtype")]) experiment.data.save()
However, although this works perfectly when I complete the run, when I exit the run early it does not appear to be saving the data on a trial-by-trial basis.
I'm running my script in a clinical sample where some people may have to exit the run early, and I would not like to completely lose their data. Does anyone have advice on how to correct this error in my script?