What’s New in Astropy 4.3?¶
Overview¶
Astropy 4.3 is a major release that … since the 4.2.x series of releases.
In particular, this release includes:
Transformations to AltAz are now much more precise (and faster)
General masked class for Quantity and other ndarray subclasses
Support for different solvers and bracket option in z_at_value
In addition to these major changes, Astropy v4.3 includes a large number of smaller improvements and bug fixes, which are described in the Full Changelog. By the numbers:
xxx issues have been closed since v4.2
xxx pull requests have been merged since v4.2
xxx distinct people have contributed code
Transformations to AltAz are now much more precise (and faster)¶
Following advice from M. K. Brewer and comparisons with accurate verification
samples, the implementations for the transformations to AltAz coordinates were
made much more precise (down to the milli-arcsec level). To help this, the
CIRS
frame has gained an observer location
attribute.
Furthermore, by ensuring expensive calculations of the precession-nutation matrix are only done once, the transformations have been sped up considerably.
Improvements in making Astropy thread-safe¶
To help use of Astropy in multi-threaded environments (e.g., with Dask), an
effort has been started to make the basic infrastructure of astropy
thread-safe for operations that do not explicitly change state. In particular,
parsing of units and angles, and initializing leap-second tables should now be
safe even when done simultaneously in multiple threads, as should any use of
the lazyproperty
decorator (and the lazy=True
version of classproperty
).
Performance improvements to sigma clipping¶
The performance of the sigma clipping functions in the Astrostatistics Tools (astropy.stats) module has
now been significantly improved when more than a couple of iterations are
required and the built-in functions for determining the central values and
standard deviations are used. The performance gains are especially noticeable
when using the axis
keyword and different parts of the array being sigma
clipped require different numbers of iterations. In these cases the performance
can be 10-20x better or more.
Changes in the Time and IERS leap second handling¶
The Time and IERS leap second handling is changed so that the leap second table is
updated only when a Time transform involving UTC is performed. Previously this
update check was done the first time a Time
object was created, which in
practice occured when importing common astropy subpackages like
astropy.coordinates
. Now you can prevent querying internet resources (for
instance on a cluster) by setting iers.conf.auto_download = False
. This can
be done after importing astropy but prior to performing any Time
scale
transformations related to UTC.
Support for multidimensional and object columns in ECSV¶
Support has been added for reading and writing Tables with three additional data subtypes:
Multidimensional column data (both masked and unmasked) with fixed dimensions in all table cells.
Multidimensional column data with variable-dimension arrays similar to FITS variable-length arrays.
Object-type columns with simple Python objects consisting of
dict
,list
,str
,int
,float
,bool
andNone
elements.
All of these subtypes use JSON to convert each column cell to a string that is
stored in the ECSV output. This astropy
update corresponds to an updated
version 1.0 of the ECSV standard. For details
see the ECSV Format section.
Support for reading and writing tables to QDP format¶
The ASCII Tables (astropy.io.ascii) subpackage now supports reading and writing tables in the QDP (Quick and Dandy Plotter) format. This specialized format is used by some missions such as Swift.
Append table to existing FITS file¶
It is now easy to append a Table to an existing FITS file
using a new append
keyword:
>>> tbl.write('existing_table.fits', append=True)
General masked class for Quantity and other ndarray subclasses¶
A substantial new class for handling Masked Data has been
included as an experimental feature of astropy
. The new
Masked
class allows wrapping NumPy ndarray
subclasses to include a mask
attribute and correctly propagate that mask
through NumPy operations.
A primary driver for the Masked
class is to support
masked Quantity
objects. This functionality is implemented and well-tested,
and the next steps planned for the 5.0 release of astropy
will be
application to other astropy classes such as SkyCoord
and full integration with Table functionality that requires
masking.
We encourage use and testing of the new class in non-production code, but caution that the API may change in the next release.
Configuration file improvements¶
The configuration file is no longer created by default when importing astropy
and its existence is no longer required. This should alleviate a number of
issues associated with the previous behavior. If necessary the configuration
file can be written with a new function create_config_file
.
Affiliated packages should update their __init__.py
module to remove the
block using update_default_config
and
ConfigurationDefaultMissingWarning
.
Support for different solvers and bracket
option in z_at_value
¶
The z_at_value
convenience function now supports several solver methods,
the default of which provides a new bracket
parameter to pass a starting
value and range to the solver.
>>> from astropy import units as u
>>> from astropy.cosmology import Planck18, z_at_value
>>> z_at_value(Planck18.angular_diameter_distance, 1500*u.Mpc, bracket=(0.6, 1.0, 1.5))
0.6804445252462878
>>> z_at_value(Planck18.angular_diameter_distance, 1500*u.Mpc, bracket=(2.0, 3.0, 3.5))
3.7823268160744115
Full change log¶
To see a detailed list of all changes in version v4.3, including changes in API, please see the Full Changelog.