Note
Click here to download the full example code
Spike Train FeaturesΒΆ
Detect spike train features
Out:
/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/v1.0.0.1/docs/gallery/spikes_examples/spike_train_features.py:27: VisibleDeprecationWarning: Function create_ephys_data_set is deprecated. Instead of using ipfx.data_set_utils.create_data_set, use ipfx.dataset.create.create_ephys_data_set
dataset = create_data_set(sweep_info=sweep_info, nwb_file=nwb_file)
/home/docs/checkouts/readthedocs.org/user_builds/ipfx/envs/v1.0.0.1/lib/python3.7/site-packages/hdmf/spec/namespace.py:470: UserWarning: ignoring namespace 'hdmf-common' because it already exists
warn("ignoring namespace '%s' because it already exists" % ns['name'])
/home/docs/checkouts/readthedocs.org/user_builds/ipfx/envs/v1.0.0.1/lib/python3.7/site-packages/hdmf/spec/namespace.py:470: UserWarning: ignoring namespace 'core' because it already exists
warn("ignoring namespace '%s' because it already exists" % ns['name'])
/home/docs/checkouts/readthedocs.org/user_builds/ipfx/checkouts/v1.0.0.1/ipfx/dataset/create.py:124: VisibleDeprecationWarning: Class EphysDataSet is deprecated. Import EphysDataSet from ipfx.dataset.ephys_dataset rather than ipfx.ephys_dataset
data=nwb_data,
{'adapt': 0.02422398922048236, 'latency': 0.01540000000000008, 'isi_cv': 0.20699907608695922, 'mean_isi': 0.024953333333333327, 'median_isi': 0.026100000000000012, 'first_isi': 0.0043400000000000105, 'avg_rate': 40.0}
from __future__ import print_function
import os
from allensdk.api.queries.cell_types_api import CellTypesApi
from ipfx.data_set_utils import create_data_set
from ipfx.feature_extractor import (
SpikeFeatureExtractor, SpikeTrainFeatureExtractor
)
# Download and access the experimental data
ct = CellTypesApi()
nwb_file = os.path.join(
os.path.dirname(os.getcwd()),
"data",
"nwb2_H17.03.008.11.03.05.nwb"
)
specimen_id = 595570553
sweep_info = ct.get_ephys_sweeps(specimen_id)
# Get the data for the sweep into a format we can use
dataset = create_data_set(sweep_info=sweep_info, nwb_file=nwb_file)
sweep_number = 39
sweep = dataset.sweep(sweep_number)
# Extract information about the spikes
start, end = 1.02, 2.02
ext = SpikeFeatureExtractor(start=start, end=end)
spikes_df = ext.process(t=sweep.t, v=sweep.v, i=sweep.i)
st_ext = SpikeTrainFeatureExtractor(start=start, end=end)
st_results = st_ext.process(
t=sweep.t,
v=sweep.v,
i=sweep.i,
spikes_df=spikes_df
)
print(st_results)
Total running time of the script: ( 0 minutes 1.782 seconds)