Skip to content

Instantly share code, notes, and snippets.

@astatide
Created June 25, 2015 20:22
Show Gist options
  • Save astatide/e751b38c869f477ee637 to your computer and use it in GitHub Desktop.
Save astatide/e751b38c869f477ee637 to your computer and use it in GitHub Desktop.
w_select predicate function
# For use with w_select.py, part of the WESTPA west_tools package
# Thanks to Ali Sinan Saglam
def predicate(n_iter, iter_group):
pcoord = iter_group['pcoord']
collection = []
# Iterate over the segments
for iseg,seg in enumerate(pcoord):
# seg should return the pcoord array for every timepoint.
# If your pcoord is N dimensional, be sure to return the appropriate dimension
# seg[timepoint,dimension]
# Check the final timepoint for some logic; in this case, is our final pcoord timepoint
# over 5.0?
if seg[-1,0] > 5.0:
collection.append(iseg)
return collection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment