BinSpikes#
- class torch_brain.transforms.BinSpikes(bin_size, spikes_attribute='spikes', units_attribute='units', max_spikes=None, right=True, eps=0.001, dtype=<class 'numpy.int32'>)[source]#
Bases:
objectBin spike events into fixed-width time bins.
The transform reads spikes and units from nested attributes, applies
torch_brain.utils.binning.bin_spikes(), and stores the result in a new nested attribute named{spikes_attribute}_binned.- Parameters:
bin_size (
float) – Bin width in seconds.spikes_attribute (
str) – Nested attribute path to the spikesIrregularTimeseries.units_attribute (
str) – Nested attribute path to the unitsArrayDict.max_spikes (
Optional[int]) – Maximum number of spikes to include per unit per bin. IfNone, no clipping is applied.right (
bool) – Decide which side gets truncated when duration is not a multiple ofbin_size. IfTrue, excess spikes are truncated from the left edge.eps (
float) – Small numerical margin used during bin assignment.dtype (
dtype) – Data type of the output binned array. (defaultnp.int32)