Skip to content

← signal_processing package

Resample

Resample the signal to a different sampling rate.

Most often used to downsample for storage and subsequent analysis (e.g., from 1000 Hz acquisition down to 250 Hz), but also works for upsampling and arbitrary rate conversions. The main technicality in any resampler is the anti-aliasing filter that must be applied before subsampling; its choice trades off transition sharpness, stopband attenuation, signal delay, and CPU cost. This node abstracts that choice via the mode and quality settings. The default offline_noncausal mode is zero-phase (no signal delay) and runs on any data shape -- including segmented/epoched data -- but needs the whole recording in memory. The causal mode is streaming-capable, works equally well on offline data, and produces output identical to a single-shot offline run -- except for small boundary differences when a non-trivial padding mode is combined with a first chunk shorter than the resampler's boundary pad length (the boundary smoothing degrades but the output remains well-defined). Causal mode is limited to plain 2D time-series. The padding setting controls how boundary values are extrapolated for the anti-aliasing filter; the default works for most analyses. Version 2.0.0

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
INOUT

rate

Target sampling rate.

verbose name
Rate
default value
None
port type
FloatPort
value type
float (can be None)

mode

Resampling mode. offline_noncausal (default) uses a polyphase anti-aliasing filter (zero-phase FIR), supports any data shape including segmented data, but requires the entire recording at once. causal uses a streaming-capable causal resampler that works on both online (chunked) and offline data. The concatenated output of a streaming run is bit-identical to the same node run on the whole recording at once when the padding mode is set to the default 'constant'; for other padding modes the equivalence is violated at the signal beginning if the first chunk was shorter than the pad length, because non-constant padding then necessarily depends on the first chunk's length. Restricted to 2D data with a time axis plus one other axis (typically space).

verbose name
Resampling Mode
default value
offline_noncausal
port type
EnumPort
value type
str (can be None)

quality

Quality of the causal resampler (used in causal mode only). nearest = zero-order hold; linear = linear interpolation; low/medium/high are sinc interpolators of increasing filter length and quality, at some runtime cost. Ignored in offline_noncausal mode.

verbose name
Causal Resampler Quality
default value
high
port type
EnumPort
value type
str (can be None)

padding

Padding mode of data at signal boundaries. Note that the behavior for the line and smooth options differs slightly between the non-causal and causal modes. Note on legacy behavior: Resample 1.0.0 did not respect the padding argument and always used constant padding. Note on streaming: if the first streaming chunk is shorter than the resampler's boundary pre-pad amount, non-constant padding modes may produce small boundary anomalies due to numpy.pad's multiple-reflection behavior; 'constant' is well-defined regardless of first-chunk length.

verbose name
Input Edge Padding
default value
constant
port type
EnumPort
value type
str (can be None)

kaiser_param

Kaiser window parameter for the FIR filter design in offline_noncausal mode. Ignored in causal mode.

verbose name
Kaiser Param
default value
5.0
port type
FloatPort
value type
float (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)