What’s New in Astropy 1.2?¶
Overview¶
Astropy 1.2 is a major release that adds significant new functionality since the 1.1.x series of releases.
In particular, this release includes:
- A new class to compute Lomb-Scargle periodograms efficiently using different methods.
- A number of new statistics functions, including for Jackknife resampling, circular statistics, and for the Akaike and Bayesian information criteria.
- Support for getting the positions of solar system bodies in the coordinates sub-package.
- The ability to compute Barycentric and Heliocentric light-travel time corrections.
- Support for offset coordinate frames, which can be used to define a coordinate system relative to a known position.
- An implementation of the zscale algorithm to determine image limits automatically.
- Support for bolometric magnitudes in the units package.
- Improvements to the NDData class and subclasses.
- Auto-downloading of IERS tables as needed, which gives information about Earth orientation parameters necessary for high precision coordinate calculations and conversions to/from the UT1 scale.
In addition to these major changes, Astropy 1.2 includes a large number of smaller improvements and bug fixes, which are described in the Full Changelog. By the numbers:
- 615 issues have been closed since v1.1
- 313 pull requests have been merged since v1.1
- 191 distinct people have contributed code
Lomb-scargle periodograms¶
The new LombScargle
class implements a fast Lomb-Scargle
periodogram, useful for detecting periodic signals in noisy, unevenly-spaced
data. For example, here is an irregular sinusoidal signal:
>>> import numpy as np
>>> rand = np.random.RandomState(42)
>>> t = 100 * rand.rand(100)
>>> dy = 0.1
>>> y = np.sin(2 * np.pi * t) + dy * rand.randn(100)
Given this data, we can compute the Lomb-Scargle periodogram and find the frequency at which the power is maximized:
>>> from astropy.stats import LombScargle
>>> frequency, power = LombScargle(t, y, dy).autopower()
>>> frequency[np.argmax(power)]
0.99962825294969382
The maximum is very near the input frequency of 1.0 cycles per unit time.
As a more realistic example, here is a periodogram computed for six months of nightly observations of a simulated RR-Lyrae-type variable (this particular example is discussed more fully in RR-Lyrae Example):
()
For more information on astropy’s Lomb-Scargle functionality, see Lomb-Scargle Periodograms.
Other new statistics features¶
The Jackknife resampling method is available via the
jackknife_resampling()
function. Jackknife resampling
generates n deterministic samples of size n-1 from a measured sample of size n.
Those samples can then be used for various statistics estimation such as
variance and bias using the jackknife_stats()
function.
Circular statistics (circular mean, variance, etc) are now provided by the
circmean()
, circvar()
, ,
circmoment()
, and circcorrcoef()
functions. in. The API basically follows the same conventions of R CircStats
package. In addition, the circular stats are compatible with the
Quantity
class.
The Akaike and Bayesian information criteria are now implemented in
akaike_info_criterion()
,
akaike_info_criterion_lsq()
,
bayesian_info_criterion()
, and
bayesian_info_criterion_lsq()
. Basically, these
information criteria are used to decided whether increasing the number of
parameters in a model truly improves the fitting. Conversely, they are also
used to verify whether improvements in fitting are due to the increasing of the
number of parameters.
Solar system ephemerides¶
It is now possible to calculate the positions of the major solar system bodies
(as well as the moon) in the coordinates
sub-package. These integrate fully all the coordinate frames, allowing easy
conversion to apparent (e.g. AltAz
) positions or barycentric values. The
positions can be calculated using either using built-in approximations or more
precise values that depend on downloading JPL-provided ephemeris models derived
from n-body simulations (the latter requires the additional dependency of the
jplephem package). For more details,
see Solar System Ephemerides.
Barycentric light-travel time corrections¶
The Time
class has gained a new method
light_travel_time()
for calculating barycentric
(or heliocentric) corrections. For more details, see
Barycentric and Heliocentric Light Travel Time Corrections.
Sky offset coordinate frames¶
The coordinates sub-package now includes support
for coordinate frames that are rotated in the sky to be centered on a
particular object. This sort of frame is variously known as “FOV coordinates”,
“offset coordinates”, or “astrometric”. It makes it easier to compute offsets
from a particular reference object, and define coordinate frames that for
heirarchical systems like groups or clusters of galaxies. It also enables the
new spherical_offsets_to()
method. For more
details, see “Sky Offset” Frames.
Zscale implementation¶
The zscale algorithm
from IRAF is now included in Astropy’s visualization sub-package, and available as
a ZScaleInterval
interval class. The implementation is
based on Numdisplay’s one, slightly
modified to expose more arguments and work with data with any number of
dimensions.
New example gallery¶
The Astropy documentation now contains an example gallery that highlights key functionality of the package in short snippets of code with descriptive text. The examples are meant to demonstrate the functionality and interoperability of the subpackages in shorter-form worked examples. Longer form tutorials are still maintained at http://tutorials.astropy.org/.
Apparent/absolute bolometric magnitudes and other new units¶
The units sub-package now supports bolometric magnitudes, based on the bolometric flux and luminosity scales adopted in IAU 2015 resolution B2.
Furthermore, Earth and Jupiter radii have been made available as units.
NDData improvements¶
Arithmetic and uncertainty handling have been enhanced for astropy 1.2, and a
new class, NDDataRef
, has been added that should be
the starting point for new users of astropy.nddata
. One can now do arithmetic
between an NDDataRef
object and a scalar, an
Quantity
or another NDDataRef
object (or any class that implements the nddata interface). Limited support for
propagating correlated errors was added to
StdDevUncertainty
.
Several internal changes were made to the classes in the nddata package to make writing custom classes that implement the nddata interface more straightforward.
Automatic updates to IERS Earth rotation data¶
The astropy.utils.iers
sub-package provides access to the tables provided by
the International Earth Rotation and Reference Systems (IERS) service. These
are used in the time sub-package to transform to/from UT1
values and for determining Earth orientation for celestial-to-terrestrial
coordinate transformations (in the coordinates
sub-package).
Starting with astropy 1.2, the latest IERS values (which include approximately one year of predictive values) are automatically downloaded from the IERS service when required. This happens when a time or coordinate transformation needs a value which is not already available via the download cache.
For details see the astropy.utils.iers
sub-package documentation.
Other significant changes¶
Astropy now requires Numpy 1.7.0 or later.
Full change log¶
To see a detailed list of all changes in version v1.2, including changes in API, please see the Full Changelog.