Sweep QC FeaturesΒΆ

Estimate sweep QC features

Out:

/home/docs/checkouts/readthedocs.org/user_builds/ipfx/envs/latest/lib/python3.6/site-packages/hdmf/spec/namespace.py:485: UserWarning: Ignoring cached namespace 'hdmf-common' version 1.1.0 because version 1.3.0 is already loaded.
  % (ns['name'], ns['version'], self.__namespaces.get(ns['name'])['version']))
/home/docs/checkouts/readthedocs.org/user_builds/ipfx/envs/latest/lib/python3.6/site-packages/hdmf/spec/namespace.py:485: UserWarning: Ignoring cached namespace 'core' version 2.2.0 because version 2.2.5 is already loaded.
  % (ns['name'], ns['version'], self.__namespaces.get(ns['name'])['version']))
   sweep_number stimulus_units  ...  slow_noise_rms_mv  vm_delta_mv
0             5           Amps  ...           0.090198          NaN
1             6           Amps  ...           0.128340          NaN
2             7           Amps  ...           0.121554          NaN
3             8           Amps  ...           0.139625     0.029572
4             9           Amps  ...           0.349430     0.223572

[5 rows x 20 columns]
[{'sweep_number': 5, 'passed': True, 'reasons': []}, {'sweep_number': 6, 'passed': True, 'reasons': []}, {'sweep_number': 7, 'passed': True, 'reasons': []}, {'sweep_number': 8, 'passed': True, 'reasons': []}, {'sweep_number': 9, 'passed': True, 'reasons': []}]

import os
import pandas as pd
from ipfx.dataset.create import create_ephys_data_set
from ipfx.qc_feature_extractor import sweep_qc_features

import ipfx.sweep_props as sweep_props
import ipfx.qc_feature_evaluator as qcp
from ipfx.stimulus import StimulusOntology


# Download and access the experimental data from DANDI archive per instructions in the documentation
# Example below will use an nwb file provided with the package

nwb_file = os.path.join(
    os.path.dirname(os.getcwd()),
    "data",
    "nwb2_H17.03.008.11.03.05.nwb"
)
data_set = create_ephys_data_set(nwb_file=nwb_file)

# Compute sweep QC features
sweep_features = sweep_qc_features(data_set)

# Drop sweeps that failed to compute QC criteria
sweep_props.drop_tagged_sweeps(sweep_features)
sweep_props.remove_sweep_feature("tags", sweep_features)

stimulus_ontology = StimulusOntology.default()
qc_criteria = qcp.load_default_qc_criteria()

sweep_states = qcp.qc_sweeps(
    stimulus_ontology, sweep_features, qc_criteria
)

# print a few sweeps and states
print(pd.DataFrame(sweep_features).head())
print(sweep_states[0:len(pd.DataFrame(sweep_features).head())])

Total running time of the script: ( 0 minutes 8.234 seconds)

Gallery generated by Sphinx-Gallery