shnitsel.data.tree.compound#
Attributes#
Classes#
Class to hold identifying and auxiliary info of a compound type in ShnitselDB |
|
DataTree node to keep track of all data associated with a common compound within the datatree |
Module Contents#
- DataType#
- ResType#
- NewChildType#
- class CompoundInfo#
Class to hold identifying and auxiliary info of a compound type in ShnitselDB
- class CompoundGroup(*, name=None, compound_info=None, group_info=None, children=None, level_name=None, attrs=None, **kwargs)#
Bases:
Generic[DataType],shnitsel.data.tree.data_group.DataGroup[DataType]DataTree node to keep track of all data associated with a common compound within the datatree
- Parameters:
name (str | None)
compound_info (CompoundInfo | None)
group_info (shnitsel.data.tree.data_group.GroupInfo | None)
children (Mapping[Hashable, shnitsel.data.tree.data_group.DataGroup[DataType] | shnitsel.data.tree.data_leaf.DataLeaf[DataType]] | None)
level_name (str | None)
attrs (Mapping[str, Any] | None)
- _compound_info: CompoundInfo#
- construct_copy(children: Mapping[Hashable, DataGroup[DataType] | DataLeaf[DataType]] | None = None, dtype: None = None, data: DataType | None = None, **kwargs) Self#
- construct_copy(children: None = None, dtype: type[ResType] | types.UnionType | None = None, data: ResType | None = None, **kwargs) CompoundGroup[ResType]
- construct_copy(children: Mapping[Hashable, NewChildType] | None = None, dtype: type[ResType] | types.UnionType | None = None, data: None = None, **kwargs) CompoundGroup[ResType]
Helper function to create a copy of this tree structure, but with potential changes to metadata, data or children
Parameters:#
- data: None, optional
Data setting not supported on this type of node.
- children: Mapping[Hashable, CompoundGroup[ResType]], optional
The mapping of children with a potentially new DataType. If not provided, will be copied from the current node’s child nodes.
- dtype: type[ResType] | TypeForm[ResType], optional
The data type of the data in the copy constructed tree.
- raises AssertionError:
If dtype is provided but children parameter not set and node has children, indicating an issue with a type update without setting the new children
- raises Returns::
- raises ———–:
Self: A copy of this node with recursively copied children if children is not set with an appropriate mapping.
- property compound_info: CompoundInfo#
Get the stored compound info of this Compound group.
- Returns:
The metadata for the compound in this compound group
- Return type:
- add_data_group(group_info, filter_func_data=None, flatten_data=False, **kwargs)#
Function to add trajectories within this compound subtree to a TrajectoryGroup of trajectories.
The group_name will be set as the name of the group in the tree. If flatten_trajectories=True all existing groups will be dissolved before filtering and the children will be turned into an ungrouped list of trajectories. The filter_func_trajectories will either be applied to only the current groups and trajectories immediately beneath this compound or to the flattened list of all child directories.
- Parameters:
group_name (str) – The name to be set for the TrajectoryGroup object
filter_func_Trajectories (Callable[[Trajectory|GroupInfo], bool] | None, optional) – A function to return true for Groups and individual trajectories that should be added to the new group. Defaults to None.
flatten_trajectories (bool, optional) – A flag whether all descendant groups should be dissolved and flattened into a list of trajectories first before applying a group. Defaults to False.
group_info (shnitsel.data.tree.data_group.GroupInfo)
filter_func_data (Callable[[shnitsel.data.tree.data_group.DataGroup | shnitsel.data.tree.data_leaf.DataLeaf], bool] | None)
- Returns:
The restructured Compound with a new added group if at least one trajectory has satisfied the filter condition.
- Return type: