What’s New in Astropy 3.2?

Overview

Astropy 3.2 is a major release that … since the 3.1.x series of releases.

In particular, this release includes:

In addition to these major changes, Astropy v3.2 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 v3.1

  • xxx pull requests have been merged since v3.1

  • xxx distinct people have contributed code

New Sub-package for Time Series

Astropy 3.2 includes a new experimental sub-package: Time series (astropy.timeseries). Currently this sub-package provides classes to represent sampled and binned time series as well as some basic analysis tasks.

The following example shows a simple example of reading in a Kepler light curve, finding the period of the transits, and folding the light curve.

import numpy as np
import matplotlib.pyplot as plt
from astropy.timeseries import TimeSeries
from astropy.utils.data import get_pkg_data_filename
from astropy import units as u
from astropy.stats import BoxLeastSquares

filename = get_pkg_data_filename('timeseries/kplr010666592-2009131110544_slc.fits')
ts = TimeSeries.read(filename, format='kepler.fits')

plt.figure(figsize=(10,5))

# Show the original light curve
plt.subplot(1, 2, 1)
plt.plot(ts.time.mjd, ts['sap_flux'], 'k.', markersize=1)
plt.xlabel('Barycentric Modified Julian Date')
plt.ylabel('SAP Flux (e-/s)')

# Find the transit period and fold the light curve
keep = ~np.isnan(ts['sap_flux'])
periodogram = BoxLeastSquares(ts.time.jd[keep] * u.day, ts['sap_flux'][keep]).autopower(0.2 * u.day)
period = periodogram.period[np.argmax(periodogram.power)]
ts_folded = ts.fold(period=period, midpoint_epoch='2009-05-02T07:41:40')

# Show the folded light curve
plt.subplot(1, 2, 2)
plt.plot(ts_folded.time.jd, ts_folded['sap_flux'], 'k.', markersize=1)
plt.xlabel('Time relative to epoch (days)')
plt.gca().get_yaxis().set_visible(False)

(png, svg, pdf)

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

This sub-package should be considered experimental and subject to API changes in the future if user feedback calls for it.

Full change log

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

Renamed/removed functionality