ModelProps#
- class ModelProps(name, desc, unit, scalar, _mesh, order='F', scales=('r', 't', 'p'))[source]#
Bases:
ScalePropsImmutable property bundle for a single PSI model quantity.
Extends
ScalePropswith scalar/vector classification, staggered-grid mesh code, array ordering, and scale axis labels. Used for MAS and POT3D output fields. 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
Unit Astropy unit whose scale factor converts one code unit of this quantity to physical unit. For example,
MAS_b≈ 2.2 Gauss.- scalarbool
Trueif the quantity is a scalar field (temperature, density, …);Falseif it is a component of a vector field (velocity, magnetic field, …).- _mesh
int 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.- order
str, optional Array memory layout:
'F'for Fortran (column-major, PSI default) or'C'for C (row-major). Default is'F'.- scales
tuple[str, …], optional Ordered names of the coordinate scale axes associated with this quantity. Default is
('r', 't', 'p').
- name
- Attributes:
See also
ScalePropsBase class for coordinate scale arrays without mesh or ordering.
get_mas_quantity_propertiesRetrieve a
ModelPropsfor a MAS quantity.get_pot3d_quantity_propertiesRetrieve a
ModelPropsfor a POT3D quantity.
Notes
The arithmetic dunder methods (
__mul__,__rmul__,__rtruediv__) delegate tounit, sovalue * propsis equivalent tovalue * props.unitand returns anQuantity.Examples
>>> from psi_io.models import ModelProps >>> import astropy.units as u >>> p = ModelProps('br', 'Radial B field', u.Gauss, False, 0b100) >>> str(p) 'br' >>> p.scalar False >>> p.mesh Mesh(HALF, MAIN, MAIN) >>> (2.5 * p).unit Unit("G")
Properties
Normalized mesh-stagger object for this quantity. |