timecorr.mexican_hat_weights

timecorr.mexican_hat_weights#

timecorr.mexican_hat_weights(T, params={'sigma': 10})[source]#

Generate Mexican Hat (Ricker) weighting function for dynamic correlations.

This function creates a time-varying weighting matrix where each timepoint receives weights according to a Mexican Hat wavelet centered at that timepoint. Useful for capturing temporal dynamics and transitions in correlations.

Parameters:
Tint

Number of timepoints in the timeseries

paramsdict, optional

Dictionary containing Mexican Hat parameters. Default: {‘sigma’: 10} - ‘sigma’ : float, scale parameter of the Mexican Hat wavelet

Returns:
numpy.ndarray

T x T matrix of Mexican Hat weights, where weights[i,j] represents the weight given to timepoint j when computing correlations at timepoint i

Examples

>>> import timecorr as tc
>>> weights = tc.mexican_hat_weights(50, {'sigma': 5})
>>> print(weights.shape)  # (50, 50)