What’s New in Astropy 1.3?

Overview

Astropy 1.3 is a major release that adds significant new functionality since the 1.2.x series of releases.

In particular, this release includes:

In addition to these major changes, Astropy 1.3 includes a large number of smaller improvements and bug fixes, which are described in the Full Changelog. By the numbers:

  • 467 issues have been closed since v1.2
  • 242 pull requests have been merged since v1.2
  • 210 distinct people have contributed code

New WCSAxes framework to make plots with celestial coordinates

The visualization subpackage now include the WCSAxes framework (previously distributed as a separate package) which makes it possible to make plots in Matplotlib with celestial coordinates on the axes. Examples and documentation are provided in Making plots with world coordinates (WCSAxes).

()

../_images/1-3-1.png

New function to construct RGB images based on Lupton et al. (2004) algorithm

The visualization subpackage now includes a function to create RGB composite images from individual (high dynamic range) images. The technique is detailed in Lupton et al. (2004) and implemented in make_lupton_rgb. For more details, see Creating color RGB images.

Vector arithmetic using representations

Representations are used inside coordinates as vectors to points on the sky, but they can more generally be seen as vectors in any frame from the origin to a given point. In the latter context, basic arithmetic such as addition and subtraction of vectors, multiplication or division with a constant, or taking the norm, are all well defined, and thus have been implemented.

Times and coordinates can now be reshaped like arrays

The shapes of Time and SkyCoord instances (as well as underlying frames and realizations) can now be manipulated just like those of arrays, using methods with the same name. For more details, see Numpy method analogs and Array operations.

Earth locations can now be obtained by address

With the new of_address() class method, EarthLocation objects can now be easily created using a string address. For example:

>>> from astropy.coordinates import EarthLocation
>>> loc = EarthLocation.of_address("350 5th Ave, New York, NY 10118")
>>> loc
<EarthLocation ( 1334938.47885339, -4651088.60103721,  4141299.41836111) m>
>>> loc.geodetic
(<Longitude -73.9856554 deg>,
 <Latitude 40.7484404 deg>,
 <Quantity -1.2647149866511903e-09 m>)

This works by querying the Google Maps API to retrieve the latitude, longitude, and (optional) height of the specified location. This can be useful for quickly transforming locally to the AltAz frame without having to look up the spherical coordinates of a location:

>>> from astropy.coordinates import SkyCoord, AltAz
>>> m31 = SkyCoord.from_name('M31').transform_to(AltAz(obstime='2016-12-22 0:00', location=EarthLocation.of_address("350 5th Ave, New York, NY 10118")))
>>> m31.alt, m31.az
(<Latitude 85.3804464651436 deg>, <Longitude 279.6441719021479 deg>)

Coordinate transformations and barycentric corrections can use JPL Ephemerides

JPL ephemerides, which could already be used to calculate positions of solar system bodies, can now also be used for barycentric corrections and coordinate transformations.

Change in Table behavior when setting column

Previous to 1.3, Tables did in-place modification of a table column when a column was set like tab['colname'] = val. In 1.3, the default behavior has been set to instead replace a column. That is, tab['colname'] = val is now more like t.replace_column('a', val) than tab['colname'][:] = val. This behavior can be turned off for compatibility using the table.replace_inplace configuration setting (although in future versions of Astropy this capability will be deprecated and removed). For more details and examples on this change, see API change in replacing columns.

Support for Fortran exponent formats in ASCII tables

The fast reader in io.ascii now supports FORTRAN-style floating point values (i.e. 1.495978707D+238), via the fast_reader option exponent_style. The fast reader also now supports extended precision to fully read fortran outputs. For more details see Fortran-style exponents.

Serialization of Astropy classes to YAML

Astropy now has an astropy.io.misc.yaml module, which allows converting astropy objects into a standard YAML format. For example:

>>> from astropy.io.misc import yaml
>>> from astropy import units as u
>>> print(yaml.dump(1*u.au))
!astropy.units.Quantity
unit: !astropy.units.Unit {unit: AU}
value: 1.0

This functionality requires PyYaml version 3.12 or later.

Performance improvements with lazy-loading in the io.fits sub-package

The io.fits sub-package now supports “lazy loading”, where all HDUs are not loaded until they are requested (or the file is closed). This should provide substantial speedups for situations using the convenience functions (e.g., getheader() or getdata()) to get HDU’s that are near the front of a file with many HDU’s.

In the future, this may enable larger speedups using the standard astropy.io.fits.open() interface, but at the price of backwards compatibility. Currently the interface allows access to HDU’s all the way at the end of a file even after the file has been closed, preventing full use of the “lazy” loading described above. To begin discouraging this usage, a deprecation warning will now be issued when an HDU is accessed in this manner. Future versions of astropy may remove this capability completely to allow full lazy HDU loading.

Planck 2015 now the default cosmology

The default cosmology in the Cosmological Calculations (astropy.cosmology) sub-package is now the Planck 2015 cosmology, and the references have been updated to reflect the published papers.

GCRS and PrecessedGeocentric attributes are now representations

The astropy.coordinates.GCRS and astropy.coordinates.PrecessedGeocentric frames have been subtly changed such that their obsgeoloc and obsgeovel attributes return CartesianRepresentation objects, rather than Quantity objects. This was judged to be an advanced enough use case that this change will not include a deprecation period (as this would have added substantial complexity to astropy.coordinates). To make code written for earlier versions compatible with v1.3 and up, simply change all instances of <object>.obsgeoloc or <object>.obsgeovel to <object>.obsgeoloc.xyz/<object>.obsgeovel.xyz.

Full change log

To see a detailed list of all changes in version v1.3, including changes in API, please see the Full Changelog.