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

Update ecephys.py #1581

Merged
merged 2 commits into from
Nov 4, 2022
Merged

Update ecephys.py #1581

merged 2 commits into from
Nov 4, 2022

Conversation

bendichter
Copy link
Contributor

@bendichter bendichter commented Nov 4, 2022

Motivation

The ecephys tutorial currently generates data of shape (50, 4), but there are 12 electrodes so this fails inspection, generating two critical InspectorMessage objects:

from nwbinspector import inspect_nwb
list(inspect_nwb("ecephys_tutorial.nwb"))
[InspectorMessage(
     message='The second dimension of data does not match the length of electrodes. Your data may be transposed.',
     importance=<Importance.CRITICAL: 2>,
     severity=<Severity.LOW: 1>,
     check_function_name='check_electrical_series_dims',
     object_type='ElectricalSeries',
     object_name='ElectricalSeries',
     location='/processing/ecephys/LFP/ElectricalSeries',
     file_path='/Users/bendichter/dev/sandbox/ecephys_tutorial.nwb'
 ),
 InspectorMessage(
     message='The second dimension of data does not match the length of electrodes. Your data may be transposed.',
     importance=<Importance.CRITICAL: 2>,
     severity=<Severity.LOW: 1>,
     check_function_name='check_electrical_series_dims',
     object_type='ElectricalSeries',
     object_name='ElectricalSeries',
     location='/acquisition/ElectricalSeries',
     file_path='/Users/bendichter/dev/sandbox/ecephys_tutorial.nwb'
 ), ...

The shape needs to be changed to (50, 12), which resolves both of these messages.

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running flake8 from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #1581 (bd7c379) into dev (d50e372) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##              dev    #1581   +/-   ##
=======================================
  Coverage   91.34%   91.34%           
=======================================
  Files          25       25           
  Lines        2507     2507           
  Branches      471      471           
=======================================
  Hits         2290     2290           
  Misses        137      137           
  Partials       80       80           
Flag Coverage Δ
integration 70.56% <ø> (ø)
unit 84.44% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@CodyCBakerPhD
Copy link
Collaborator

(i) do we have a tutorial that shows how to use a DynamicTableRegion to subselect from a larger electrodes table (if you have multiple probes and want to split the ElectricalSeries for some reason)

(ii) does the inspector correctly assess the shape from those subselected DynamicTableRegions?

@oruebel
Copy link
Contributor

oruebel commented Nov 4, 2022

(ii) does the inspector correctly assess the shape from those subselected DynamicTableRegions?

Since these are 1D arrays in the case of electrodes, the shape is just the length of the dataset so as long as ElectricSeries.electrodes.shape[0] == ElectricalSeries.data.shape[0] the check should be correct independent of the size of the ElectrodesTable. If you also want to check that the indices are valid you would need to chck that np.min(ElectricSeries.electrodes[:]) >=0 and np.max(ElectricSeries.electrodes[:]) < len(ElectricSeries.electrodes.table). The latter check is not quite correct, because you want to load the indices not the actual electrodes so [:] is not correct.

(i) do we have a tutorial that shows how to use a DynamicTableRegion to subselect from a larger electrodes table (if you have multiple probes and want to split the ElectricalSeries for some reason)

Not sure, but that would be good to add to the ECEphys tutorial if it is missing.

@bendichter bendichter merged commit 6847234 into dev Nov 4, 2022
@CodyCBakerPhD CodyCBakerPhD deleted the fix_ecephys branch November 4, 2022 16:27
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

Successfully merging this pull request may close these issues.

3 participants