ScaleProps

Contents

ScaleProps#

class ScaleProps(name, desc, unit)[source]#

Bases: object

Immutable property bundle for a PSI coordinate scale array.

Associates a coordinate axis name with its human-readable description and physical unit. Used for the three standard PSI spatial scales 'r', 't', and 'p'. Instances are frozen (immutable) dataclass instances.

Parameters:
namestr

Canonical lower-case coordinate identifier ('r', 't', or 'p').

descstr

Human-readable description (e.g. 'PSI Radial Scale (Solar Radii)').

unitUnit

Astropy unit for values stored along this coordinate axis. For example, PSI_rsun for the radial scale.

See also

ModelProps

Extends ScaleProps with scalar, mesh, and ordering fields for 3-D model quantities.

get_psi_scale_properties

Retrieve a ScaleProps by coordinate name.

Notes

The arithmetic dunder methods (__mul__, __rmul__, __rtruediv__) delegate to unit, so value * props is equivalent to value * props.unit and returns an Quantity.

Examples

>>> from psi_io.models import ScaleProps
>>> import astropy.units as u
>>> p = ScaleProps('r', 'PSI Radial Scale (Solar Radii)', u.R_sun)
>>> str(p)
'r'
>>> p.name, p.desc
('r', 'PSI Radial Scale (Solar Radii)')
>>> (1.0 * p).unit
Unit("solRad")

Methods

_asdict()

Return a plain dictionary of this instance's fields.