Skip to content

← spectral package

SpectralSelection

Apply a band-pass filter to a given segmented signal.

This node is specifically made for filtering data after it has already been segmented (based on the Fast Fourier Transform or FFT). Note: even though this node is in the spectral category, it does neither accept nor produce data in the frequency domain (i.e., with a frequency axis), but instead the input and output are typical segmented time series. When the task is to filter segmented data, this node is preferred over an IIR or FIR filter -- however, if one of these band-pass filters can already be applied on continuous data (i.e. before segmentation), then doing so will usually yield better results, because it is done before any sharp discontinuities at the edges of the segments are introduced. The only exception to this rule of thumb is if the goal is to apply a band-pass filter with no phase lag/distortion (e.g., to retain the exact shape and shift of an event-related potential in EEG): then this node is the only available choice in NeuroPype. Note also that filtering segmented data will give much milder edge artifacts if the data is zero-mean ( that is, has been detrended, or has already been high-pass filtered before segmentation), and/or if the signal has had a window function applied to it (this can be done by putting the Window Function node before this node). Note that the FFT Band-Pass filter node is not a very good choice on non-segmented, i.e., continuous data (neither offline nor especially online) -- in these cases, FIR or IIR filters are strongly preferred. This node will not change the shape or axes of the data. At a technical level, the node transforms the data into the frequency domain, sets spectral components outside the desired range to zero, and then back-transforms the result into the time domain. Note: if low frequencies are being removed with this filter, this will result in the signal becoming more periodic, i.e., the waveform will appear to wrap around the edges (these are the aforementioned edge artifacts). More Info... Version 1.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

frequencies

Lower and upper edges of the retained frequency band. For example, [8, 12] retains the band between 8 and 12 Hz, and discards everything else.

  • verbose name: Retain Frequencies Between
  • default value: [8, 12]
  • port type: ListPort
  • value type: list (can be None)

blocksize

Block size to conserve memory. This is the number of instances/trials (if present) or otherwise channels (if present) that should be processed simultaneously. Using a larger number will allow you to process all your data at once, or in a few steps, which minimizes the per-step compute time overhead, but will require more memory. The default is a fair choice for memory-constrained machines. Aside from memory use, the result is unaffected by this setting.

  • verbose name: Block Size To Conserve Memory
  • default value: 100
  • port type: IntPort
  • value type: int (can be None)

fft_size

Length of the FFT used, in samples. If set to None (the default), the FFT size matches the size of the data, which can be an odd size that may not be particularly efficient. If set to -1, the next higher power of two is used that can accommodate the data; this can be faster, but results will be slightly different.

  • verbose name: Fft Size
  • default value: None
  • port type: IntPort
  • value type: int (can be None)

legacy

Use the legacy implementation. This should give almost identical results but is included for compatibility reasons.

  • verbose name: Legacy
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

stopband_gain

Gain in the stop band, as a value between 0 and 1. This can be used to not entirely suppress content in the off-band, but instead attenuate it to a certain amount.

  • verbose name: Stopband Gain
  • default value: 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)