narupa.trajectory.frame_data module

class narupa.trajectory.frame_data.ArraysView(raw)

Bases: narupa.trajectory.frame_data.RecordView

Give access to homogeneous arrays from a FrameData.

record_name = 'arrays'
set(key, value)
singular = 'array'
class narupa.trajectory.frame_data.FrameData(raw_frame: narupa.protocol.trajectory.frame_pb2.FrameData = None)

Bases: object

Wrapper around the GRPC FrameData.

A FrameData contains two kinds of records: single values of any type, or homogeneous arrays. The former kind can be accessed through the values attribute, while the later is accessible through the arrays one. Both attribute behave like a dictionary. Trying to access a key that does not exist raises a KeyError.

The set of keys with data in the frame is listed by value_keys() and array_keys().

The most common frame properties are accessible as attribute in a normalized format. Shortcuts are not guaranteed to contain data. Trying to access a shortcut that does not contain data raises a MissingDataError that can also be caught as a KeyError.

The available shortcuts can be listed using the shortcuts property. The set of shortcuts that contain data is available from the used_shortcuts.

array_keys
bond_orders
bond_pairs
box_vectors
chain_count
chain_names
copy()
kinetic_energy
particle_count
particle_elements
particle_names
particle_positions
particle_residues
particle_types
potential_energy
raw

Underlying GRPC/protobuf object.

residue_chains
residue_count
residue_ids
residue_names
server_timestamp
set_float_array(key, value)

Set an homogeneous array of floats in an existing or a new key.

Parameters:
  • key – The key under which to store the array.
  • value – The array to store.
set_index_array(key, value)

Set an homogeneous array of indices in an existing or a new key.

Parameters:
  • key – The key under which to store the array.
  • value – The array to store.
set_string_array(key, value)

Set an homogeneous array of strings in an existing or a new key.

Parameters:
  • key – The key under which to store the array.
  • value – The array to store.
shortcuts
used_shortcuts
value_keys
exception narupa.trajectory.frame_data.MissingDataError

Bases: KeyError

A shortcut does not contain data to return.

class narupa.trajectory.frame_data.RecordView(raw)

Bases: object

Base class that wraps the access to a kind of record.

This class needs to be subclassed.

delete(key)
get(key, default=None)
keys() → collections.abc.Set
record_name = None
set(key, value)
singular = None
class narupa.trajectory.frame_data.ValuesView(raw)

Bases: narupa.trajectory.frame_data.RecordView

Give access to singular values from a FrameData.

record_name = 'values'
set(key, value)
singular = 'value'