Axes¶
Note
This section characterizes protocols for axes. The purpose of a protocol is to provide support for nominal and structural subtyping.
Axis protocols¶
One essential building block for datasets like GridDatasetType
and
ParticleDatasetType
are AxisType
and GridAxisType
. Similar to datasets,
protocols are in place to provide available attributes.
-
class
nata.types.
AxisType
(*args, **kwds)¶ Bases:
typing_extensions.Protocol
Base protocol for an axis.
-
label
: str¶ Descriptive label of the axis. Can be an arbitrary string, e.g.
"some long label for an axis"
.
-
In addition, AxisType
provides methods to check for equivalence between
axes and to append another axis.
-
AxisType.
equivalent
(other: nata.types.AxisType) → bool¶ Checks for equivalence of two axes.
-
AxisType.
append
(other: nata.types.AxisType) → None¶ Appends another axis.
- Parameters
other (
AxisType
) – The other axis which will be appended.
As grid axes provide uniformity for each dimension of a grid, the GridAxisType
extends AxisType
.
-
class
nata.types.
GridAxisType
(*args, **kwds)¶ Bases:
nata.types.AxisType
,typing_extensions.Protocol
Axes container¶
Axes serve the purpose of providing meta information for DatasetType
and
are in general occurring in a combination with other axes. For this, two
special purpose axes container exist, GridDatasetAxes
and
ParticleDatasetAxes
.
-
class
nata.types.
GridDatasetAxes
(**kwargs)¶ Bases:
dict
Typed dictionary containing axes for grid datasets.
Typed dictionary
typing.TypedDict
which correspond to adict
at runtime are merely there for type checking. The attributes correspond to required keys inside a dictionary.-
iteration
: Optional[nata.types.AxisType]¶ Axis to store iteration information.
-
time
: Optional[nata.types.AxisType]¶ Axis to store time information.
-
grid_axes
: Sequence[nata.types.GridAxisType]¶ Sequence of
GridAxisType
representing an axis for each grid dimension.
-
-
class
nata.types.
ParticleDatasetAxes
(**kwargs)¶ Bases:
dict
Typed dictionary containing axes for particle datasets.
Typed dictionary
typing.TypedDict
which correspond to adict
at runtime are merely there for type checking. The attributes correspond to required keys inside a dictionary.-
iteration
: Optional[nata.types.AxisType]¶ Axis to store iteration information.
-
time
: Optional[nata.types.AxisType]¶ Axis to store time information.
-