API Documentation¶
API reference for the module.
Table of Contents¶
Measures¶
Spike related measures and conversions, available in the measures sub-module.
Spikes¶
Measures for spike data.
|
Estimate firing rate from a vector of spike times, in seconds. |
|
Compute inter-spike intervals. |
|
Compute coefficient of variation. |
|
Compute the fano factor of a spike train. |
|
Compute the spike presence across time bins. |
|
Compute the presence ratio for a set of spike times. |
Conversions¶
Conversions between spike representations.
|
Convert spike times into a binary spike train. |
|
Convert a spike train representation into spike times, in seconds. |
|
Convert a sequence of inter-spike intervals to spike times. |
|
Convert spikes times to counts of spikes per time bin. |
|
Convert spike times to continuous firing rates. |
Circular¶
Measures for working with circular data.
|
Bin circular data. |
Trials¶
Measures related to trial-epoched data.
|
Compute continuous binned firing rates for a set of epoched spike times. |
|
Compute firing rate across trial segments. |
|
Compute the firing rates in pre and post event windows. |
|
Compute the average firing rate across pre & post event windows. |
|
Compute the difference in firing rates between pre & post event windows. |
Collections¶
Measures that can be applied to collections (groups) of neurons.
|
Compute the empty time ranges that are common across a collection of recorded neurons. |
|
Find empty time bins across a collection of recorded neurons. |
|
Find empty time ranges based on time bin emptiness for a collection of recorded neurons. |
Objects¶
Objects for managing spike-related data, available in the objects sub-module.
Unit¶
|
A Unit object. |
Session¶
|
A Session object. |
Spatial¶
Functionality for processing spatial data, available in the spatial sub-module.
Distance¶
Measures and methods related to distances.
|
Compute the distance between two positions. |
|
Compute distances across a sequence of positions. |
|
Compute cumulative distance across a sequence of positions. |
|
Compute distances between a sequence of positions and a specified location. |
|
Get the index of the closest position value to a specified location. |
Speed¶
Measures and methods related to speed.
|
Compute speeds across a sequence of positions. |
Occupancy¶
Measures and methods related to computing spatial occupancy.
|
Compute spatial bin edges. |
|
Compute spatial bin assignment. |
|
Compute counts per bin, from position data. |
|
Compute number of counts per bin, from bin assignments. |
|
Normalize bin counts by occupancy. |
|
Create a dataframe that stores information about position bins. |
|
Compute the bin occupancy from bin-position dataframe. |
|
Compute occupancy across spatial bin positions. |
|
Compute trial-level occupancy across spatial bin positions. |
Place¶
Measures and methods related to place cell analyses.
|
Compute the spatially binned spiking activity. |
|
Compute the spatially binned spiking activity, across trials. |
Target¶
Measures and methods related to spatial target cell analyses.
|
Compute binned firing based on spatial target. |
Information¶
Measures and methods related to computing spatial information.
|
Compute spatial information. |
Utilities¶
Utilities related to spatial data.
|
Get the x & y data vectors from a 2d position data array. |
|
Compute the number of bins for a given bin definition. |
|
Compute bin width from a set of bin edges. |
|
Compute the range of positions. |
|
Convert a set of 2d bin indices into the equivalent 1d indices. |
|
Convert a set of 1d bin indices into the equivalent 2d indices. |
Checks¶
Functions to check data and arguments to spatial related processes.
|
Check a position array. |
|
Check a bin definition for binning spatial data. |
|
Check computed bin widths for a set of spatial bins. |
Statistics¶
Statistical analyses, available in the stats sub-module.
Generators¶
Statistical generators.
|
Generator function for a Homogeneous Poisson distribution. |
Trials¶
Statistical measures for trial-epoched data.
|
Compute a related samples t-test between the pre & post event firing rates. |
|
Compare pre & post activity, computing the average firing rates and a t-test comparison. |
|
Compare binned firing rates between two sets of trials with independent samples t-tests. |
Shuffle¶
Methods for shuffling data.
|
Shuffle spikes. |
|
Create shuffled spike times using permuted inter-spike intervals. |
|
Shuffle data with circular shuffles of randomly sized bins of the spike train. |
|
Shuffle spikes based on generating new spike trains from a Poisson distribution. |
|
Shuffle spikes based on circularly shifting the spike train. |
Permutations¶
Methods and measures related to permutation statistics.
|
Compute the empirical p-value from a distribution of surrogates. |
|
Compute the z-score of a real data value compared to a distribution of surrogates. |
|
Compute surrogate statistics. |
ANOVA¶
Methods and measures related to computing ANOVAs.
|
Create a dataframe from an array of data. |
|
Create a dataframe from an array of binned data. |
|
Fit an ANOVA. |
Simulations¶
Functionality for simulating spiking data, available in the sim sub-module.
General¶
General simulation functions.
|
Simulate spike times. |
|
Simulate a spike train. |
|
Simulate a collection of trials. |
Spike Times¶
Simulate spike times.
|
Simulate spike times based on a Poisson distribution. |
Spike Trains¶
Simulate spike trains.
|
Simulate spikes based on a probability of spiking per sample. |
|
Simulate spike train from a binomial probability distribution. |
|
Simulate spike train from a Poisson distribution. |
Trials¶
Simulate trial-structured data.
|
Simulate a collection of trials, based on a Poisson spike time simulation. |
Utilities¶
Simulation related utilities.
|
Apply a refractory period to simulated spike times. |
|
Apply a refractory period to a simulated spike train. |
Plots¶
Functions in the plts sub-module for visualizing spiking data and related measures.
Spikes¶
Plots for spike data.
|
Plot a spike waveform. |
|
Plot waveforms on a 3D axis. |
|
Plot a heatmap of waveform density, created as a 2d histogram of spike waveforms. |
|
Plot a distribution of ISIs. |
|
Plot firing rates for a group of neurons. |
Spatial¶
Plots for spatial data.
|
Plot positions. |
|
Position 1d position data, with annotated events. |
|
Plot position across time for a single dimension. |
|
Plot a spatial heat map. |
|
Plot spatial heat maps for a set of trials. |
|
Create a standardized title for an heatmap, listing the data range. |
Task¶
Plots for visualizing task structure.
|
Plot task structure with shaded ranges of event durations and lines for point events. |
|
Plot task events. |
Trials¶
Plots for trial-epoched data.
|
Plot rasters across multiple trials. |
|
Plot continuous firing rates across time. |
|
Create a standardized title for an event-related raster plot. |
Stats¶
Plots for statistical measures and methods.
|
Plot a distribution of surrogate data. |
Data¶
Basic plot function for different data types.
|
Plot data as a line. |
|
Plot 2d data as a scatter plot. |
|
Plot 1d data as points. |
|
Plot data as a histogram. |
|
Plot data in a bar graph. |
|
Plot a horizontal bar plot. |
|
Plot a polar histogram. |
|
Plot text. |
Annotate¶
Helper functions to annotate plot axes.
|
Select a color based on the significance of a p-value. |
|
Add vertical line(s) to a plot axis. |
|
Add horizontal line(s) to a plot axis. |
|
Add gridlines to a plot axis. |
|
Add vertical shade region(s) to a plot axis. |
|
Add horizontal shade region(s) to a plot axis. |
|
Add a shaded box to a plot axis. |
|
Add multiple shaded boxes to a plot axis. |
|
Add dots to a plot axis. |
|
Add markers to a plot axis to indicate statistical significance. |
|
Add text to the side of a plot. |
Style¶
Helper functions for managing plot style.
|
Drop spines from a plot axis. |
|
Invert plot axes. |
Utils¶
Plot related utilities.
|
Check whether a figure axes object is defined, and define or return current axis if not. |
|
Save out a figure. |
|
Make a subplot with multiple axes. |
|
Create a plot grid. |
|
Get a subplot section from a grid layout. |
Utilities¶
Utility functions, in the utils sub-module.
Base¶
General utilities for basic data types.
|
Flatten a list of lists into a single list. |
|
Convert all strings in a list to lowercase. |
|
Select elements from a list based on a boolean mask. |
|
Count elements within a collection object. |
|
Combine a list of dictionaries together. |
|
Update keys of a dictionary by appending a prefix. |
|
Update keys of a dictionary by dropping a prefix. |
|
Relabel keys in a dictionary. |
|
Subset a dictionary based on key labels. |
|
Check a dictionary for a set of keys. |
|
Check and embed a parameter into a list, if is not already in a list. |
Data¶
Utilities for working with arrays of data.
|
Check and make sure a 2d array is in a specified orientation. |
|
Compute the range of an array of data. |
|
Smooth an array of data, using a gaussian kernel. |
|
Drop any NaNs values from an array. |
|
Create permutations of a vector of data. |
|
Assign data values to data bins, based on given edges. |
Extract¶
Utilities for extracting data segments of interest.
|
Create a mask to select data points based on value. |
|
Create a mask for non-nan array elements. |
|
Select the same set of elements from a collection of arrays. |
|
Get a specified range from a vector of data. |
|
Extract data and associated timestamps for a desired value range. |
|
Get the index for a set of values closest to a specified value. |
|
Get indices for a set of specified time points. |
|
Get the index for a set of timepoints closest to a specified timepoint. |
|
Get indices for a set of specified time points. |
|
Get the value from a data array at a specific time point. |
|
Get values from a data array for a set of specified time points. |
|
Extract data for a requested time range. |
|
Threshold spikes by sub-selecting those that are temporally close to a set of time values. |
|
Threshold spikes by sub-selecting based on thresholding values on another data stream. |
|
Drop a specified time range from a vector spike times. |
|
Reinstate a dropped time range into an array of spike times. |
Timestamps¶
Utilities for working with timestamps.
|
Compute the time duration of each sample. |
|
Infer the time unit of given time values. |
Convert time value(s) from milliseconds to seconds. |
|
|
Convert time value(s) from seconds to minutes. |
|
Convert time value(s) from minutes to hours. |
Convert time value(s) from milliseconds to minutes. |
|
|
Convert a number of samples into the corresponding time length. |
|
Convert a time length into the corresponding number of samples. |
|
Sum the total amount of time defined by time range(s). |
|
Create a timepoints definition for a set of time bins. |
|
Split a time value from seconds to hours / minutes / seconds. |
|
Format a time value into a string. |
Epoch¶
Utilities for epoching data.
|
Epoch spiking data into trials, based on events of interest. |
|
Epoch spiking data into trials, based on time ranges of interest. |
|
Epoch spikes by segments. |
|
Epoch data into trials, based on individual timepoints of interest. |
|
Epoch data into trials, based on events of interest. |
|
Epoch data into trials, based on time ranges of interest. |
|
Epoch data by segments. |
Trials¶
Utilities for working with trial-level data.
|
Split trial data by condition label. |
|
Split trial data by condition label, for trial data as a list. |
|
Split trial data by condition label, for trial data as an array. |
|
Recombine data across trials. |
Run¶
Utilities for helping with running analyses.
|
Create a list of all methods. |
Checks¶
Utilities to check for basic properties of data / inputs.
|
Check a parameter value is within an acceptable range. |
|
Check a parameter value is one of the acceptable options. |
|
Check that a set of parameters have the same length. |
|
Check that a parameter has an acceptable type. |
|
Check a list of values that each element is one of a set of acceptable options. |
|
Check the orientation of an array of data. |
|
Check the orientation of arrays in a list. |
|
Check axis argument, and infer from array orientation if not defined. |
|
Checks data values against given bin edges, warning if values exceed bin range. |
|
Check a given time bin definition, and define if only given a time resolution. |
Random¶
Utilities for managing random state.
|
Set the random seed value. |
|
Set the random state in a RandomState object. |