OpenMPCD
|
General class for analyzing autocorrelations. More...
Public Member Functions | |
def | __init__ (self, maxCorrelationTime) |
def | getMaxCorrelationTime (self) |
def | correlationTimeIsAvailable (self, correlationTime) |
def | getAutocorrelation (self, correlationTime) |
def | addDatum (self, datum, multiplicator=None) |
def | getMPLAxes (self, showEstimatedStandardDeviation=True) |
General class for analyzing autocorrelations.
Analysis class for autocorrelation of data. Let \f$ X \left( t \right) \f$ be a function of time \f$ t \f$, which is known at evenly-spaced points in time; that is, one knows \f$ X_n = X \left( n \Delta t \right) \f$ for \f$ n \in \left[0, n_{\textrm{max}} \right] \f$. This class calculates the autocorrelation function \f[ C \left( N \right) = \left< X \left( 0 \right) \cdot X \left( N \Delta t \right) \right> = \frac{1}{n_{\textrm{max}} + 1 - N} \sum_{i = 0}^{n_{\textrm{max}} - N} X_i X_{i + N} \f] for arbitrary \f$ N \in \left[0, N_{\textrm{max}} \right] \f$, where \f$ N_{\textrm{max}} \f$ is specified upon construction of an instance of this class. The argument \f$ N \f$ to the autocorrelation function will be called "correlation time" in the context of this class. It is measured in units of \f$ \Delta t \f$.
Definition at line 29 of file Autocorrelation.py.
def MPCDAnalysis.Autocorrelation.Autocorrelation.__init__ | ( | self, | |
maxCorrelationTime | |||
) |
The constructor. @throw TypeError Throws if any of the arguments have invalid types. @throw ValueError Throws if any of the arguments have invalid values. @param[in] maxCorrelationTime The maximal correlation time to measure, \f$ N_{\textrm{max}} \f$, which must be a non-negative `int`.
Definition at line 44 of file Autocorrelation.py.
def MPCDAnalysis.Autocorrelation.Autocorrelation.addDatum | ( | self, | |
datum, | |||
multiplicator = None |
|||
) |
Supplies a new datum \f$ X_i \f$, where \f$ i \f$ is implied to be the number of times `addDatum` has been called previously. @param[in] datum The datum to add, which must be compatible with the `multiplicator`. @param[in] multiplicator A callable that takes two variables, let them be called \f$ X_i \f$ and \f$ X_j \f$, which are of the type that `datum` is an instance of, and returns their product \f$ X_i \cdot X_j \f$ as a type that is compatible with `OnTheFlyStatisticsDDDA.addDatum`. If `None` is given, the default multiplication operator (`datum.__mul__`) is used. No guarantee is given regarding the order of the operands of the multiplication operator.
Definition at line 159 of file Autocorrelation.py.
def MPCDAnalysis.Autocorrelation.Autocorrelation.correlationTimeIsAvailable | ( | self, | |
correlationTime | |||
) |
Returns whether enough data have been supplied for there to be data on the correlation function with the given correlation time \f$ N \f$. One needs to supply at least \f$ N + 1 \f$ data points before one can query the correlation function for \f$ N \f$. @throw TypeError Throws if any of the arguments have invalid types. @throw ValueError Throws if any of the arguments have invalid values. @param[in] correlationTime The correlation time \f$ N \f$ as an `int` in the range `[0, self.getMaxCorrelationTime()]`.
Definition at line 89 of file Autocorrelation.py.
def MPCDAnalysis.Autocorrelation.Autocorrelation.getAutocorrelation | ( | self, | |
correlationTime | |||
) |
Returns an `OnTheFlyStatisticsDDDA` object that holds information on the sample of measured autocorrelations \f$ C \left( N \right) \f$ for the given correlation time `correlationTime`, \f$ N \f$. @throw TypeError Throws if any of the arguments have invalid types. @throw ValueError Throws if any of the arguments have invalid values. @throw ValueError Throws if `not self.correlationTimeIsAvailable(correlationTime)`. @param[in] correlationTime The correlation time \f$ N \f$ to return results for, as an `int` in the range `[0, self.getMaxCorrelationTime()]`. Also, `self.correlationTimeIsAvailable(correlationTime)` must return `True` for this call to be valid.
Definition at line 123 of file Autocorrelation.py.
def MPCDAnalysis.Autocorrelation.Autocorrelation.getMaxCorrelationTime | ( | self | ) |
Returns the maximal correlation time \f$ N_{\textrm{max}} \f$.
Definition at line 67 of file Autocorrelation.py.
def MPCDAnalysis.Autocorrelation.Autocorrelation.getMPLAxes | ( | self, | |
showEstimatedStandardDeviation = True |
|||
) |
Returns an `matplotlib.axes.Axes` object that plots the autocorrelation function against the correlation time. @throw TypeError Throws if any of the arguments have invalid types. @throw ValueError Throws if any of the arguments have invalid values. @param[in] showEstimatedStandardDeviation Whether to show, for each data point, the estimated standard deviation.
Definition at line 192 of file Autocorrelation.py.