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
array
of data.input2 (numpy.ndarray, optional) – A 1D
array
of data. If None, autocorrelation ofinput1
is 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
array
of the same length as theinput1
containing the correlation betweeninput1
andinput2
(or autocorrelation ofinput1
ifinput2
is 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
array
of data.- Returns:
A 1D
array
of the same length as theinput1
containing the correlation betweeninput1
andinput2
(or autocorrelation ofinput1
ifinput2
is 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
array
of data.input2 (numpy.ndarray, optional) – A 1D
array
of data. If None, autocorrelation ofinput1
is calculated. Default is None.
- Returns:
A 1D
array
of the same length as theinput1
containing the correlation betweeninput1
andinput2
(or autocorrelation ofinput1
ifinput2
is None)- Return type: