shnitsel.data.shnitsel_db.db_trajectory_group

Attributes

T

Classes

GroupInfo

Class to hold auxiliaryt info of a group of Trajectories in ShnitselDB

TrajectoryGroup

DataTree node to keep track of a group of trajectories where properties defining the group can be set

Module Contents

T
class GroupInfo

Class to hold auxiliaryt info of a group of Trajectories in ShnitselDB

group_name: str
group_attributes: Dict[str, Any] | None = None
class TrajectoryGroup(group_info=None, children=None)

Bases: xarray.DataTree

DataTree node to keep track of a group of trajectories where properties defining the group can be set

Parameters:
is_level(target_level)

Check whether we are at a certain level

Parameters:

target_level (str) – Desired level to check for

Returns:

True if this level satisfies the requirements

Return type:

bool

get_group_info()

Reconstruct the Group info object from settings stored in this node’s attributes

Returns:

The group information

Return type:

GroupInfo

collect_trajectories()

Function to retrieve all trajectories in this subtree

Returns:

List of all nodes with TrajectoryData type

Return type:

List[TrajectoryData]

map_over_trajectories(map_func, result_as_dict=False, result_var_name='result')

Method to apply a function to all trajectories in this subtree.

Parameters:
  • map_func (Callable[[Trajectory], T]) – Function to be applied to each individual trajectory in this database structure.

  • result_as_dict (bool, optional) – Whether to return the result as a dict or as a TrajectoryGroup structure. Defaults to False which yields a CompoundGroup.

  • result_var_name (str,optional) – The name of the result variable to be assigned in either the result dataset or in the result dict.

Returns:

The result, either again as a TrajectoryGroup structure or as a layered dict structure.

Return type:

TrajectoryGroup|dict

merge_with(other)

Function to merge two TrajectoryGroups into one.

Called when merging two database states. Will fail if group_info differs between compounds to avoid loss of information.

Parameters:

other (CompoundGroup) – The other CompoundGroup to be merged

Raises:

ValueError – Raised if the compound_info differs.

Returns:

A CompoundGroup object holding the entire merged subtree

Return type:

CompoundGroup