openpathsampling.snapshot_modifier.SnapshotModifier
- class openpathsampling.snapshot_modifier.SnapshotModifier(subset_mask=None)[source]
Abstract class for snapshot modification.
In general, a snapshot modifer will take a snapshot and return a modified version of that snapshot. These are useful for, e.g., two-way shooting or for committor analysis.
- subset_mask
the subset to use (default None, meaning use all). The values select along the first axis of the input array. For example, in a typical shape=(n_atoms, 3) array, this will pick the atoms.
- Type:
list of int or None
Note
It is tempting to use the various indexing tricks in numpy to get a view on the data, instead of using this subset_mask. However, this can be dangerous: note that fancy indexing copies the data, whereas normal indexing returns a proper view. See http://stackoverflow.com/a/4371049. Rather than play with fire here, we’ll just do something straightforward. We can try something more clever in the future.
Methods
__init__
([subset_mask])apply_to_subset
(full_array, modified[, ...])Replaces elements of full_array according to the subset mask
args
()Return a list of args of the __init__ function of a class
base
()Return the most parent class actually derived from StorableObject
count_weaks
()Return number of objects subclassed from StorableObject still in memory
descendants
()Return a list of all subclassed objects
extract_subset
(full_array[, subset])Extracts elements from full_array according to self.subset_mask
fix_name
()Set the objects name to be immutable.
from_dict
(dct)Reconstruct an object from a dictionary representaiton
get_uuid
()idx
(store)Return the index which is used for the object in the given store.
named
(name)Name an unnamed object.
objects
()Returns a dictionary of all storable objects
probability_ratio
(old_snapshot, new_snapshot)Only here for backwards compatability, will raise in the future
reverse_uuid
()ruuid
(uid)set_observer
(active)(De-)Activate observing creation of storable objects
to_dict
()Convert object into a dictionary representation
Attributes
ACTIVE_LONG
CREATION_COUNT
INSTANCE_UUID
base_cls
Return the base class
base_cls_name
Return the name of the base class
cls
Return the class name as a string
default_name
Return the default name.
is_named
True if this object has a custom name.
name
Return the current name of the object.
observe_objects