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

[New Check]: Non-required Electrode columns (nwb-schema >= 2.5.0) #225

Draft
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

CodyCBakerPhD
Copy link
Collaborator

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
Collaborator 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
Collaborator 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
2 participants