openpathsampling.SampleSet

class openpathsampling.SampleSet(samples, movepath=None)[source]

SampleSet is essentially a list of samples, with a few conveniences. It can be treated as a list of samples (using, e.g., .append), or as a dictionary of ensembles mapping to a list of samples, or as a dictionary of replica IDs to samples. Replica ID has to an integer but it can be negative or zero.

The dictionaries ensemble_dict and replica_dict are conveniences which should be kept consistent by any method which modifies the container. They do not need to be stored.

Note

Current implementation is as an unordered set. Therefore we don’t have some of the convenient tools in Python sequences (e.g., slices). On the other hand, I’m not sure whether that is meaningful here. Since replicas are integers we add slicing/ranges for replicas. In addition we support any iterable as input in __getitem__ an it will return an iterable over the results. This makes it possible to write sset[0:5] to get a list of of ordered samples by replica_id, or sset[list_of_ensembles]. replica_ids can be any number do not have to be subsequent to slicing does not make sense and we ignore it. We will also ignore missing replica_ids. A slice 1:5 will return all existing replica ids >=1 and <5. If you want exactly all replicas from 1 to 4 use sset[xrange(1,5)]

samples

The samples included in this set.

Type:

list of Sample

ensemble_dict

A dictionary with Ensemble objects as keys and lists of Samples as values.

Type:

dict

replica_dict

A dictionary with replica IDs as keys and lists of Samples as values

Type:

dict

__init__(samples, movepath=None)[source]

Methods

__init__(samples[, movepath])

all_from_ensemble(ensemble)

all_from_replica(replica)

append(sample)

append_as_new_replica(sample)

Adds the given sample to this SampleSet, with a new replica ID.

apply_samples(samples[, copy])

Update by setting samples by replica in the order given

args()

Return a list of args of the __init__ function of a class

base()

Return the most parent class actually derived from StorableObject

check_ensembles(ensembles)

Check for missing or extra ensembles in the sampleset

consistency_check()

Check that all internal dictionaries are consistent

copy_without_parents()

Return a copy of the sample set where all samples.parents are removed

count_weaks()

Return number of objects subclassed from StorableObject still in memory

descendants()

Return a list of all subclassed objects

ensemble_list()

Returns the list of ensembles in this SampleSet

extend(samples)

from_dict(dct)

Reconstruct an object from a dictionary representaiton

generate_from_trajectories(ensembles, ...[, ...])

Create a SampleSet with as many initial samples as possible.

get(k[,d])

get_uuid()

idx(store)

Return the index which is used for the object in the given store.

items()

keys()

map_trajectory_to_ensembles(trajectory, ...)

Return SampleSet mapping one trajectory to all ensembles.

objects()

Returns a dictionary of all storable objects

relabel_replicas_per_ensemble(ssets)

Return a SampleSet with one trajectory ID per ensemble in ssets

replica_list()

Returns the list of replicas IDs in this SampleSet

reverse_uuid()

ruuid(uid)

sanity_check()

Checks that the sample trajectories satisfy their ensembles

set_observer(active)

(De-)Activate observing creation of storable objects

to_dict()

Convert object into a dictionary representation

translate_ensembles(sset, new_ensembles)

Return SampleSet using new_ensembles as ensembles.

values()

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

ensembles

movepath

Descriptor class to handle proxy objects in attributes

observe_objects

replicas