att.surrogates

Surrogate generation for significance testing.

att.surrogates.phase_randomize(X, n_surrogates=100, seed=None)[source]

Generate amplitude-adjusted phase-randomized (AAFT) surrogates.

Preserves the power spectrum and marginal distribution of X while destroying nonlinear coupling and phase relationships.

Parameters:
  • X (1D time series of length n_samples)

  • n_surrogates (number of surrogates to generate)

  • seed (random seed for reproducibility)

Return type:

(n_surrogates, n_samples) array of surrogate time series

att.surrogates.time_shuffle(X, n_surrogates=100, block_size=None, seed=None)[source]

Generate time-shuffled surrogates.

Destroys temporal structure while preserving univariate statistics. With block_size > 1, preserves short-range autocorrelation within blocks.

Parameters:
  • X (1D time series of length n_samples)

  • n_surrogates (number of surrogates to generate)

  • block_size (if None, iid permutation; if int, shuffle blocks of this size)

  • seed (random seed for reproducibility)

Return type:

(n_surrogates, n_samples) array of surrogate time series

att.surrogates.twin_surrogate(X, n_surrogates=100, embedding_dim=3, embedding_delay=1, recurrence_threshold=None, seed=None)[source]

Generate twin surrogates from recurrence structure (Thiel et al. 2006).

Preserves the recurrence properties of the attractor while destroying the specific temporal ordering. Tests specifically for deterministic coupling structure in the dynamics.

Parameters:
  • X (1D time series of length n_samples)

  • n_surrogates (number of surrogates to generate)

  • embedding_dim (dimension for Takens delay embedding)

  • embedding_delay (delay for Takens embedding)

  • recurrence_threshold (distance threshold for recurrence matrix;) – if None, uses 10th percentile of pairwise distances

  • seed (random seed for reproducibility)

Return type:

(n_surrogates, n_output) array where n_output = n_samples - (embedding_dim - 1) * embedding_delay

Surrogate generation for significance testing.

att.surrogates.core.phase_randomize(X, n_surrogates=100, seed=None)[source]

Generate amplitude-adjusted phase-randomized (AAFT) surrogates.

Preserves the power spectrum and marginal distribution of X while destroying nonlinear coupling and phase relationships.

Parameters:
  • X (1D time series of length n_samples)

  • n_surrogates (number of surrogates to generate)

  • seed (random seed for reproducibility)

Return type:

(n_surrogates, n_samples) array of surrogate time series

att.surrogates.core.time_shuffle(X, n_surrogates=100, block_size=None, seed=None)[source]

Generate time-shuffled surrogates.

Destroys temporal structure while preserving univariate statistics. With block_size > 1, preserves short-range autocorrelation within blocks.

Parameters:
  • X (1D time series of length n_samples)

  • n_surrogates (number of surrogates to generate)

  • block_size (if None, iid permutation; if int, shuffle blocks of this size)

  • seed (random seed for reproducibility)

Return type:

(n_surrogates, n_samples) array of surrogate time series

att.surrogates.core.twin_surrogate(X, n_surrogates=100, embedding_dim=3, embedding_delay=1, recurrence_threshold=None, seed=None)[source]

Generate twin surrogates from recurrence structure (Thiel et al. 2006).

Preserves the recurrence properties of the attractor while destroying the specific temporal ordering. Tests specifically for deterministic coupling structure in the dynamics.

Parameters:
  • X (1D time series of length n_samples)

  • n_surrogates (number of surrogates to generate)

  • embedding_dim (dimension for Takens delay embedding)

  • embedding_delay (delay for Takens embedding)

  • recurrence_threshold (distance threshold for recurrence matrix;) – if None, uses 10th percentile of pairwise distances

  • seed (random seed for reproducibility)

Return type:

(n_surrogates, n_output) array where n_output = n_samples - (embedding_dim - 1) * embedding_delay