neuralset.extractors.neuro.SpikesExtractor¶
- pydantic model neuralset.extractors.neuro.SpikesExtractor[source][source]¶
Feature extractor for spike data stored in HDF5/NWB files.
Reads spike times from HDF5 files and creates a dense binned array of shape (n_units, n_time_bins) at the specified frequency.
The preprocessing steps, if specified, are ordered as follows: 1. Spike binning at target frequency 2. Scaling 3. Baseline correction (applied on segments) 4. Clamp (applied on segments)
- Parameters:
frequency ("native" or float, default="native") – Target sampling frequency for spike binning. If
"native", uses the frequency declared in the Spikes event.offset (float, default=0.0) – Time offset (in seconds) applied to the segment window.
baseline (tuple of float, optional) – If provided as
(start, end), defines the baseline correction window in seconds relative to the segment start.scaler ({"RobustScaler", "StandardScaler"}, optional) – Scaling strategy to normalize channel data using scikit-learn scalers.
scale_factor (float, optional) – Multiplicative factor applied to the data after scaling but before clamping.
clamp (float, optional) – Maximum absolute value for clamping after preprocessing.
channel_order ({"unique", "original"}, default="unique") –
"unique": channels are numbered based on unique names across all recordings."original": channel indices follow per-recording order, enabling a fixed-size channel dimension across subjects.
- Fields:
- prepare(obj: DataFrame | Sequence[Event] | Sequence[Segment]) None[source][source]¶
Pre-compute and cache extractor data for a collection of events.
This method triggers
_get_dataon every matching event so that expensive computation (e.g. model inference) is done once and cached. It then calls the extractor on a single event to populate the output shape, which is needed whenallow_missing=True.Call
preparebefore using the extractor in a dataloader.