-
Notifications
You must be signed in to change notification settings - Fork 23
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
[Proposal] Automatically align starting_time
or timestamps
to session_start_time
for interfaces that automatically extract the latter
#597
Comments
There are some concerns I'd potentially have about feasibility but they all require speculation... Can you provide a full real example of what this would look like now, and what an 'automated' sync method would look like as an alternative? |
The current state of affairs: And correctly sets the
Then, if they run the code as in the gallery without doing anything else, then timestamps (or the starting_time) of the If they wanted to correct the time alignment, they would have to get discover that we have the time setter methods and then modify the timestamps of the SpikeGLX interface by shifting it ten minutes with the method Now, with the method that I am proposing this will be fixed automatically in some cases by calling this code before adding the object to the file. # Shift to the session start time
metadata = metadata or self.get_metadata()
interface_session_start_time = extract_session_start_time(self.file_path) # This is the method of the interface
conversion_session_start_time = metadata["NWBFile"]["session_start_time"] # This is the converter metadata which might differs from the interface
starting_time = interface_session_start_time.timestamp() - conversion_session_start_time.timestamp()
# Shift timestamps if they are available
timestamps_shifted = timestamps + starting_time
...
# Set the corrected timestamps (or starting_time) We can do that with your function neuroconv/src/neuroconv/datainterfaces/behavior/fictrac/fictracdatainterface.py Lines 116 to 121 in c2f4cc9
|
My question with your setup is; how does the user specify which interface to consider as the 'ground truth' start time? What would the helper function API look like? There is a reason we have left so much of this up to user control to do the lines you are suggesting It will also only be possible in cases where the resolution of interacting interfaces is the same (some session start times are only 'dates' rather than 'datetimes') which again is why we let custom code specify how to handle different resolutions |
The ground truth will be the I have not think on the exact API yet. We could have this logic inside Yes, it will only be available for interfaces that have datetimes. For those it would be an improvement, for the rest, there is nothing we could do. |
@CodyCBakerPhD comment in #598 (comment)
|
For some interfaces like SpikeGLX we automatically extract the
session_start_time
. If the latter is a dateime object we can automatically shift/align them if the user specifes thesession_start_time
in the metadata.The code would be something like this in their
add_object
method.That way, if some interface / experiment is shifted (i.e. was started let's say 10 minutes after the beginning of the experiment) neuroconv will automatically align them.
What are some downsides on this?
The text was updated successfully, but these errors were encountered: