.. doctest-skip-all

.. _whatsnew-4.3:

**************************
What's New in Astropy 4.3?
**************************

Overview
========

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

In particular, this release includes:

* :ref:`whatsnew-4.3-coordinates`
* :ref:`whatsnew-4.3-threadsafe`
* :ref:`whatsnew-4.3-sigma-clipping`
* :ref:`whatsnew-4.3-iers-auto-download`
* :ref:`whatsnew-4.3-ecsv-subtypes`
* :ref:`whatsnew-4.3-ascii-qdp-format`
* :ref:`whatsnew-4.3-fits-append-table`
* :ref:`whatsnew-4.3-masked-class-quantity`
* :ref:`whatsnew-4.3-configuration-file-optional`
* :ref:`whatsnew-4.3-cosmology`

In addition to these major changes, Astropy v4.3 includes a large number of
smaller improvements and bug fixes, which are described in the
:ref:`changelog`. By the numbers:

* 309 issues have been closed since v4.2
* 145 pull requests have been merged since v4.2
* 72 distinct people have contributed code

.. _whatsnew-4.3-coordinates:

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.

.. _whatsnew-4.3-threadsafe:

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 `~astropy.utils.decorators.lazyproperty` decorator (and the ``lazy=True``
version of `~astropy.utils.decorators.classproperty`).

.. _whatsnew-4.3-sigma-clipping:

Performance improvements to sigma clipping
==========================================

The performance of the sigma clipping functions in the :ref:`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.

.. _whatsnew-4.3-iers-auto-download:

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.

.. _whatsnew-4.3-ecsv-subtypes:

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`` and ``None``
  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
<https://github.com/astropy/astropy-APEs/blob/main/APE6.rst>`_. For details
see the :ref:`ecsv_format` section.

.. _whatsnew-4.3-ascii-qdp-format:

Support for reading and writing tables to QDP format
====================================================

The :ref:`io-ascii` subpackage now supports reading and writing tables in the
QDP (`Quick and Dandy Plotter <https://wwwastro.msfc.nasa.gov/qdp/>`_) format.
This specialized format is used by some missions such as `Swift
<https://www.nasa.gov/mission_pages/swift/main>`_.

.. _whatsnew-4.3-fits-append-table:

Append table to existing FITS file
==================================

It is now easy to append a :ref:`Table <astropy-table>` to an existing FITS file
using a new ``append`` keyword::

    >>> tbl.write('existing_table.fits', append=True)  # doctest: +SKIP

.. _whatsnew-4.3-masked-class-quantity:

General masked class for Quantity and other ndarray subclasses
==============================================================

A substantial new class for handling :ref:`Masked Data <utils-masked>` has been
included as an experimental feature of ``astropy``. The new
`~astropy.utils.masked.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 `~astropy.utils.masked.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 `~astropy.coordinates.SkyCoord`
and full integration with :ref:`Table <astropy-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.

.. _whatsnew-4.3-configuration-file-optional:

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 `~astropy.config.create_config_file`.

Affiliated packages should update their ``__init__.py`` module to remove the
block using ``update_default_config`` and
``ConfigurationDefaultMissingWarning``.

.. _whatsnew-4.3-cosmology:

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))  # doctest: +FLOAT_CMP +IGNORE_WARNINGS
  0.6804445252462878
  >>> z_at_value(Planck18.angular_diameter_distance, 1500*u.Mpc, bracket=(2.0, 3.0, 3.5))  # doctest: +FLOAT_CMP +IGNORE_WARNINGS
  3.7823268160744115

Full change log
===============

To see a detailed list of all changes in version v4.3, including changes in
API, please see the :ref:`changelog`.

Contributors to the v4.3 release
================================

The people who have contributed to the code for this release are:

.. hlist::
  :columns: 4

  -  Adrian Price-Whelan
  -  Albert Y. Shih
  -  Andrej Rode  *
  -  Bhavya Khandelwal  *
  -  Brian Soto
  -  Brigitta Sipőcz
  -  Bruce Merry
  -  Chiara Marmo  *
  -  Dan Ryan  *
  -  David Stansby
  -  Derek Homeier
  -  E. Madison Bray
  -  Ed Slavich
  -  Eero Vaher  *
  -  Erik Tollerud
  -  Gabriel Perren
  -  Geert Barentsen
  -  Gyanendra Shukla  *
  -  Hans Moritz Günther
  -  Ilya Kamenshchikov  *
  -  Jakob Maljaars  *
  -  James Davies
  -  James Tocknell  *
  -  James Turner
  -  Jane Rigby
  -  Jose Sabater  *
  -  Juan Luis Cano Rodríguez
  -  Julien Woillez
  -  Karl Wessel  *
  -  Larry Bradley
  -  Laura Hayes  *
  -  Leo Singer
  -  Ludwig Schwardt
  -  Léni Gauffier  *
  -  Maik Nijhuis  *
  -  Marten van Kerkwijk
  -  Matteo Bachetti
  -  Matthias Bussonnier  *
  -  Maximilian Nöthe
  -  Mihai Cara
  -  Nadia Dencheva
  -  Nathaniel Starkman
  -  Nicholas Earl
  -  Nick Murphy
  -  Nikita Tewary  *
  -  Ole Streicher
  -  Param Patidar  *
  -  Perry Greenfield
  -  Pey Lian Lim
  -  Pushkar Kopparla  *
  -  Ricardo Fonseca
  -  Richard R  *
  -  Rik van Lieshout  *
  -  Sam Lee   *
  -  Sashank Mishra
  -  Shankar Kulumani  *
  -  Simon Conseil
  -  Steve Guest  *
  -  Steven Bamford
  -  Stuart Littlefair
  -  Stuart Mumford
  -  Suyog Garg  *
  -  Thomas Robitaille
  -  Tim Gates  *
  -  Tim Jenness
  -  Tom Aldcroft
  -  Tom Donaldson
  -  William Jamieson  *
  -  homeboy445  *
  -  maggiesam  *

Where a * indicates that this release contains their first contribution to
Astropy.
