sarkas.utilities.maths.correlationfunction
sarkas.utilities.maths.correlationfunction#
- sarkas.utilities.maths.correlationfunction(At, Bt)[source]#
Calculate the correlation function between \(\mathbf{A}(t)\) and \(\mathbf{B}(t)\) using
scipy.signal.correlate()
\[C_{AB}(\tau) = \sum_j^D \sum_i^T A_j(t_i)B_j(t_i + \tau)\]where \(D\) is the number of dimensions and \(T\) is the total length of the simulation.
- Parameters
At (numpy.ndarray) – Observable to correlate.
Bt (numpy.ndarray) – Observable to correlate.
- Returns
full_corr (numpy.ndarray) – Correlation function \(C_{AB}(\tau)\)
Examples
>>> import numpy as np >>> t = np.linspace( 0.0, 6.0 * np.pi, 3000) >>> w0 = 0.5 >>> At = np.cos(w0 * t) >>> Bt = np.sin(w0 * t) >>> corr_t = correlationfunction(At, Bt)