Robust Equilibration Detection
Project description
Robust Equilibration Detection
A Python package for detecting equilibration in time series where an initial transient is followed by a stationary distribution. Two main approaches are implemented, which differ in the way they account for autocorrelation:
detect_equilibration_init_seq: This uses the initial sequence methods of Geyer (Geyer, 1992) to determine the truncation point of the sum of autocovariances. Chodera's method (Chodera, 2016) of simply truncating the autocovariance series at the first negative value is also implemented.detect_equilibration_window: This uses window methods (see Geyer again) when calculating the autocorrelation. Setting the window size to 1 will give you White's original Marginal Standard Error Rule (White, 1997).
For both, the equilibration point can be determined either according to the minimum of the squared standard error (the default), or the maximum effective sample size, by specifying method="min_sse" or method="max_ess".
For testing and more details, please see the associated publication: Clark, F.; Cole, D. J.; Michel, J. Robust Automated Truncation Point Selection for Molecular Simulations. J. Chem. Theory Comput. 2024. https://doi.org/10.1021/acs.jctc.4c01359.
Installation
The easiest way to install red is using conda (or mamba) (note that the conda-forge/ PyPI name is red-molsim to avoid conflicts):
conda install -c conda-forge red-molsim
Alternatively, you can install red from the Python Package Index (PyPI) using pip:
pip install red-molsim
Usage
Warning: red will work with multi-run data, but has only been thoroughly tested with single-run data. Using multi-run data is likely to be more robust, but we have not verified this.
Equilibration Detection
import red
# Load your timeseries of interest.
# This should be a 2D numpy array with shape (n_runs, n_samples),
# or a 1D numpy array with shape (n_samples).
my_timeseries = ...
# Detect equilibration based on the minimum squared standard error using
# using the window method with a Bartlett kernel with a window size of
# round(n_samples**0.5) to account for autocorrelation. idx is the index
# of the first sample after equilibration, g is the statistical
# inefficiency of the equilibrated sample, and ess is the effective sample
# size of the equilibrated sample.
idx, g, ess = red.detect_equilibration_window(my_timeseries,
method="min_sse",
plot=True)
# Alternatively, use Geyer's initial convex sequence method to account
# for autocorrelation.
idx, g, ess = red.detect_equilibration_init_seq(my_timeseries,
method="min_sse",
plot=True)
# We can also determine equilibration in the same way as in
# pymbar.timeseries.detect_equilibration(my_timeseries, fast=False)
idx, g, ess = red.detect_equilibration_init_seq(my_timeseries,
method="max_ess",
sequence_estimator="positive")
Uncertainty Quantification
# Estimate the 95 % confidence interval, accounting for autocorrelation using Geyer's initial
# convex sequence method.
ci_95 = red.get_conf_int_init_seq(my_timeseries, alpha_two_tailed=0.05)
For more examples, see the documentation.
Copyright
Copyright (c) 2023, Finlay Clark
Acknowledgements
Project based on the Computational Molecular Science Python Cookiecutter version 1.1, with several ideas (Makefile, documentation) borrowed from Simon Boothroyd's super helpful python-template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file red_molsim-0.1.4.tar.gz.
File metadata
- Download URL: red_molsim-0.1.4.tar.gz
- Upload date:
- Size: 151.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7adb6972d9d147e5608ad91d73c33258e36cd08b7b6e696b07de18555484930e
|
|
| MD5 |
5cea9c975a5b6dda9e0372c889cf22e6
|
|
| BLAKE2b-256 |
f90086efab77264672b4cd5828675af813a9d1085fc0930a530eff20439b5c7b
|
Provenance
The following attestation bundles were made for red_molsim-0.1.4.tar.gz:
Publisher:
pypi.yaml on fjclark/red
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
red_molsim-0.1.4.tar.gz -
Subject digest:
7adb6972d9d147e5608ad91d73c33258e36cd08b7b6e696b07de18555484930e - Sigstore transparency entry: 489640345
- Sigstore integration time:
-
Permalink:
fjclark/red@374413999a8c11e1d844669eb79534bf6efcaf6c -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/fjclark
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@374413999a8c11e1d844669eb79534bf6efcaf6c -
Trigger Event:
push
-
Statement type:
File details
Details for the file red_molsim-0.1.4-py3-none-any.whl.
File metadata
- Download URL: red_molsim-0.1.4-py3-none-any.whl
- Upload date:
- Size: 151.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
181d554e1e0f0b9d11f427f78080788622252337dceb0c85ca405179ddd7d3ae
|
|
| MD5 |
ab5915537819cb8c79f26fe75fe8f811
|
|
| BLAKE2b-256 |
f6eb9a8da295d26369746f2882ae9de425be2ecf507bb3c4d90713b3d60a6730
|
Provenance
The following attestation bundles were made for red_molsim-0.1.4-py3-none-any.whl:
Publisher:
pypi.yaml on fjclark/red
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
red_molsim-0.1.4-py3-none-any.whl -
Subject digest:
181d554e1e0f0b9d11f427f78080788622252337dceb0c85ca405179ddd7d3ae - Sigstore transparency entry: 489640386
- Sigstore integration time:
-
Permalink:
fjclark/red@374413999a8c11e1d844669eb79534bf6efcaf6c -
Branch / Tag:
refs/tags/0.1.4 - Owner: https://github.com/fjclark
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yaml@374413999a8c11e1d844669eb79534bf6efcaf6c -
Trigger Event:
push
-
Statement type: