Trajectory Traces

class TraceManager(trace_type='default', trace_args=[], trace_kwargs={})

Bases: object

Manage the collection of observables from a set of trajectories

__init__(trace_type='default', trace_args=[], trace_kwargs={}) None
spawn_tracer() Trace_

returns a Tracer object that will collect all of the observables for a given trajectory

merge_tracer(tracer: Trace_) None

accepts a Tracer object and adds it to list of traces

add_batch(traces: List[Trace_]) None

merge other manager into self

outcome() _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]

summarize outcomes from entire set of traces

counts() _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]

summarize outcomes from entire set of traces

event_list() List

return a list of all events logged

summarize(verbose: bool = False, file: ~typing.Any = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) None

print a summary of the traces

as_dict() Dict

return the object as a dictionary

class InMemoryTrace(weight: float = 1.0)

Bases: Trace_

Collect results from a single trajectory

Initialize the trace object.

Parameters:

weight (float, optional) – Statistical weight of the trajectory, by default 1.0

__init__(weight: float = 1.0)

Initialize the trace object.

Parameters:

weight (float, optional) – Statistical weight of the trajectory, by default 1.0

collect(snapshot: Any) None

collect and optionally process data

record_event(event_dict: Dict, event_type: str = 'hop')

Add a single event to the log.

Parameters:
  • event_dict (Dict) – Dictionary containing event data

  • event_type (str, optional) – Type of event, by default “hop”

as_dict() Dict
class YAMLTrace(base_name: str = 'traj', weight: float = 1.0, log_pitch=512, location='', load_main_log=None)

Bases: Trace_

Collect results from a single trajectory and write to yaml files

Initialize the trace object.

Parameters:

weight (float, optional) – Statistical weight of the trajectory, by default 1.0

__init__(base_name: str = 'traj', weight: float = 1.0, log_pitch=512, location='', load_main_log=None)

Initialize the trace object.

Parameters:

weight (float, optional) – Statistical weight of the trajectory, by default 1.0

files(absolute_path=True)

returns a list of all files associated with this trace

Parameters:

absolute_path – if True, returns the absolute path to the files, otherwise returns the relative path

Returns:

list of files

write_main_log()

Writes main log file, which points to other files for logging information

collect(snapshot: Any) None

collect and optionally process data

record_event(event_dict: Dict, event_type: str = 'hop')

Add a single event to the log.

Parameters:
  • event_dict (Dict) – Dictionary containing event data

  • event_type (str, optional) – Type of event, by default “hop”

clone()

Create a deep copy of the trace.

Returns:

Deep copy of the trace object

Return type:

YAMLTrace

as_dict() Dict

return the object as a dictionary