scopesim_targets.yaml_constructors#
Custom YAML class constructors (loading) and representations (dumping).
Currently contains representers and constructors for astropy.units.Quantity and astropy.coordinates.SkyCoord. Both of them have YAML representers and constructors defined by astropy, but those are a bit too complex and not easily readable, so we’re defining simplified versions here which fit the needs of this package. The original YAML tags can still be used if desired, by using the astropy YAML loader instead of the default one.
The way this works is that the register_foo functions are called once in the top-level __init__.py, which makes the representers, constructors and implicit resolvers available everywhere for the standard YAML loaders and dumpers.
Note: The constructors have to be added to both default (Full) and SafeLoader, in order to work with any YAML loader out-of-the-box.
Functions
Register simplified representer and constructor for SkyCoord. |
|
Register representer, constructor and implicit resolver for Quantity. |
|
|
Register mapping constructor for target_cls. |