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

timestamps not found in the converted nwb data #26

Open
chrismkkim opened this issue Dec 21, 2023 · 2 comments
Open

timestamps not found in the converted nwb data #26

chrismkkim opened this issue Dec 21, 2023 · 2 comments

Comments

@chrismkkim
Copy link

After converting the original files (downloaded from cshl repo) to nwb, I ran the jupyter notebook, but there was no timestamps in

trial_seg_module.get('dFoF_firstSideTryAl').roi_response_series

Is this an issue with the conversion from mat to nwb?

Please see the error message attached.
error_jupyter_nb

@oruebel
Copy link

oruebel commented Dec 22, 2023

You may want to check whether the TimeSeries you are accesses is using a starting_time and rate instead of explicit timestamps. In PyNWB the property TimeSeries.timestamps only returns a timestamps array if it is part of the actual data; as such, if the TimeSeries does uses timestamps bases on starting_time and rate, then the property will be None (the relevant code in PyNWB is here https://github.com/NeurodataWithoutBorders/pynwb/blob/649800088ffb4bffb95bf0f55302d82537a8d78f/src/pynwb/base.py#L269-L276). If instead you always want an array even if starting_time and rate are being used, then you can use the TimeSeries.get_timestamps() function instead, which will return the same as the TimeSeries.timestamps property if explicit timestamps are being used and it will create a regularly sampled numpy array if starting_time and rate are being used (the code for TimeSeries.get_timestamps() is here https://github.com/NeurodataWithoutBorders/pynwb/blob/649800088ffb4bffb95bf0f55302d82537a8d78f/src/pynwb/base.py#L294-L298 )

@chrismkkim
Copy link
Author

Thank you for the response. I was able to replace starting_time and rate by timestamps in the conversion code convert_to_nwb.py. See the figure attached.

Of course, timestamps can be deduced from starting_time, rate, and the size of time-dimension of neural traces (shown as data in the code below). The latter is not readily available, but can be read off from the trace data.

It'd be good to update either the Jupyter notebook or convert_to_nwb.py, so that users can run the tutorial without extensive debugging.
error_fix_jupyter_nb

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

2 participants