FFT Dispatch and Caching

FFT dispatch, data extraction, and caching for INTENSE.

Provides FFT type classification, data extraction helpers, and cache building functions used by the INTENSE pipeline and delay optimization.

class driada.intense.fft.FFTCacheEntry(fft_type, mi_all)[source]

Cache entry for pre-computed MI values.

Stores MI values for ALL possible shifts, enabling O(1) lookup without redundant FFT computation. The FFT is computed once when building the cache, then MI for any shift is just array indexing.

Parameters:
fft_type

FFT type constant (FFT_CONTINUOUS, FFT_DISCRETE, FFT_MULTIVARIATE).

Type:

str

mi_all

MI values for ALL n shifts (shape: (n,)).

Type:

np.ndarray

fft_type: str
mi_all: ndarray
__init__(fft_type, mi_all)
Parameters:
Return type:

None

driada.intense.fft.get_fft_type(ts1, ts2, metric, mi_estimator, count, engine, for_delays=False)[source]

Determine which FFT optimization to use for a time series pair.

Unified function that replaces _should_use_fft, _should_use_fft_gd, _should_use_fft_mts, and _should_use_fft_for_delays.

Parameters:
  • ts1 (TimeSeries or MultiTimeSeries) – First time series.

  • ts2 (TimeSeries or MultiTimeSeries) – Second time series.

  • metric (str) – Similarity metric being used.

  • mi_estimator (str) – MI estimator (‘gcmi’ or ‘ksg’).

  • count (int) – Number of shuffles (nsh) or shifts (for delay optimization).

  • engine (str) – Computation engine: ‘auto’, ‘fft’, or ‘loop’.

  • for_delays (bool) – If True, use delay optimization threshold (MIN_SHIFTS_FOR_FFT_DELAYS). Default False uses shuffle threshold (MIN_SHUFFLES_FOR_FFT).

Returns:

FFT type constant (FFT_CONTINUOUS, FFT_DISCRETE, FFT_MULTIVARIATE), or None for loop fallback.

Return type:

str or None

Raises:

ValueError – If engine=’fft’ but no FFT optimization is applicable.

FFT type classification, data extraction, and pre-computed MI caching for INTENSE analysis.

Functions

driada.intense.fft.get_fft_type(ts1, ts2, metric, mi_estimator, count, engine, for_delays=False)[source]

Determine which FFT optimization to use for a time series pair.

Unified function that replaces _should_use_fft, _should_use_fft_gd, _should_use_fft_mts, and _should_use_fft_for_delays.

Parameters:
  • ts1 (TimeSeries or MultiTimeSeries) – First time series.

  • ts2 (TimeSeries or MultiTimeSeries) – Second time series.

  • metric (str) – Similarity metric being used.

  • mi_estimator (str) – MI estimator (‘gcmi’ or ‘ksg’).

  • count (int) – Number of shuffles (nsh) or shifts (for delay optimization).

  • engine (str) – Computation engine: ‘auto’, ‘fft’, or ‘loop’.

  • for_delays (bool) – If True, use delay optimization threshold (MIN_SHIFTS_FOR_FFT_DELAYS). Default False uses shuffle threshold (MIN_SHUFFLES_FOR_FFT).

Returns:

FFT type constant (FFT_CONTINUOUS, FFT_DISCRETE, FFT_MULTIVARIATE), or None for loop fallback.

Return type:

str or None

Raises:

ValueError – If engine=’fft’ but no FFT optimization is applicable.