mathematics
A module containing mathematical functions
- MDMC.common.mathematics.correlation(input1, input2=None, normalise=False) ndarray[source]
The correlation of two vectors
The Fast Correlation Algorithm (FCA) is utilised. If only a single input is provided, the autocorrelation is calculated.
- Parameters:
input1 (numpy.ndarray) – A 1D
arrayof data.input2 (numpy.ndarray, optional) – A 1D
arrayof data. If None, autocorrelation ofinput1is calculated. Default is None.normalise (bool, optional) – If True, the correlation is normalised at each point to the number of contributions to that point. Default is False.
- Returns:
A 1D
arrayof the same length as theinput1containing the correlation betweeninput1andinput2(or autocorrelation ofinput1ifinput2is None)- Return type:
- MDMC.common.mathematics.faster_autocorrelation(input1: ndarray, weights: ndarray | float = None) ndarray[source]
The autocorrelation of a vector.
The Fast Correlation Algorithm (FCA) is utilised.
- Parameters:
input1 (numpy.ndarray) – A 1D
arrayof data.- Returns:
A 1D
arrayof the same length as theinput1containing the correlation betweeninput1andinput2(or autocorrelation ofinput1ifinput2is None)- Return type:
- MDMC.common.mathematics.faster_correlation(input1, input2) ndarray[source]
The correlation of two vectors.
The Fast Correlation Algorithm (FCA) is utilised.
- Parameters:
input1 (numpy.ndarray) – A 1D
arrayof data.input2 (numpy.ndarray, optional) – A 1D
arrayof data. If None, autocorrelation ofinput1is calculated. Default is None.
- Returns:
A 1D
arrayof the same length as theinput1containing the correlation betweeninput1andinput2(or autocorrelation ofinput1ifinput2is None)- Return type: