timecorr.laplace_weights#
- timecorr.laplace_weights(T, params={'scale': 100})[source]#
Generate Laplace (exponential) weighting function for dynamic correlations.
This function creates a time-varying weighting matrix where each timepoint receives weights according to a Laplace distribution centered at that timepoint. Provides sharper temporal localization compared to Gaussian weights.
- Parameters:
- Tint
Number of timepoints in the timeseries
- paramsdict, optional
Dictionary containing Laplace parameters. Default: {‘scale’: 100} - ‘scale’ : float, scale parameter of the Laplace distribution
- Returns:
- numpy.ndarray
T x T matrix of Laplace 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.laplace_weights(50, {'scale': 5}) >>> print(weights.shape) # (50, 50)