New functions to calculate state lifetimes by counting frames#173
Merged
New functions to calculate state lifetimes by counting frames#173
Conversation
Refactor the function `mdtools.numpy_helper_functions.group_by`: * Use a stable sort when sorting the keys and values with respect to the keys. A stable sort keeps the relative order of equal elements. * Always check the input arguments. The `debug` argument is now without use. * Add examples to the docstring.
Create a new function `mdtools.dtrj.lifetimes` that calculates the lifetimes averaged over all compounds and all states by simply counting the number of frames a given compound stays in a given state.
Create a new function `mdtools.dtrj.lifetimes_per_state` that calculates the lifetime of each state in a discrete trajectory by simply counting the number of frames a given compound stays in a given state.
Add more information about how to calculate lifetimes from remain probabilities to the docstring of the function `mdtools.dtrj.remain_prob`.
Correct wrong comment in the Examples section of the docstring of the function `mdtools.dtrj.remain_prob_discrete`.
Extend the functionality of the function `mdtools.dtrj.lifetimes_per_states`: * Add a new argument `return_cmp_ix` that allows the user to return the compound indices associated with the returned lifetimes. * Add a new argument `discard_neg_start` that allows the user to discard lifetimes of negative states (like in the functions `mdtools.dtrj.remain_prob` and `mdtools.dtrj.remain_prob_discrete`). * Add a new argument `discard_all_neg` that allows the user to discard the lifetimes of all negative states and of all states that are followed by a negative state (like in the functions `mdtools.dtrj.remain_prob` and `mdtools.dtrj.remain_prob_discrete`).
Extend the functionality of the function `mdtools.dtrj.lifetimes`: * Add a new argument `return_states` that allows the user to return the state indices associated with the returned lifetimes. * Add a new argument `discard_neg_start` that allows the user to discard lifetimes of negative states (like in the functions `mdtools.dtrj.remain_prob` and `mdtools.dtrj.remain_prob_discrete`). * Add a new argument `discard_all_neg` that allows the user to discard the lifetimes of all negative states and of all states that are followed by a negative state (like in the functions `mdtools.dtrj.remain_prob` and `mdtools.dtrj.remain_prob_discrete`).
Replace the main body of the function `mdtools.dtrj.lifetimes_per_state` by a call of the function `mdtools.dtrj.lifetimes`.
This file contains hidden or 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
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.
New functions to calculate state lifetimes by counting frames
Type of change
Proposed changes
New features
mdtools.dtrj.lifetimesthat calculates the lifetimes for all compounds in all states of a discrete trajectory by simply counting the number of frames a given compound stays in a given state.mdtools.dtrj.lifetimes_per_statethat calculates the lifetime of each state in a discrete trajectory by simply counting the number of frames a given compound stays in a given state.Cod refactoring
mdtools.numpy_helper_functions.group_by:debugargument is now without use.Documentation update
Add more information about how to calculate lifetimes from remain probabilities to the docstring of the function
mdtools.dtrj.remain_prob.Correct a wrong comment in the Examples section of the docstring of the function
mdtools.dtrj.remain_prob_discrete.PR checklist