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: object

Bin 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 spikes IrregularTimeseries.

  • units_attribute (str) – Nested attribute path to the units ArrayDict.

  • max_spikes (Optional[int]) – Maximum number of spikes to include per unit per bin. If None, no clipping is applied.

  • right (bool) – Decide which side gets truncated when duration is not a multiple of bin_size. If True, 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. (default np.int32)