trajectory_verification#

Attributes#

Functions#

check_shnitsel_trajectory_data(trajectory[, report])

Function to check whether all required and only denoted optional variables and meta information is available

verify_trajectory_format(obj[, asserted_properties])

Verify whether the data in obj has all required properties of a ShnitselTools trajectory.

is_permitted_traj_result(obj)

Check the type returned by the read() function.

has_required_properties(traj[, asserted_properties])

Function to check whether a certain set of properties is set on the trajectory

Module Contents#

_required_shnitsel_variables = ['energy', 'time', 'delta_t', 't_max', 'max_ts']#
_optional_shnitsel_variables = ['atXYZ', 'nacs', 'dip_perm', 'dip_trans', 'forces', 'socs', 'state_names', 'state_types',...#
_required_shnitsel_attributes = ['input_format', 'input_format_version', 'input_type', 'completed', 'num_singlets',...#
_optional_shnitsel_attributes = ['has_forces', 'DataTree_Level', 'trajectory_input_path', 'trajid', '__original_dataset',...#
check_shnitsel_trajectory_data(trajectory, report=False)#

Function to check whether all required and only denoted optional variables and meta information is available on a shnitsel-loaded trajectory.

Parameters:
  • trajectory (Frames | Trajectory | xr.Dataset) – The trajectory to check for the presence of variables and settings

  • report (bool, optional) – Whether to raise an error if discrepancies were found. Defaults to False.

Raises:

ValueError – If missing variables or attributes or unexpected variables or attributes are encountered in the provided trajectory and report=True is set.

Returns:

  • tuple[set[str], set[str], set[str], set[str]] – The sets of missing required variables, present unexpected variables, missing required attributes and present unexpected attributes.

  • None – No discrepancies found.

Return type:

tuple[set[str], set[str], set[str], set[str]] | None

verify_trajectory_format(obj, asserted_properties=None)#

Verify whether the data in obj has all required properties of a ShnitselTools trajectory.

Parameters:
  • obj (Any) – Either a read trajectory (Trajectory|Frames|xr.Dataset) or a Tree structure with the appropriate entries in its data nodes.

  • asserted_properties (List[str] | None, optional) – The list of keys that are required to be in the trajectory, by default None

Returns:

True if the format is as asserted.

Return type:

bool

is_permitted_traj_result(obj)#

Check the type returned by the read() function.

Parameters:

obj (Any) – The object returned by read.

Returns:

Whether the type is in agreement with the intended type model

Return type:

bool

has_required_properties(traj, asserted_properties=None)#

Function to check whether a certain set of properties is set on the trajectory

Parameters:
  • traj (List[Trajectory] | Trajectory) – The parsed Trajectory object(s)

  • asserted_properties (List[str] | None, optional) – The keys of properties that are required to be set on the trajectory, by default None

Returns:

Whether all properties were present.

Return type:

bool