-
Notifications
You must be signed in to change notification settings - Fork 260
Extract events from spike glx #1383
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
Extract events from spike glx #1383
Conversation
Thanks @manimoh This is great! Could you add a test for it? We have several SpikeGLX test files in the GIN epy_testing_data repo, and I'm sure (hope) at least one of them has digital events! |
Hi @alejoe91 |
Co-authored-by: Manish Mohapatra <[email protected]>
11c8495
to
e152c5e
Compare
@alejoe91 I pushed a test for it. Won't work right now, since there's no testing data. |
DigitalChannelTest_g0.zip |
Thanks! @samuelgarcia can you upload to GIN? |
@alejoe91 I submitted a PR here → https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/pulls/125 Will fix the reference as soon as that's merged. |
Thanks! Can you add a line to the README (on the GIN PR) with the provenance of the file? |
@TheChymera can you fix the conflicts? then it's should be ready! |
@TheChymera acually, there seem to be somthing wrong with the files you uploaded to GIN, see https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/src/master/spikeglx/DigitalChannelTest_g0/DigitalChannelTest_g0_t0.nidq.bin This seems to arise from a missing Can you make another PR with the fix? |
Actually tried one here: https://gin.g-node.org/NeuralEnsemble/ephy_testing_data/pulls/127 |
@TheChymera the new test files were tested! But triggered some errors. Have you seen this before? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the tests was failing because of a typo (maybe a bad autocomplete? )
Co-authored-by: Zach McKenzie <[email protected]>
Ok should be fixed now :) @TheChymera |
@alejoe91 thanks for fixing this up :) are we ready to go? ^^ |
I wonder why other CI workflows didn't run., e.g. |
@yarikoptic that workflow only runs if changes in core/project.toml/workflows ;) |
neo/rawio/spikeglxrawio.py
Outdated
def _rescale_event_timestamp(self, event_timestamps, dtype, event_channel_index): | ||
info = self.signals_info_dict[0, "nidq"] # There are no events that are not in the nidq stream | ||
if not self._use_direct_evt_timestamps: | ||
event_times = event_timestamps.astype(dtype) / float(info["sampling_rate"]) | ||
else: # Does this ever happen? | ||
event_times = event_timestamps.astype(dtype) | ||
return event_times | ||
|
||
def _rescale_epoch_duration(self, raw_duration, dtype, event_channel_index): | ||
return None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rescaling event timestamps should always return time so I think the else comment is a good question. The idea is that the get event timestamps should return for whatever the data is in (ie frames, samples, seconds). Then if the data is not in time we use the rescale function to switch it to time. I guess my question is what is the point of using the flag use_direct_evt_timestamps
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think as I was writing that piece of code, I did wonder about the necessity of using the flag because spikeglx never actually deals with timestamps on its own, and just sample numbers. So I do think we can just safely say
event_times = event_timestamps.astype(dtype) / float(info["sampling_rate"])
return event_times
without any use of conditionals involving that flag!
makes sense.. but why not to sweep python versions for |
@yarikoptic, our iotests are currently being run from a cached conda environment to make them faster when dependencies don't change. This requires a fixed python version. If we got rid of the caching the env we could sweep versions, but then creating the new envs would take time. We actually just ran into an issue with testing where it autoupdated to python 3.12 which broke a lot of code during one of our PRs, so that would be a bit more work to improve the CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. Just tagged to delete the flag and then make your edits to the rescale to simplify. @manimoh
neo/rawio/spikeglxrawio.py
Outdated
@@ -111,6 +111,7 @@ def __init__(self, dirname="", load_sync_channel=False, load_channel_location=Fa | |||
self.dirname = dirname | |||
self.load_sync_channel = load_sync_channel | |||
self.load_channel_location = load_channel_location | |||
self._use_direct_evt_timestamps = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would delete this then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet. I triggered tests. Once we run these this looks good to me. I'll let @alejoe91 have the final say since he knows spikeglx better than me.
@alejoe91 so, are we good? :3 |
Yep! Thanks for implementing this @manimoh @TheChymera !! |
Trying to fix this