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

360/get notebook value #496

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

kasbaker
Copy link
Contributor

Overview:

There are some important metadata such as settings for the patch clamp amplifier that scientists need to be able to use in order to do their data analysis. Many of these metatada are not included in the sweep table and adding all of them could slow IPFX down considerably. If the experiment is recorded using MIES, the Lab Notebook associated with the experiment contains these metadata needed for experimental analysis. Unfortunately, the lab notebook associated with the experiment is part of a protected class for the end user and is not easily accessible. This pull request includes wrapper functions so that the end user can easily access the metadata that they need.

Addresses:

Addresses issue #360

Type of Fix:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing
    functionality to not work as expected)
  • Documentation Change

Solution:

Some Multiclamp Commander settings are not accessible through IPFX without accessing a protected class. This PR includes a wrapper around LabNotebookReader.get_value(), which will allow IPFX users to access any value in the Lab Notebook without accessing a protected class.

Changes:

Wrapper functions for get_notebook_value() were inserted into the following classes:

  • EphysDataSet ~ wrapper around EPhysDataInterface.get_notebook_value()
  • EphysDataInterface ~ abstract
  • EphysNWBData ~ abstract
  • MIESNWBData ~ wrapper around LabNotebookReader.get_value()
  • Changed "Neut Cap Enable" to "Neut Cap Enabled" on line 29 of labnotebook.py in order to fix and error when entering "Neut Cap Value" as a parameter for get_notebook_value()

Unit tests were updated as follows:

  • Updated EphysDataFixture test class and added new test_get_notebook_value() function for test_ephys_dataset.py
  • Updated Notebook test class and added new test_get_notebook_value() function for test_mies_nwb_data.py

Validation:

The unit tests that were updated should provide good coverage of inner and outer wrapper functionality. Here is a quick script to make sure that the values being returned make sense. Make sure there are .nwb files in the nwb_dir.

nwb_dir = Path("~/directory_with_nwb_files_in_it")
nwb_files = nwb_dir.glob("*.nwb")
for file in nwb_files:
    print(file)
    data_set = create_ephys_data_set(str(file))
    for num in data_set._data.sweep_numbers:
        print("----------------")
        print("Sweep Number")
        print(num)
        print("V-Clamp Holding Level")
        print(data_set.get_notebook_value("V-Clamp Holding Level", num, None))
        print("RsComp Bandwidth")
        print(data_set.get_notebook_value("RsComp Bandwidth", num, None))
        print("RsComp Correction")
        print(data_set.get_notebook_value("RsComp Correction", num, None))
        print("RsComp Prediction")
        print(data_set.get_notebook_value("RsComp Prediction", num, None))
        print("Whole Cell Comp Cap")
        print(data_set.get_notebook_value("Whole Cell Comp Cap", num, None))
        print("Whole Cell Comp Resist")
        print(data_set.get_notebook_value("Whole Cell Comp Resist", num, None))
        print("I-Clamp Holding Level")
        print(data_set.get_notebook_value("I-Clamp Holding Level", num, None))
        print("Neut Cap Value")
        print(data_set.get_notebook_value("Neut Cap Value", num, None))
        print("Bridge Bal Value")
        print(data_set.get_notebook_value("Bridge Bal Value", num, None))

Screenshots:

A screenshot of the console output from the above script for a voltage clamp sweep:
image
A screenshot of the console output from the above script for a current clamp sweep:
image

Unit Tests:

See test_ephys_dataset.py and test_mies_nwb_data.py

Script to reproduce error and fix:

See above validation section

Configuration details:

The nwb file used for the screenshots was Chrna2-Cre_OE25;Sst-IRES-FlpO;Ai65-533973.04.02.01.nwb

Checklist

  • My code follows
    Allen Institute Contribution Guidelines
  • My code is unit tested and does not decrease test coverage
  • I have performed a self review of my own code
  • My code is well-documented, and the docstrings conform to
    Numpy Standards
  • I have updated the documentation of the repository where
    appropriate
  • The header on my commit includes the issue number
  • My code passes all tests
  • I have updated the CHANGELOG.md with the description of changes understandable by end users

Notes:

There are really two wrapper functions here: one for EphysDataInterface and another for EphysDataSet. I called both of them get_notebook_value(), but it might be worthwhile naming them something different to avoid confusion.

Katherine Baker added 4 commits January 21, 2021 18:18
Wrote wrappers for get_notebook_value() in EPhysDataSet and EPhysDataInterface classes.

Fixed a typo in LabNotebookReader registered names.

Wrote test for wrapper function in EphysDataSet.
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.

1 participant