Spike Train FeaturesΒΆ

Detect spike train 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']))
{'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}

import os
from ipfx.dataset.create import create_ephys_data_set
from ipfx.feature_extractor import (
    SpikeFeatureExtractor, SpikeTrainFeatureExtractor
)

# 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"
)

# Create data set from the nwb file and choose a sweeep
dataset = create_ephys_data_set(nwb_file=nwb_file)
sweep = dataset.sweep(sweep_number=39)

# Instantiate feature extractor for spikes
start, end = 1.02, 2.02
sfx = SpikeFeatureExtractor(start=start, end=end)

# Run feature extractor returning a table of spikes and their features
spikes_df = sfx.process(t=sweep.t, v=sweep.v, i=sweep.i)

# Instantiate Spike Train feature extractor
stfx = SpikeTrainFeatureExtractor(start=start, end=end)

# Run to produce features of a spike train
spike_train_results = stfx.process(
    t=sweep.t,
    v=sweep.v,
    i=sweep.i,
    spikes_df=spikes_df
)

print(spike_train_results)

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

Gallery generated by Sphinx-Gallery