timecorr.gaussian_weights#
- timecorr.gaussian_weights(T, params={'var': 100})[source]#
Generate Gaussian weighting function for dynamic correlations.
This function creates a time-varying weighting matrix where each timepoint receives weights according to a Gaussian distribution centered at that timepoint. Useful for computing smooth dynamic correlations.
- Parameters:
- Tint
Number of timepoints in the timeseries
- paramsdict, optional
Dictionary containing Gaussian parameters. Default: {‘var’: 100} - ‘var’ : float, variance of the Gaussian kernel
- Returns:
- numpy.ndarray
T x T matrix of Gaussian 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.gaussian_weights(50, {'var': 10}) >>> print(weights.shape) # (50, 50)