elephant.conversion.BinnedSpikeTrainView

class elephant.conversion.BinnedSpikeTrainView(t_start, t_stop, bin_size, units, sparse_matrix, tolerance=1e-08)[source]

A view of BinnedSpikeTrain.

This class is used to avoid deep copies in several functions of a binned spike train object like BinnedSpikeTrain.binarize(), BinnedSpikeTrain.time_slice(), etc.

Parameters:
t_start, t_stopfloat

Unit-less start and stop times that share the same units.

bin_sizefloat

Unit-less bin size that was used used in binning the sparse_matrix.

unitspq.Quantity

The units of input spike trains.

sparse_matrixscipy.sparse.csr_matrix

Binned sparse matrix.

tolerancefloat or None, optional

The tolerance property of the original BinnedSpikeTrain. Default: 1e-8

Warning

This class is an experimental feature.

__init__(t_start, t_stop, bin_size, units, sparse_matrix, tolerance=1e-08)[source]

Methods

__init__(t_start, t_stop, bin_size, units, ...)

binarize([copy])

Clip the internal array (no.

copy()

Copies the binned sparse matrix and returns a view.

get_num_of_spikes([axis])

Compute the number of binned spikes.

rescale(units)

Inplace rescaling to the new quantity units.

time_slice([t_start, t_stop, copy])

Returns a view or a copied view of currently binned spike trains with (t_start, t_stop) time slice.

to_array([dtype])

Returns a dense matrix, calculated from the sparse matrix, with counted time points of spikes.

to_bool_array()

Returns a matrix, in which the rows correspond to the spike trains and the columns correspond to the bins in the BinnedSpikeTrain.

to_sparse_bool_array()

Getter for boolean version of the sparse matrix, calculated from sparse matrix with counted time points.

to_spike_trains([spikes, as_array, ...])

Generate spike trains from the binned spike train object.

Attributes

bin_centers

Returns each center time point of all bins between t_start and t_stop points.

bin_edges

Returns all time edges as a quantity array with n_bins bins.

bin_size

Bin size quantity.

is_binary

Returns True if the sparse matrix contains binary values only.

shape

The shape of the sparse matrix.

sparsity

The sparsity of the sparse matrix computed as the no.

spike_indices

A list of lists for each spike train (i.e., rows of the binned matrix), that in turn contains for each spike the index into the binned matrix where this spike enters.

t_start

t_start quantity; spike times below this value have been ignored.

t_stop

t_stop quantity; spike times above this value have been ignored.