========================
New Features
------------
astropy.convolution
^^^^^^^^^^^^^^^^^^^
- Methods ``convolve`` and ``convolve_fft`` both now return Quantity arrays
if user input is given in one. [10822]
astropy.coordinates
^^^^^^^^^^^^^^^^^^^
- Numpy functions that broadcast, change shape, or index (like
``np.broadcast_to``, ``np.rot90``, or ``np.roll``) now work on
coordinates, frames, and representations. [10337]
- Add a new science state ``astropy.coordinates.erfa_astrom.erfa_astrom`` and
two classes ``ErfaAstrom``, ``ErfaAstromInterpolator`` as wrappers to
the ``pyerfa`` astrometric functions used in the coordinate transforms.
Using ``ErfaAstromInterpolator``, which interpolates astrometric properties for
``SkyCoord`` instances with arrays of obstime, can dramatically speed up
coordinate transformations while keeping microarcsecond resolution.
Depending on needed precision and the obstime array in question, speed ups
reach factors of 10x to >100x. [10647]
- ``galactocentric_frame_defaults`` can now also be used as a registry, with
user-defined parameter values and metadata. [10624]
- Method ``.realize_frame`` from coordinate frames now accepts ``**kwargs``,
including ``representation_type``. [10727]
- Avoid an unnecessary call to ``erfa.epv00`` in transformations between
``CIRS`` and ``ICRS``, improving performance by 50 %. [10814]
- A new equatorial coordinate frame, with RA and Dec measured w.r.t to the True
Equator and Equinox (TETE). This frame is commonly known as "apparent place"
and is the correct frame for coordinates returned from JPL Horizons. [10867]
- Added a context manager ``impose_finite_difference_dt`` to the
``TransformGraph`` class to override the finite-difference time step
attribute (``finite_difference_dt``) for all transformations in the graph
with that attribute. [10341]
- Improve performance of ``SpectralCoord`` by refactoring internal
implementation. [10398]
astropy.cosmology
^^^^^^^^^^^^^^^^^
- The final version of the Planck 2018 cosmological parameters are included
as the ``Planck18`` object, which is now the default cosmology. The
parameters are identical to those of the ``Planck18_arXiv_v2`` object,
which is now deprecated and will be removed in a future release. [10915]
astropy.modeling
^^^^^^^^^^^^^^^^
- Added NFW profile and tests to modeling package [10505]
- Added missing logic for evaluate to compound models [10002]
- Stop iteration in ``FittingWithOutlierRemoval`` before reaching ``niter`` if
the masked points are no longer changing. [10642]
- Keep a (shallow) copy of ``fit_info`` from the last iteration of the wrapped
fitter in ``FittingWithOutlierRemoval`` and also record the actual number of
iterations performed in it. [10642]
- Added attributes for fitting uncertainties (covariance matrix, standard
deviations) to models. Parameter covariance matrix can be accessed via
``model.cov_matrix``, standard deviations by ``model.stds`` or individually
for each parameter by ``parameter.std``. Currently implemented for
``LinearLSQFitter`` and ``LevMarLSQFitter``. [10552]
- N-dimensional least-squares statistic and specific 1,2,3-D methods [10670]
astropy.stats
^^^^^^^^^^^^^
- Added ``circstd`` function to obtain a circular standard deviation. [10690]
astropy.table
^^^^^^^^^^^^^
- Allow initializing a ``Table`` using a list of ``names`` in conjunction with
a ``dtype`` from a numpy structured array. The list of ``names`` overrides the
names specified in the ``dtype``. [10419]
astropy.time
^^^^^^^^^^^^
- Add new ``isclose()`` method to ``Time`` and ``TimeDelta`` classes to allow
comparison of time objects to within a specified tolerance. [10646]
- Improve initialization time by a factor of four when creating a scalar ``Time``
object in a format like ``unix`` or ``cxcsec`` (time delta from a reference
epoch time). [10406]
- Improve initialization time by a factor of ~25 or more for large arrays of
string times in ISO, ISOT or year day-of-year formats. This is done with a new
C-based time parser that can be adapted for other fixed-format custom time
formats. [10360]
- Numpy functions that broadcast, change shape, or index (like
``np.broadcast_to``, ``np.rot90``, or ``np.roll``) now work on times.
[10337, 10502]
astropy.timeseries
^^^^^^^^^^^^^^^^^^
- Improve memory and speed performance when iterating over the entire time
column of a ``TimeSeries`` object. Previously this involved O(N^2) operations
and memory. [10889]
astropy.units
^^^^^^^^^^^^^
- ``Quantity.to`` has gained a ``copy`` option to allow copies to be avoided
when the units do not change. [10517]
- Added the ``spat`` unit of solid angle that represents the full sphere.
[10726]
astropy.utils
^^^^^^^^^^^^^
- ``ShapedLikeNDArray`` has gained the capability to use numpy functions
that broadcast, change shape, or index. [10337]
- ``get_free_space_in_dir`` now takes a new ``unit`` keyword and
``check_free_space_in_dir`` takes ``size`` defined as ``Quantity``. [10627]
- New ``astropy.utils.data.conf.allow_internet`` configuration item to
control downloading data from the Internet. Setting ``allow_internet=False``
is the same as ``remote_timeout=0``. Using ``remote_timeout=0`` to control
internet access will stop working in a future release. [10632]
- New ``is_url`` function so downstream packages do not have to secretly use
the hidden ``_is_url`` anymore. [10684]
astropy.visualization
^^^^^^^^^^^^^^^^^^^^^
- Added the ``Quadrangle`` patch for ``WCSAxes`` for a latitude-longitude
quadrangle. Unlike ``matplotlib.patches.Rectangle``, the edges of this
patch will be rendered as curved lines if appropriate for the WCS
transformation. [10862]
- The position of tick labels are now only calculated when needed. If any text
parameters are changed (color, font weight, size etc.) that don't effect the
tick label position, the positions are not recomputed, improving performance.
[10806]
astropy.wcs
^^^^^^^^^^^
- ``WCS.to_header()`` now appends comments to SIP coefficients. [10480]
- A new property ``dropped_world_dimensions`` has been added to
``SlicedLowLevelWCS`` to record information about any world axes removed by
slicing a WCS. [10195]
- New ``WCS.proj_plane_pixel_scales()`` and ``WCS.proj_plane_pixel_area()``
methods to return pixel scales and area, respectively, as Quantity. [10872]
API Changes
-----------
astropy.config
^^^^^^^^^^^^^^
- ``set_temp_config`` now preserves the existing cache rather than deleting
it and relying on reloading it from the previous config file. This ensures
that any programmatically made changes are preserved as well. [10474]
- Configuration path detection logic has changed: Now, it looks for ``~`` first
before falling back to older logic. In addition, ``HOMESHARE`` is no longer
used in Windows. [10705]
astropy.coordinates
^^^^^^^^^^^^^^^^^^^
- The passing of frame classes (as opposed to frame instances) to the
``transform_to()`` methods of low-level coordinate-frame classes has been
deprecated. Frame classes can still be passed to the ``transform_to()``
method of the high-level ``SkyCoord`` class, and using ``SkyCoord`` is
recommended for all typical use cases of transforming coordinates. [10475]
astropy.stats
^^^^^^^^^^^^^
- Added a ``grow`` parameter to ``SigmaClip``, ``sigma_clip`` and
``sigma_clipped_stats``, to allow expanding the masking of each deviant
value to its neighbours within a specified radius. [10613]
- Passing float ``n`` to ``poisson_conf_interval`` when using
``interval='kraft-burrows-nousek'`` now raises ``TypeError`` as its value
must be an integer. [10838]
astropy.table
^^^^^^^^^^^^^
- Change ``Table.columns.keys()`` and ``Table.columns.values()`` to both return
generators instead of a list. This matches the behavior for Python ``dict``
objects. [10543]
- Removed the ``FastBST`` and ``FastRBT`` indexing engines because they depend
on the ``bintrees`` package, which is no longer maintained and is deprecated.
Instead, use the ``SCEngine`` indexing engine, which is similar in
performance and relies on the ``sortedcontainers`` package. [10622]
- When slicing a mixin column in a table that had indices, the indices are no
longer copied since they generally are not useful, having the wrong shape.
With this, the behaviour becomes the same as that for a regular ``Column``.
(Note that this does not affect slicing of a table; sliced columns in those
will continue to carry a sliced version of any indices). [10890]
- Change behavior so that when getting a single item out of a mixin column such
as ``Time``, ``TimeDelta``, ``SkyCoord`` or ``Quantity``, the ``info``
attribute is no longer copied. This improves performance, especially when the
object is an indexed column in a ``Table``. [10889]
- Raise a TypeError when a scalar column is added to an unsized table. [10476]
- The order of columns when creating a table from a ``list`` of ``dict`` may be
changed. Previously, the order was alphabetical because the ``dict`` keys
were assumed to be in random order. Since Python 3.7, the keys are always in
order of insertion, so ``Table`` now uses the order of keys in the first row
to set the column order. To alphabetize the columns to match the previous
behavior, use ``t = t[sorted(t.colnames)]``. [10900]
astropy.time
^^^^^^^^^^^^
- Refactor ``Time`` and ``TimeDelta`` classes to inherit from a common
``TimeBase`` class. The ``TimeDelta`` class no longer inherits from ``Time``.
A number of methods that only apply to ``Time`` (e.g. ``light_travel_time``)
are no longer available in the ``TimeDelta`` class. [10656]
astropy.units
^^^^^^^^^^^^^
- The ``bar`` unit is no longer wrongly considered an SI unit, meaning that
SI decompositions like ``(u.kg*u.s**-2* u.sr**-1 * u.nm**-1).si`` will
no longer include it. [10586]
astropy.utils
^^^^^^^^^^^^^
- Shape-related items from ``astropy.utils.misc`` -- ``ShapedLikeNDArray``,
``check_broadcast``, ``unbroadcast``, and ``IncompatibleShapeError`` --
have been moved to their own module, ``astropy.utils.shapes``. They remain
importable from ``astropy.utils``. [10337]
- ``check_hashes`` keyword in ``check_download_cache`` is deprecated and will
be removed in a future release. [10628]
- ``hexdigest`` keyword in ``import_file_to_cache`` is deprecated and will
be removed in a future release. [10628]
Bug Fixes
---------
astropy.config
^^^^^^^^^^^^^^
- Fix a few issues with ``generate_config`` when used with other packages.
[10893]
astropy.coordinates
^^^^^^^^^^^^^^^^^^^
- Fixed a bug in the coordinate-frame attribute ``CoordinateAttribute`` where
the internal transformation could behave differently depending on whether
the input was a low-level coordinate frame or a high-level ``SkyCoord``.
``CoordinateAttribute`` now always performs a ``SkyCoord``-style internal
transformation, including the by-default merging of frame attributes. [10475]
astropy.modeling
^^^^^^^^^^^^^^^^
- Fixed an issue of ``Model.render`` when the input ``out`` datatype is not
float64. [10542]
astropy.visualization
^^^^^^^^^^^^^^^^^^^^^
- Fix support for referencing WCSAxes coordinates by their world axes names.
[10484]
astropy.wcs
^^^^^^^^^^^
- Objective functions called by ``astropy.wcs.fit_wcs_from_points`` were
treating longitude and latitude distances equally. Now longitude scaled
properly. [10759]
Other Changes and Additions
---------------------------
- Minimum version of required Python is now 3.7. [10900]
- Minimum version of required Numpy is now 1.17. [10664]
- Minimum version of required Scipy is now 1.1. [10900]
- Minimum version of required PyYAML is now 3.13. [10900]
- Minimum version of required Matplotlib is now 3.0. [10900]
- The private ``_erfa`` module has been converted to its own package,
``pyerfa``, which is a required dependency for astropy, and can be imported
with ``import erfa``. Importing ``_erfa`` from ``astropy`` will give a
deprecation warning. [10329]
- Added ``optimize=True`` flag to calls of ``yacc.yacc`` (as already done for
``lex.lex``) to allow running in ``python -OO`` session without raising an
exception in ``astropy.units.format``. [10379]
- Shortened FITS comment strings for some D2IM and CPDIS FITS keywords to
reduce the number of FITS ``VerifyWarning`` warnings when working with WCSes
containing lookup table distortions. [10513]
- When importing astropy without first building the extension modules first,
raise an error directly instead of trying to auto-build. [10883]