datajoint-company / najafi-2018-nwb

Conversion of Churchland's dataset to NWB 2.0 format
MIT License
4 stars 8 forks source link

timestamps not found in the converted nwb data #26

Open chrismkkim opened 7 months ago

chrismkkim commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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