Skip to content

Conversation

@CodyCBakerPhD
Copy link
Contributor

fix #220

Early work on adding this check. Currently relies (incorrectly) on grabbing this information from the PyNWB version being used to read the files (>= 2.1.0 release) however that would not correctly apply to a file written using a cached namespace corresponding to any nwb-schema<2.5.0.

A couple of design considerations...

i) how to get the cached namespace core version? I tried the NWBHDF5IO nwbfile and such for this but didn't have any luck - nwbfile.namespaces just reports the string "core" and not the version. I was able to get this information however by the following

str(next(iter(file["specifications"]["core"])))

applied to a file = h5py.File(...)

ii) how best to communicate this version information from the io/file reading level of the inspect_nwb/run_checks level of the inspector and the ultimate check function (which is really only designed to receive one input, that being the object being checked.

@CodyCBakerPhD CodyCBakerPhD added the category: new check a new best practices check to apply to all NWBFiles and their contents label Jul 11, 2022
@CodyCBakerPhD CodyCBakerPhD self-assigned this Jul 11, 2022
if get_package_version(name="pynwb") < version.Version("2.1.0"):
return
if any(x.isnan() in electrode_table for x in ["x", "y", "z", "imp", "filtering"]):
return InspectorMessage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would yield here and say in the message which column is Nan. Also, does isnan work for an array? Maybe we could say if np.all(np.isnan(col))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, do you want it to report the exact index(ices) that are NaN or just the column that it was found in?

group=ElectrodeGroup(name="test_group", description="", device=Device(name="test_device"), location="unknown"),
group_name="test_group",
)
if get_package_version(name="pynwb") >= version.Version("2.1.0"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic should go inside the skip statement. From the comments it seems like maybe you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is temporary until they fix the bug - this PR will have to stay in draft until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: new check a new best practices check to apply to all NWBFiles and their contents

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Add Check]: add check for if electrodes table x, y, z are NaNs

3 participants