Props#
- class Props(name, desc, unit, ndim, scalar, _mesh=None)[source]#
Bases:
objectImmutable property bundle for a single PSI model quantity.
Associates a quantity name with its human-readable description, physical unit, dimensionality, scalar/vector classification, and staggered-grid mesh code. Instances are frozen (immutable) dataclass instances.
- Parameters:
- name
str Canonical lower-case quantity identifier (e.g.
'br','vr'). Matches the filename prefix used in MAS and POT3D HDF output.- desc
str Human-readable description of the physical quantity.
- unit
u.Unit Astropy unit whose scale factor converts one code unit of this quantity to physical unit. For example,
MAS_b≈ 2.2 Gauss.- ndim
int Number of spatial dimensions of the output array (
3for MAS/POT3D fields,1for coordinate scale arrays).- scalarbool
Trueif the quantity is a scalar field (temperature, density, …);Falseif it is a component of a vector field (velocity, magnetic field, …).- _mesh
int, optional Integer mesh code encoding the stagger position on the three-dimensional grid. Each binary bit indicates whether the quantity is on the half mesh (
1) or main mesh (0) along one coordinate axis.Nonefor coordinate scale arrays that carry no stagger information (e.g. the radial scale'r').
- name
- Attributes:
Notes
The arithmetic dunder methods (
__mul__,__rmul__,__rtruediv__) delegate tounit, sosome_value * propsis equivalent tosome_value * props.unitand returns anQuantity.Examples
>>> from psi_io._models import Props >>> import astropy.units as u >>> p = Props('br', 'Radial B field', u.Gauss, 3, False, 0b100) >>> str(p) 'br' >>> p.ndim, p.scalar (3, False) >>> p.mesh (Mesh.HALF, Mesh.MAIN, Mesh.MAIN) >>> (2.5 * p).unit Unit("G")
Properties
Normalized mesh-stagger tuple for this quantity. |