yt.frontends.open_pmd.misc module

yt.frontends.open_pmd.misc.get_component(group, component_name, index=0, offset=None)[source]

Grabs a dataset component from a group as a whole or sliced.

Parameters:
  • group (h5py.Group) –

  • component_name (str) – relative path of the component in the group

  • index (int, optional) – first entry along the first axis to read

  • offset (int, optional) – number of entries to read if not supplied, every entry after index is returned

Notes

This scales every entry of the component with the respective “unitSI”.

Returns:

(N,) 1D in case of particle data (O,P,Q) 1D/2D/3D in case of mesh data

Return type:

ndarray

yt.frontends.open_pmd.misc.is_const_component(record_component)[source]

Determines whether a group or dataset in the HDF5 file is constant.

Parameters:

record_component (h5py.Group or h5py.Dataset) –

Returns:

True if constant, False otherwise

Return type:

bool

References

yt.frontends.open_pmd.misc.parse_unit_dimension(unit_dimension)[source]

Transforms an openPMD unitDimension into a string.

Parameters:

unit_dimension (array_like) –

integer array of length 7 with one entry for the dimensional component of every SI unit

[0] length L, [1] mass M, [2] time T, [3] electric current I, [4] thermodynamic temperature theta, [5] amount of substance N, [6] luminous intensity J

References

https://github.com/openPMD/openPMD-standard/blob/latest/STANDARD.md#unit-systems-and-dimensionality

Return type:

str

Examples

>>> velocity = [1.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0]
>>> print(parse_unit_dimension(velocity))
'm**1*s**-1'
>>> magnetic_field = [0.0, 1.0, -2.0, -1.0, 0.0, 0.0, 0.0]
>>> print(parse_unit_dimension(magnetic_field))
'kg**1*s**-2*A**-1'