Reference/API#
astropy.io.misc Package#
This package contains miscellaneous utility functions for data input/output with astropy.
Functions#
|
|
|
astropy.io.misc.hdf5 Module#
This package contains functions for reading and writing HDF5 tables that are
not meant to be used directly, but instead are available as readers/writers in
astropy.table
. See Unified File Read/Write Interface for more details.
Functions#
|
Read a Table object from an HDF5 file. |
|
Write a Table object to an HDF5 file. |
astropy.io.misc.yaml Module#
Functions for serializing astropy objects to YAML.
It provides functions dump
,
load
, and load_all
which
call the corresponding functions in PyYaml but use the
AstropyDumper
and AstropyLoader
classes to define custom YAML tags for the following astropy classes:
- astropy.units.Unit
- astropy.units.Quantity
- astropy.time.Time
- astropy.time.TimeDelta
- astropy.coordinates.SkyCoord
- astropy.coordinates.Angle
- astropy.coordinates.Latitude
- astropy.coordinates.Longitude
- astropy.coordinates.EarthLocation
- astropy.table.SerializedColumn
Examples#
>>> from astropy.io.misc import yaml
>>> import astropy.units as u
>>> from astropy.time import Time
>>> from astropy.coordinates import EarthLocation
>>> t = Time(2457389.0, format='mjd',
... location=EarthLocation(1000, 2000, 3000, unit=u.km))
>>> td = yaml.dump(t)
>>> print(td)
!astropy.time.Time
format: mjd
in_subfmt: '*'
jd1: 4857390.0
jd2: -0.5
location: !astropy.coordinates.earth.EarthLocation
ellipsoid: WGS84
x: !astropy.units.Quantity
unit: &id001 !astropy.units.Unit {unit: km}
value: 1000.0
y: !astropy.units.Quantity
unit: *id001
value: 2000.0
z: !astropy.units.Quantity
unit: *id001
value: 3000.0
out_subfmt: '*'
precision: 3
scale: utc
>>> ty = yaml.load(td)
>>> ty
<Time object: scale='utc' format='mjd' value=2457389.0>
>>> ty.location
<EarthLocation (1000., 2000., 3000.) km>
Functions#
|
Serialize a Python object into a YAML stream using the AstropyDumper class. |
|
Parse the first YAML document in a stream using the AstropyLoader and produce the corresponding Python object. |
|
Parse the all YAML documents in a stream using the AstropyLoader class and produce the corresponding Python object. |
Classes#
|
Custom SafeDumper that represents astropy core objects as well as Python tuple and unicode objects. |
|
Custom SafeLoader that constructs astropy core objects as well as Python tuple and unicode objects. |
Class Inheritance Diagram#
astropy.io.misc.parquet Module#
This package contains functions for reading and writing Parquet
tables that are not meant to be used directly, but instead are
available as readers/writers in astropy.table
. See
Unified File Read/Write Interface for more details.