-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate artificial discrete trajectories for testing purposes #177
Merged
andthum
merged 97 commits into
main
from
feat/misc/generate-artificial-discrete-trajectroy
Oct 13, 2023
Merged
Generate artificial discrete trajectories for testing purposes #177
andthum
merged 97 commits into
main
from
feat/misc/generate-artificial-discrete-trajectroy
Oct 13, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a script that generates an artificial discrete trajectory with a given number of states with a given lifetime distribution. This script was written to test different methods to calculate state lifetimes from discrete trajectories (specifically `mdtools.dtrj.lifetimes`, `mdtools.dtrj.trans_rate`, `mdtools.dtrj.remain_prob`).
New Feature: * If requested, plot a histogram of the lifetimes drawn from the exponential distribution. Refactoring: * If the lifetime drawn from the exponential distribution is zero, select another state. * Change dtype of the generated discrete trajectory from `numpy.uint32` to `numpy.uint8`. * Decrease memory footprint by avoiding generating longer trajectories than necessary.
Convert number of transitions to `np.int64` to avoid `ZeroDivisionError` when the total number of transitions is zero and instead return `np.inf`.
Create a script that compares state lifetimes calculated from a discrete trajectory using different methods.
Read remain probabilities from a file as created by `scripts.discretization.state_lifetime_discrete` rather than calculating them on the fly, because for long discrete trajectories this can take a long time.
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
from
July 24, 2023 10:57
b80d5d5
to
5ad4501
Compare
Introduce a time conversion factor to convert from "trajectroy steps" to a physical time unit (like ns).
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
3 times, most recently
from
July 26, 2023 13:33
563f8ee
to
d5a89df
Compare
Instead of sampling the lifetimes from an exponential distribution, sample the lifetimes from the more general gamma distribution.
Instead of an exponential distribution assume a more general gamma distribution for the true lifetimes.
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
2 times, most recently
from
July 26, 2023 15:17
37f6392
to
f9410a4
Compare
Add the command-line option `--param-out` that allows the user to save the parameters that were used to generate the artificial discrete trajectory to file.
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
from
July 26, 2023 16:03
f9410a4
to
9757cb0
Compare
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
4 times, most recently
from
August 2, 2023 12:35
1aedfbb
to
f051837
Compare
Create a script that plots the PDF, CDF, Survival function and Hazard function of the generalized gamma distribution for a given set of shape and scale parameters.
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
from
October 5, 2023 09:19
b79a1da
to
e87d895
Compare
Instead of calculating the first and second raw moment for each method, calculate the * (Sample) mean * (Corrected sample) standard deviation * (Unbiased sample) skewness * (Unbiased sample) excess kurtosis (according to Fisher) * (Sample) median
Adopt `mdtools/misc/dtrj_lifetimes/plot_lifetimes.py` to the changed output of `mdtools/misc/dtrj_lifetimes/compare_dtrj_lifetime_methods.py`.
Add a new command-line option `--adjacent` to the script `misc/dtrj_lifetimes/generate_dtrj.py` that allows the user to specify that the next randomly selected state must be a neighbor of the previous state.
Add example commands to the notes section to generate artificial trajectories that resemble true discrete trajectories from my work.
This reverts commit 8e2e8c2.
Add an example to the notes section for creating a long trajectory that can be used to generate sub-trajectories that contain only every n-th frame.
…onv` Add a new command-line option `--time-conv` that allows the user to specify a time conversion factor. All times are multiplied by the given factor.
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
4 times, most recently
from
October 13, 2023 09:21
18ff653
to
99c8e5c
Compare
Support plotting lifetimes as function of the sampling interval/frequency of the trajectory.
Add the skewness and kurtosis of the exponential distribution to the respective plots as reference.
Calculate the uncertainty (standard error) of the sample mean for count-based methods and write it to the text output file and plot it as errorbar in the lifetime plot.
Fix explanation of the content of column 52 (end of fit region is inclusive not exclusive).
Adopt the script `plot_lifetimes.py` to the changes made in the script `compare_dtrj_lifetime_methods.py`.
Additionally to the log plot of the skewness and kurtosis, plot both quantities on a linear scale.
…-Dist. Remove the reference to the skewness and kurtosis of the exponential distribution in the respective plots, because the skewness and kurtosis of the true lifetime distribution is already contained in the plot.
Remove the reference to the skewness and kurtosis of the exponential distribution in the respective plots, because the skewness and kurtosis of the true lifetime distribution is already contained in the plot.
Update the notes section about generating artificial discrete trajectories that resemble true discrete trajectories.
andthum
force-pushed
the
feat/misc/generate-artificial-discrete-trajectroy
branch
from
October 13, 2023 13:54
99c8e5c
to
ab551a0
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Generate artificial discrete trajectories for testing purposes
Type of change
Proposed changes
Bug fixes
ZeroDivisionError
in the functionmdtools.run_time_info.dtrj_trans_info_str
when the total number of state transitions is zero. Returnnp.inf
in this case.New features
Create a script
misc/dtrj_lifetimes/plot_gengamma.py
that plots the PDF, CDF, survival function and hazard function of the generalized gamma distribution or the Burr Type XII for a given set of shape and scale parameters.Create a new script
misc/dtrj_lifetimes/generate_dtrj.py
that generates an artificial discrete trajectory with a given number of states with a given lifetime distribution. This script was written to test different methods to calculate state lifetimes from discrete trajectories (specificallymdtools.dtrj.lifetimes
,mdtools.dtrj.trans_rate
,mdtools.dtrj.remain_prob
).Create a new script
misc/dtrj_lifetimes/compare_dtrj_lifetime_methods.py
that compares state lifetimes calculated from a discrete trajectory using different methods (mdtools.dtrj.lifetimes
,mdtools.dtrj.trans_rate
,mdtools.dtrj.remain_prob
).Create a new script
misc/dtrj_lifetimes/plot_lifetimes.py
that plots the lifetimes generated bymisc/dtrj_lifetimes/compare_dtrj_lifetime_methods.py
.Create a new function
mdtools.statistics.moment_raw2cen
that calculates the n-th central moment from the first n raw moments.Add a new argument
uncensored
to the functionsmdtools.dtrj.lifetimes
andmdtools.dtrj.lifetimes_per_state
that allows the user to specify whether to discard the states at the beginning and end of the trajectory.Maintenance
CI Workflow (
tests.yml
): InstallCython
andNumPy
beforeMDAnalysis
(see MAINT: Cython 3.x compat fix read-only MDAnalysis/mdanalysis#4129 and ndarray.base: Assignment to a read-only property cython/cython#3690).CI Workflow: Skip three doctests of the function
mdtools.dtrj.trans_rate_per_state
when running on a Linux system with Python version 3.9, because these examples sometimes fail during the GitHub CI workflow for this specific OS-Python combination. This seems somehow related to caching but couldn't be resolved so far.PR checklist