-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add new function to retrieve spatial series from NWB file #777
Conversation
Co-authored-by: Chris Brozdowski <[email protected]>
I think another approach would be to give the old def central_func(params):
lookup_dict = {'position': ['behavior', pynwb.behavior.position], 'other': ['field', type]}
if param in lookup_dict:
field, type = lookup_dict[param]
else:
field, type = default_field, other_default But this works if getting the interface is pretty static |
@CBroz1 Agree that this is what we should move toward in the long run. One issue is that it's a bit hard to predict what the key of the lookup dicts should be because each NWB file can name their position object differently. More practical concern is that we must finish the manuscript within a week and this is required to demonstrate run spyglass pipeline on other labs' NWB files. I say we make your suggestion a long term goal and move forward with this quick fix for now. |
Have you tested this with some of our nwb files? |
@edeno Yes I tested one of the chimi nwb files. The output of |
Please lint. |
Description
Currently
RawPosition
is populated by loading spatial series withget_all_spatial_series
, which callsget_data_interface(nwbfile, 'position', pynwb.behavior.Position)
, which looks for an object of nameposition
and typepynwb.behavior.Position
within the processing modules of the NWB file. Some NWB files (e.g. the Buzsaki lab data) don't use the nameposition
(instead they useSubjectPosition
). As a result, the spatial series in the NWB file don't show up inRawPosition
upon ingestion into spygass.This fixes this by creating a new function called
get_position_obj
which looks for object of the typepynwb.behavior.Position
within thebehavior
processing module of the NWB file without caring about the name.get_all_spatial_series
now calls this function instead ofget_data_interface(nwbfile, 'position', pynwb.behavior.Position)
.I have tested this on an NWB file from our lab and have confirmed that this doesn't cause any change in the output of
get_all_spatial_series
. I have also tested it on the Buzsaki lab NWB file and confirmed that this now returns the spatial series (used to return nothing).Checklist:
CITATION.cff
CHANGELOG.md