shnitsel.data.dataset_containers.per_state#

Classes#

PerState

Definition of the protocol to support instantiation from

Module Contents#

class PerState(frames=None, /, direct_perstate_data=None)#

Bases: shnitsel.data.dataset_containers.shared.ShnitselDerivedDataset

Definition of the protocol to support instantiation from xarray dataset structs.

Parameters:
_original_frames: shnitsel.data.dataset_containers.data_series.DataSeries | None#
property energy: xarray.DataArray#
Return type:

xarray.DataArray

property dipole_permanent: xarray.DataArray#
Return type:

xarray.DataArray

property dipole_permanent_norm: xarray.DataArray#
Return type:

xarray.DataArray

property forces: xarray.DataArray#
Return type:

xarray.DataArray

property forces_norm: xarray.DataArray#
Return type:

xarray.DataArray

property forces_format: bool | Literal['all', 'active_only'] | None#
Return type:

bool | Literal[‘all’, ‘active_only’] | None

as_xr_dataset()#

Base function to implement by classes supporting this protocol to allow for standardized conversion to a dataset

Returns:

A tuple of the io_type_tag under which the deserializer is registered with the Shnitsel Tools framework (or None if no deserialization is desired/supported)/ Then the `xr.Dataset that is the result of the conversion. And lastly a dict of metadata that might help with deserialization later on.

Return type:

tuple[str, xr.Dataset, MetaData]

Raises:

ValueError – If the conversion failed for some reason.

classmethod get_type_marker()#
Return type:

str

classmethod from_xr_dataset(dataset, metadata)#

Class method to support standardized deserialization of arbitrary classes. Implemented as a class method to avoid need to construct instance for deserialization.

Parameters:
  • cls (type[ResType]) – The class executing the deserialization.

  • dataset (xr.Dataset) – The dataset to be deserialized into the output type.

  • metadata (MetaData) – Metdatata from the serialization process.

Returns:

The deserialized instance of the target class.

Return type:

instance of cls

Raises:

TypeError – If deserialization of the object was not possible