NarupaFrame

class narupatools.frame.frame.NarupaFrame(raw_frame: Optional[narupa.protocol.trajectory.frame_pb2.FrameData] = None)

Wrapper around a protobuf FrameData.

This subclass explicitly is an implementation of a mutable mapping between string keys and arbitrary values.

Inheritance

Inheritance diagram of NarupaFrame

Methods

__init__

Initialize self.

copy

get

Get the value for a given key, returning value if the key is not present.

get_float_value

Get a float value with a given key.

get_string_value

Get a string value with a given key.

items

Iterate over the keys and values of the Frame.

keys

Iterate over the keys of the Frame.

set_float_array

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

set_float_value

Set a single float value with the given key.

set_index_array

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

set_string_array

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

set_string_value

Set a single string value with the given key.

values

Iterate over the values of the Frame.

__init__(raw_frame: Optional[narupa.protocol.trajectory.frame_pb2.FrameData] = None)

Initialize self. See help(type(self)) for accurate signature.

copy()narupa.trajectory.frame_data.FrameData
get(key: narupatools.frame.fields.FrameKey[TFrom, TTo])TTo
get(key: narupatools.frame.fields.FrameKey[TFrom, TTo], value: Optional[TDefault] = None)Union[TTo, TDefault]
get(key: str, value: Optional[TDefault] = None)Any

Get the value for a given key, returning value if the key is not present.

Parameters
  • key – Key to lookup.

  • value – Default value to use if the key is absent.

Returns

The value for the given key if it is present, otherwise the default return value.

get_float_value(key: str)float

Get a float value with a given key.

Parameters

key – Key to lookup.

Returns

String value for the given key.

Raises

KeyError – Given key is absent in this frame.

get_string_value(key: str)str

Get a string value with a given key.

Parameters

key – Key to lookup.

Returns

String value for the given key.

Raises

KeyError – Given key is absent in this frame.

items()Generator[Tuple[str, Any], None, None]

Iterate over the keys and values of the Frame.

keys()Generator[str, None, None]

Iterate over the keys of the Frame.

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_float_value(key: str, value: SupportsFloat)None

Set a single float value with the given key.

Parameters
  • key – Key to set.

  • value – Value to set.

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.

set_string_value(key: str, value: Any)None

Set a single string value with the given key.

Parameters
  • key – Key to set.

  • value – Value to set.

values()Generator[Any, None, None]

Iterate over the values of the Frame.

Attributes

array_keys

bond_orders

bond_pairs

box_vectors

chain_count

chain_names

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

shortcuts

used_shortcuts

value_keys

array_keys
bond_orders: List[float]
bond_pairs: List[List[int]]
box_vectors: List[List[float]]
chain_count: int
chain_names: List[str]
kinetic_energy: float
particle_count: int
particle_elements: List[int]
particle_names: List[str]
particle_positions: List[List[float]]
particle_residues: List[int]
particle_types: List[str]
potential_energy: float
raw

Underlying GRPC/protobuf object.

residue_chains: List[int]
residue_count: int
residue_ids: List[int]
residue_names: List[str]
server_timestamp: float
shortcuts
used_shortcuts
value_keys