marcus-nystrom / Titta

Python and PsychoPy interface to Tobii eye trackers using Tobii Pro SDK
Other
61 stars 25 forks source link

Stop and Stop Recording during Experiment #9

Closed jgeller112 closed 3 years ago

jgeller112 commented 3 years ago

There does not appear to be any way to start and stop recording multiple times during the experiment and save the resulting data.

tracker.stop_recording(gaze_data=True)
tracker.save_data()

tracker.start_recording()

Am I missing something?

MaximilianR commented 3 years ago

You can save at the end of the experiment and it will save everything from that session even if you stopped and started recording multiple times.

jgeller112 commented 3 years ago

Thanks for the quick response!

The issue is I do not want to save all the data to one file. I want to stop recording during one phase (e.g., a test phase) and save the data, start the ET up during another phase (with calibration) and save that data. PsychoPy crashes when I try to do this making me think you cannot stop the ET recording and save the resulting data for only that phase/routine.

jgeller112 commented 3 years ago

Obviously, I can send messages to denote the different phases and post-process them, but thought there might be an easier way to get separate data files for phases/routines of interest.

MaximilianR commented 3 years ago

This is probably because the file name for the output of tracker.save_data() is set when you connect and initialize the eye tracker. So if you try saving multiple times it makes sense that it crashes, as it attempts to write to a file location that is already in use (or some other reason related to the Titta package).

There might be an easy way to change the file name during the experiment ( @marcus-nystrom ), although in that case you have to make sure you aren't creating saved files that are just subsets of all the data you collect during the exp: file1 = 1 file2 = 1,2 file3 = 1,2,3 ...

But as you say the the intended way to manage eyetracking data like this is to send messages denoting changes is experiment phase, as that is timestamped and can very easily be used to slice the raw eyetracking data.

marcus-nystrom commented 3 years ago

There is also an option in save_data to choose your own filename save_data(self, *argv, filename=None)

By setting this filename to a string of your choice, e.g., save_data(filename='p01_block1') you can override the filename set during init settings.FILENAME = 'testfile.tsv'

On Fri, Nov 20, 2020 at 9:16 AM MaximilianR notifications@github.com wrote:

This is probably because the file name for the output of tracker.save_data() is set when you connect and initialize the eye tracker. So if you try saving multiple times it makes sense that it crashes, as it attempts to write to a file location that is already in use (or some other reason related to the Titta package).

There might be an easy way to change the file name during the experiment ( @marcus-nystrom https://github.com/marcus-nystrom ), although in that case you have to make sure you aren't creating saved files that are just subsets of all the data you collect during the exp: file1 = 1 file2 = 1,2 file3 = 1,2,3 ...

But as you say the the intended way to manage eyetracking data like this is to send messages denoting changes is experiment phase, as that is timestamped and can very easily be used to slice the raw eyetracking data.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/marcus-nystrom/Titta/issues/9#issuecomment-731016889, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD57FB6PIZ5KHOSHYBWPYF3SQYQU5ANCNFSM4T2NR4UA .

jgeller112 commented 3 years ago

Thanks for the helpful suggestions! I will try this out.