FrameKey

class narupatools.frame.fields.FrameKey(key: str)

Key that can be placed in a Narupa FrameData, such as positions or potential energy.

This allows custom keys to be more easily defined, instead of the hardcoded shortcuts of the original Narupa FrameData.

Inheritance

Inheritance diagram of FrameKey

Methods

__init__

Initialize self.

get

Get the value of the given frame data for this key.

get_with_default

Get the value for this key, returning a default value if the key is absent.

set

Insert the value into the given frame data for this key.

__init__(key: str)

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

get(frame_data: narupa.trajectory.frame_data.FrameData, /, *, calculate: bool = False)_TTo

Get the value of the given frame data for this key.

Parameters
  • frame_data – FrameData to lookup.

  • calculate – Calculate the value based on other keys available.

Raises

KeyError – Given key is not available.

get_with_default(frame_data: narupa.trajectory.frame_data.FrameData, /, default: _TDefault, *, calculate: bool = False)Union[_TTo, _TDefault]

Get the value for this key, returning a default value if the key is absent.

Parameters
  • frame_data – FrameData to look up key in.

  • default – Default value to return if absent.

  • calculate – Calculate the value based on other keys available.

abstract set(frame_data: narupa.trajectory.frame_data.FrameData, value: _TFrom)None

Insert the value into the given frame data for this key.

Parameters
  • frame_data – FrameData to modify.

  • value – Value to insert.