Skip to content

Segment Settings Helper

ffTRF.suggest_segment_settings(...) is a small rule-of-thumb helper for choosing practical defaults for the standard spectral estimator.

Use it when you want a first guess for:

  • segment_duration
  • segment_length
  • overlap
  • window

It does not replace model selection or domain knowledge. It just gives a reasonable starting point from the sampling rate, lag window, and optional trial duration.

fftrf.suggest_segment_settings(*, fs, tmin, tmax, trial_duration=None)

Suggest practical segment settings for the standard spectral estimator.

This helper is meant as a lightweight starting point for choosing segment_length / segment_duration and window when you use the default spectral_method="standard" workflow. The heuristic is simple:

  • keep the segment clearly longer than the lag window
  • prefer full-trial spectra when trials are already short
  • otherwise default to overlapping Hann-windowed segments

Parameters:

Name Type Description Default
fs float

Sampling rate in Hz.

required
tmin float

Lag window, in seconds, that you plan to extract from the fitted TRF.

required
tmax float

Lag window, in seconds, that you plan to extract from the fitted TRF.

required
trial_duration float | None

Optional approximate trial duration in seconds. When supplied, the helper can decide whether a full-trial spectrum is more sensible than splitting each trial into shorter overlapping segments.

None

Returns:

Type Description
dict

Dictionary with the keys segment_length, segment_duration, overlap, and window. When a full-trial estimate is suggested, both segment fields are None, overlap is 0.0, and window is None.

Notes

The returned values are intended as rule-of-thumb defaults, not as an optimizer. If you later switch to train_multitaper(...) or spectral_method="multitaper", you can usually keep the suggested segment_duration and overlap but should set window=None.