shnitsel.data.tree.compound#

Attributes#

Classes#

CompoundInfo

Class to hold identifying and auxiliary info of a compound type in ShnitselDB

CompoundGroup

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

compound_name: str = 'unknown'#
compound_smiles: str | None = None#
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:
_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:

CompoundInfo

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:
Returns:

The restructured Compound with a new added group if at least one trajectory has satisfied the filter condition.

Return type:

CompoundGroup