Gravity#
The Gravity connectivity metric calculates a measure of interaction between two time series based on the product of their exponential sums.
Warning
This is a toy metric that may not have practical applications but can serve as an educational tool.
import delaynet as dn
# Calculate gravity
result = dn.connectivity(ts1, ts2, metric="gravity", lag_steps=5)
Parameters:
lag_steps: Time lags to consider. An integer will consider lags [1, …, lag_steps]. Passing a list will consider the specified values as lags.n_tests: Number of iterations or resamples to perform within the hypothesis test. Default is 20.rng: Random number generator for resampling. If None, a default generator will be used.
- connectivities.gravity(ts2, lag_steps: int | list = None, n_tests: int = 20, rng: Generator | None = None)
Gravity connectivity (GC) metric.
- Parameters:
ts1 (numpy.ndarray) – First time series.
ts2 (numpy.ndarray) – Second time series.
lag_steps (int | list) – Time lags to consider. Can be a single integer or a list of integers. An integer will consider lags [1, …, lag_steps]. A list will consider the specified values as lags.
n_tests (int) – Number of iterations or resamples to perform within the hypothesis test.
rng (Generator | None) – Random number generator to resample from. If None, a default generator will be used.
- Returns:
Best p-value and corresponding lag.
- Return type: