Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session_id flow in Experiment #71

Open
nvbln opened this issue Feb 23, 2022 · 0 comments
Open

session_id flow in Experiment #71

nvbln opened this issue Feb 23, 2022 · 0 comments

Comments

@nvbln
Copy link
Contributor

nvbln commented Feb 23, 2022

The current flow of the session_id in the Experiment class is in two parts: the session_id itself, and the timestamp that it contains, it is updated as follows:

  1. Start of Stytra: first timestamp is defined in the __init__ call, session_id is set to None.
  2. Start of experiment: session_id is updated to the first timestamp, the timestamp variable stays the same.
  3. Start of the protocol: nothing happens.
  4. End of the protocol: set_id is called, but session_id does not get updated because we still use the first timestamp. After this, the timestamp gets updated. So session_id reflects the first timestamp, but the timestamp itself is already the second timestamp.
  5. Start of the second protocol run: nothing happens.
  6. End of the second protocol run: set_id is called, it gets updated to the second timestamp. After this, the timestamp gets updated. So session_id reflects the second timestamp, but the timestamp itself is already the third timestamp.

So between 3 and 4, the first (and correct) timestamp is used. Between 5 and 6, the first (and incorrect) timestamp is used. And between a potential 7 and 8, the second (and incorrect) timestamp will be used.

The resulting effect (at least for me) is since there is a dependency session_id -> filename_prefix -> filename_base. So the filename during a protocol run will reflect the previous protocol from the second protocol onward. Only once the protocol is ended will it get updated. This usually poses no problem, since most files are written after this. However, I don't think this is a logical flow for session_id, and it results in problems such as when writing the video file, since it needs a file to write to from the onset of the protocol.

Since this code comes from the Experiment class I do not know how much code is reliant on the current behaviour. It would likely be good to test/check the code that makes use of this before pushing a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant