Commit 57e888d3 authored by Ole Streicher's avatar Ole Streicher

New upstream version 3.0.2

parent 5e40bb0a
3.0.2 (2018-04-23)
==================
Bug Fixes
---------
astropy.coordinates
^^^^^^^^^^^^^^^^^^^
- Computing a 3D separation between two ``SkyCoord`` objects (with the
``separation_3d`` method) now works with or without velocity data attached to
the objects. [#7387]
astropy.io.votable
^^^^^^^^^^^^^^^^^^
- Fix validate with xmllint=True. [#7255, #7283]
astropy.modeling
^^^^^^^^^^^^^^^^
- ``FittingWithOutlierRemoval`` now handles model sets, as long as the
underlying fitter supports masked values. [#7199]
- Remove assumption that ``model_set_axis == 0`` for 2D models in
``LinearLSQFitter``. [#7317, #7199]
- Fix the shape of the outputs when a model set is evaluated with
``model_set_axis=False`` . [#7317]
astropy.stats
^^^^^^^^^^^^^
- Accept a tuple for the ``axis`` parameter in ``sigma_clip``, like the
underlying ``numpy`` functions and some other functions in ``stats``. [#7199]
astropy.tests
^^^^^^^^^^^^^
- The function ``quantity_allclose`` was moved to the ``units`` package with
the new, shorter name ``allclose``. This eliminates a runtime dependency on
``pytest`` which was causing issues for some affiliated packages. The old
import will continue to work but may be deprecated in the future. [#7252]
astropy.units
^^^^^^^^^^^^^
- Added a units-aware ``allclose`` function (this was previously available in
the ``tests`` module as ``quantity_allclose``). To complement ``allclose``,
a new ``isclose`` function is also added and backported. [#7252]
3.0.1 (2018-03-12)
==================
Bug Fixes
---------
astropy.io.ascii
^^^^^^^^^^^^^^^^
- Fix a unicode decode error when reading a table with non-ASCII characters.
The fast C reader cannot handle unicode so the code now uses the pure-Python
reader in this case. [#7103]
astropy.io.fits
^^^^^^^^^^^^^^^
- Updated the bundled CFITSIO library to 3.430. This is to remedy a critical
security vulnerability that was identified by NASA. See
``cextern/cfitsio/docs/changes.txt`` for additional information. [#7274]
astropy.io.misc
^^^^^^^^^^^^^^^
- Make sure that a sufficiently recent version of ASDF is installed when
running test suite against ASDF tags and schemas. [#7205]
astropy.io.registry
^^^^^^^^^^^^^^^^^^^
- Fix reading files with serialized metadata when using a Table subclass. [#7213]
astropy.io.votable
^^^^^^^^^^^^^^^^^^
- Fix lookup fields by ID. [#7208]
astropy.modeling
^^^^^^^^^^^^^^^^
- Fix model set evaluation over common input when model_set_axis > 0. [#7222]
- Fixed the evaluation of compound models with units. This required adding the
ability to have ``input_units_strict`` and ``input_units_allow_dimensionless``
be dictionaries with input names as keys. [#6952]
astropy.units
^^^^^^^^^^^^^
- ``quantity_helper`` no longer requires ``scipy>=0.18``. [#7219]
3.0 (2018-02-12)
================
......@@ -227,6 +330,7 @@ astropy.visualization
``WCSPixel2WorldTransform`` classes by setting ``has_inverse`` to ``True``.
In order to implement a unit test, also implement the equality comparison
operator for both classes. [#6531]
- Added automatic hiding of axes labels when no tick labels are drawn on that
axis. This parameter can be configured with
``WCSAxes.coords[*].set_axislabel_visibility_rule`` so that labels are automatically
......@@ -387,10 +491,6 @@ astropy.io.fits
- Always use the 'D' format for floating point values in ascii tables. [#6938]
- Fix bug of dropping table column meta (format, description, meta) when
writing a table to FITS using Table.write(). Since #6912 this should be
written if it would be lost. [#7147]
astropy.table
^^^^^^^^^^^^^
......@@ -454,6 +554,93 @@ Other Changes and Additions
- The bundled version of PLY was updated to 3.10. [#7174]
2.0.6 (2018-04-23)
==================
Bug Fixes
---------
astropy.convolution
^^^^^^^^^^^^^^^^^^^
- convolve(boundary=None) requires the kernel to be smaller than the image.
This was never actually checked, it now is and an exception is raised.
[#7313]
astropy.units
^^^^^^^^^^^^^
- ``u.quantity_input`` no longer errors if the return annotation for a
function is ``None``. [#7336, #7380]
astropy.visualization
^^^^^^^^^^^^^^^^^^^^^
- Explicilty default to origin='lower' in WCSAxes. [#7331]
- Lists of units are now converted in the Matplotlib unit converter. This means
that for Matplotlib versions later than 2.2, more plotting functions now work
with units (e.g. errorbar). [#7037]
Other Changes and Additions
---------------------------
- Updated the bundled CFITSIO library to 3.44. This is to remedy another
critical security vulnerability that was identified by NASA. See
``cextern/cfitsio/docs/changes.txt`` for additional information. [#7370]
2.0.5 (2018-03-12)
==================
Bug Fixes
---------
astropy.coordinates
^^^^^^^^^^^^^^^^^^^
- Add a workaround for a bug in the einsum function in Numpy 1.14.0. [#7187]
- Fix problems with printing ``Angle`` instances under numpy 1.14.1. [#7234]
astropy.io.fits
^^^^^^^^^^^^^^^
- Fixed the ``fitsdiff`` script for matching fits file with one in a
directory path. [#7085]
- Make sure that lazily-loaded ``HDUList`` is automatically loaded when calling
``hdulist.pop``. [#7186]
astropy.modeling
^^^^^^^^^^^^^^^^
- Propagate weights to underlying fitter in ``FittingWithOutlierRemoval`` [#7249]
astropy.tests
^^^^^^^^^^^^^
- Support dotted package names as namespace packages when gathering test
coverage. [#7170]
astropy.visualization
^^^^^^^^^^^^^^^^^^^^^
- Matplotlib axes have the ``axisbelow`` property to control the z-order of
ticks, tick labels, and grid lines. WCSAxes will now respect this property.
This is useful for drawing scale bars or inset boxes, which should have a
z-order that places them above all ticks and gridlines. [#7098]
Other Changes and Additions
---------------------------
- Updated the bundled CFITSIO library to 3.430. This is to remedy a critical
security vulnerability that was identified by NASA. See
``cextern/cfitsio/docs/changes.txt`` for additional information. [#7274, #7275]
2.0.4 (2018-02-06)
==================
......
Metadata-Version: 1.2
Metadata-Version: 2.1
Name: astropy
Version: 3.0
Version: 3.0.2
Summary: Community-developed python astronomy tools
Home-page: http://astropy.org
Author: The Astropy Developers
Author-email: astropy.team@gmail.com
License: BSD
Description-Content-Type: UNKNOWN
Description:
Astropy is a package intended to contain core functionality and some
common tools needed for performing astronomy and astrophysics research with
......@@ -27,3 +26,4 @@ Classifier: Topic :: Scientific/Engineering :: Physics
Requires: numpy
Provides: astropy
Requires-Python: >=3.5
Provides-Extra: test
......@@ -135,7 +135,6 @@ import pkg_resources
from setuptools import Distribution
from setuptools.package_index import PackageIndex
from setuptools.sandbox import run_setup
from distutils import log
from distutils.debug import DEBUG
......@@ -475,9 +474,10 @@ class _Bootstrapper(object):
# setup.py exists we can generate it
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
with _silence():
run_setup(os.path.join(path, 'setup.py'),
['egg_info'])
# We use subprocess instead of run_setup from setuptools to
# avoid segmentation faults - see the following for more details:
# https://github.com/cython/cython/issues/2104
sp.check_output([sys.executable, 'setup.py', 'egg_info'], cwd=path)
for dist in pkg_resources.find_distributions(path, True):
# There should be only one...
......
......@@ -11,13 +11,15 @@ import sys
import os
from warnings import warn
__minimum_python_version__ = '3.5'
__minimum_numpy_version__ = '1.10.0'
class UnsupportedPythonError(Exception):
pass
# This is the same check as the one at the top of setup.py
__minimum_python_version__ = '3.5'
if sys.version_info < tuple((int(val) for val in __minimum_python_version__.split('.'))):
raise UnsupportedPythonError("Astropy does not support Python < {}".format(__minimum_python_version__))
......
......@@ -5794,7 +5794,7 @@ def pmsafe(ra1, dec1, pmr1, pmd1, px1, rv1, ep1a, ep1b, ep2a, ep2b):
rv2_out = rv2_out.reshape(rv2_out.shape[1:])
return ra2_out, dec2_out, pmr2_out, pmd2_out, px2_out, rv2_out
STATUS_CODES['pmsafe'] = {0: 'no warnings or errors', 1: 'distance overridden (Note 6)', 2: 'excessive velocity (Note 7)', 'else': 'binary logical OR of the above warnings', 4: "solution didn't converge (Note 8)", -1: 'system error (should not occur)'}
STATUS_CODES['pmsafe'] = {0: 'no warnings or errors', 1: 'distance overridden (Note 6)', 2: 'excessive velocity (Note 7)', 4: "solution didn't converge (Note 8)", 'else': 'binary logical OR of the above warnings', -1: 'system error (should not occur)'}
......@@ -16799,7 +16799,7 @@ def starpv(ra, dec, pmr, pmd, px, rv):
pv_out = pv_out.reshape(pv_out.shape[1:])
return pv_out
STATUS_CODES['starpv'] = {0: 'no warnings', 1: 'distance overridden (Note 6)', 2: 'excessive speed (Note 7)', 'else': 'binary logical OR of the above', 4: "solution didn't converge (Note 8)"}
STATUS_CODES['starpv'] = {0: 'no warnings', 1: 'distance overridden (Note 6)', 2: 'excessive speed (Note 7)', 4: "solution didn't converge (Note 8)", 'else': 'binary logical OR of the above'}
......@@ -17565,7 +17565,7 @@ def starpm(ra1, dec1, pmr1, pmd1, px1, rv1, ep1a, ep1b, ep2a, ep2b):
rv2_out = rv2_out.reshape(rv2_out.shape[1:])
return ra2_out, dec2_out, pmr2_out, pmd2_out, px2_out, rv2_out
STATUS_CODES['starpm'] = {0: 'no warnings or errors', 1: 'distance overridden (Note 6)', 2: 'excessive velocity (Note 7)', 'else': 'binary logical OR of the above warnings', 4: "solution didn't converge (Note 8)", -1: 'system error (should not occur)'}
STATUS_CODES['starpm'] = {0: 'no warnings or errors', 1: 'distance overridden (Note 6)', 2: 'excessive velocity (Note 7)', 4: "solution didn't converge (Note 8)", 'else': 'binary logical OR of the above warnings', -1: 'system error (should not occur)'}
......
......@@ -9,9 +9,12 @@ from importlib.util import find_spec
from astropy.tests.plugins.display import PYTEST_HEADER_MODULES
from astropy.tests.helper import enable_deprecations_as_exceptions
if find_spec('asdf') is not None:
pytest_plugins = ['asdf.tests.schema_tester']
if find_spec('asdf') is not None:
from asdf import __version__ as asdf_version
if asdf_version >= '2.0.0':
pytest_plugins = ['asdf.tests.schema_tester']
PYTEST_HEADER_MODULES['Asdf'] = 'asdf'
enable_deprecations_as_exceptions(
include_astropy_deprecations=False,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
cimport numpy as np
from .utils import KernelSizeError
DTYPE = float
......@@ -11,6 +12,28 @@ cdef extern from "numpy/npy_math.h" nogil:
cimport cython
cdef _raise_if_kernel_larger_than_array(const np.npy_intp * array_shape, const np.npy_intp * kernel_shape, length):
"""
Helper function to raise an exception due to the following:
For boundary=None only the center space is convolved. All array indices within a
distance kernel.shape//2 from the edge are completely ignored (zeroed).
E.g. (1D list) only the indices len(kernel)//2 : len(array)-len(kernel)//2
are convolved. It is therefore not possible to use this method to convolve an
array by a kernel that is larger* than the array - as ALL pixels would be ignored
leaving an array of only zeros.
* For even kernels the correctness condition is array_shape > kernel_shape.
For odd kernels it is:
array_shape >= kernel_shape OR array_shape > kernel_shape-1 OR array_shape > 2*(kernel_shape//2).
Since the latter is equal to the former two for even lengths, the latter condition is complete.
"""
for i in range(length):
if not array_shape[i] > 2*(kernel_shape[i]//2):
raise KernelSizeError("for boundary=None all kernel axes must be smaller than array's. "
"Triggered by: if not numpy.all(array.shape > 2*(kernel.shape//2)). "
"Use boundary in ('fill', 'extend', 'wrap') instead.")
@cython.boundscheck(False) # turn off bounds-checking for entire function
def convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f,
......@@ -20,6 +43,8 @@ def convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f,
if g.shape[0] % 2 != 1:
raise ValueError("Convolution kernel must have odd dimensions")
_raise_if_kernel_larger_than_array(f.shape, g.shape, 1)
assert f.dtype == DTYPE and g.dtype == DTYPE
cdef int nx = f.shape[0]
......@@ -68,6 +93,8 @@ def convolve2d_boundary_none(np.ndarray[DTYPE_t, ndim=2] f,
if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1:
raise ValueError("Convolution kernel must have odd dimensions")
_raise_if_kernel_larger_than_array(f.shape, g.shape, 2)
assert f.dtype == DTYPE and g.dtype == DTYPE
cdef int nx = f.shape[0]
......@@ -122,6 +149,8 @@ def convolve3d_boundary_none(np.ndarray[DTYPE_t, ndim=3] f,
if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1:
raise ValueError("Convolution kernel must have odd dimensions")
_raise_if_kernel_larger_than_array(f.shape, g.shape, 3)
assert f.dtype == DTYPE and g.dtype == DTYPE
cdef int nx = f.shape[0]
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -700,9 +700,6 @@ def convolve_fft(array, kernel, boundary='fill', fill_value=0.,
# need to re-zero weights outside of the image (if it is padded, we
# still don't weight those regions)
bigimwt[arrayslices] = wtsm.real[arrayslices]
# curiously, at the floating-point limit, can get slightly negative numbers
# they break the min_wt=0 "flag" and must therefore be removed
bigimwt[bigimwt < 0] = 0
else:
bigimwt = 1
......@@ -724,11 +721,14 @@ def convolve_fft(array, kernel, boundary='fill', fill_value=0.,
if interpolate_nan:
rifft = (ifftn(fftmult)) / bigimwt
if not np.isscalar(bigimwt):
rifft[bigimwt < min_wt] = np.nan
if min_wt == 0.0:
rifft[bigimwt == 0.0] = 0.0
if min_wt > 0.:
rifft[bigimwt < min_wt] = np.nan
else:
# Set anything with no weight to zero (taking into account
# slight offsets due to floating-point errors).
rifft[bigimwt < 10 * np.finfo(bigimwt.dtype).eps] = 0.0
else:
rifft = (ifftn(fftmult))
rifft = ifftn(fftmult)
if preserve_nan:
rifft[arrayslices][nanmaskarray] = np.nan
......
......@@ -6,7 +6,6 @@ This module contains the fundamental classes used for representing
coordinates in astropy.
"""
import math
from collections import namedtuple
import numpy as np
......@@ -14,6 +13,7 @@ import numpy as np
from . import angle_utilities as util
from .. import units as u
from ..utils import isiterable
from ..utils.compat import NUMPY_LT_1_14_1, NUMPY_LT_1_14_2
__all__ = ['Angle', 'Latitude', 'Longitude']
......@@ -426,19 +426,26 @@ class Angle(u.SpecificTypeQuantity):
ok &= np.all(self < Angle(upper))
return bool(ok)
def __str__(self):
def _str_helper(self, format=None):
if self.isscalar:
return str(self.to_string())
return self.to_string(format=format)
if NUMPY_LT_1_14_1 or not NUMPY_LT_1_14_2:
def formatter(x):
return x.to_string(format=format)
else:
return np.array2string(self, formatter={'all': lambda x: x.to_string()})
# In numpy 1.14.1, array2print formatters get passed plain numpy scalars instead
# of subclass array scalars, so we need to recreate an array scalar.
def formatter(x):
return self._new_view(x).to_string(format=format)
return np.array2string(self, formatter={'all': formatter})
def __str__(self):
return self._str_helper()
def _repr_latex_(self):
if self.isscalar:
return self.to_string(format='latex')
else:
# Need to do a magic incantation to convert to str. Regular str
# or array2string causes all backslashes to get doubled.
return np.array2string(self, formatter={'all': lambda x: x.to_string(format='latex')})
return self._str_helper(format='latex')
def _no_angle_subclass(obj):
......
......@@ -119,7 +119,13 @@ def norm(p):
"""
Normalise a p-vector.
"""
return p/np.sqrt(np.einsum('...i,...i', p, p))[..., np.newaxis]
if np.__version__ == '1.14.0':
# there is a bug in numpy v1.14.0 (fixed in 1.14.1) that causes
# this einsum call to break with the default of optimize=True
# see https://github.com/astropy/astropy/issues/7051
return p / np.sqrt(np.einsum('...i,...i', p, p, optimize=False))[..., np.newaxis]
else:
return p / np.sqrt(np.einsum('...i,...i', p, p))[..., np.newaxis]
def get_cip(jd1, jd2):
......
......@@ -146,6 +146,8 @@ def get_icrs_coordinates(name):
# There are some cases where urllib2 does not catch socket.timeout
# especially while receiving response data on an already previously
# working request
e.reason = "Request took longer than the allowed {:.1f} " \
"seconds".format(data.conf.remote_timeout)
exceptions.append(e)
continue
......
......@@ -978,7 +978,9 @@ class SkyCoord(ShapedLikeNDArray):
raise ValueError('The other object does not have a distance; '
'cannot compute 3d separation.')
return Distance((self.cartesian - other.cartesian).norm())
c1 = self.cartesian.without_differentials()
c2 = other.cartesian.without_differentials()
return Distance((c1 - c2).norm())
def spherical_offsets_to(self, tocoord):
r"""
......
......@@ -5,7 +5,7 @@ Accuracy tests for Ecliptic coordinate systems.
import numpy as np
from ....tests.helper import quantity_allclose
from ....units import allclose as quantity_allclose
from .... import units as u
from ... import SkyCoord
from ...builtin_frames import FK5, ICRS, GCRS, GeocentricTrueEcliptic, BarycentricTrueEcliptic, HeliocentricTrueEcliptic
......
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import pytest
import numpy as np
from numpy.testing.utils import assert_allclose, assert_array_equal
from numpy.testing import assert_allclose, assert_array_equal
from ..angles import Longitude, Latitude, Angle
from ... import units as u
......
......@@ -17,11 +17,11 @@ import numpy as np
from numpy.random import randn
from numpy import testing as npt
from ...tests.helper import (raises, quantity_allclose as allclose,
assert_quantity_allclose as assert_allclose)
from ...tests.helper import raises, assert_quantity_allclose as assert_allclose
from ... import units as u
from ... import time
from ... import coordinates as coords
from ...units import allclose
try:
import scipy # pylint: disable=W0611
......
......@@ -9,11 +9,10 @@ from ..distances import Distance
from ..builtin_frames import (ICRS, FK5, FK4, FK4NoETerms, Galactic,
Supergalactic, Galactocentric, HCRS, GCRS, LSR)
from .. import SkyCoord
from ...tests.helper import (quantity_allclose as allclose,
assert_quantity_allclose as assert_allclose)
from ...tests.helper import assert_quantity_allclose as assert_allclose
from .. import EarthLocation, CartesianRepresentation
from ...time import Time
from ...units import allclose
# used below in the next parametrized test
m31_sys = [ICRS, FK5, FK4, Galactic]
......
......@@ -11,7 +11,7 @@ import numpy as np
from numpy import testing as npt
from ... import units as u
from ...tests.helper import quantity_allclose
from ...units import allclose as quantity_allclose
from .. import Longitude, Latitude, Distance, CartesianRepresentation
from ..builtin_frames import ICRS, Galactic
......
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initialization of angles not already covered by the API tests"""
import pickle
......@@ -12,7 +10,7 @@ import numpy as np
from ..earth import EarthLocation, ELLIPSOIDS
from ..angles import Longitude, Latitude
from ...tests.helper import quantity_allclose
from ...units import allclose as quantity_allclose
from ... import units as u
from ...time import Time
from ... import constants
......@@ -288,21 +286,34 @@ def test_repr_latex():
@pytest.mark.remote_data
def test_of_address():
# no match
# just a location
try:
loc = EarthLocation.of_address("New York, NY")
except NameResolveError as e:
# Google map API limit might surface even here in Travis CI.
pytest.xfail(str(e))
else:
assert quantity_allclose(loc.lat, 40.7128*u.degree)
assert quantity_allclose(loc.lon, -74.0059*u.degree)
assert np.allclose(loc.height.value, 0.)
# Put this one here as buffer to get around Google map API limit per sec.
# no match: This always raises NameResolveError
with pytest.raises(NameResolveError):
EarthLocation.of_address("lkjasdflkja")
# just a location
loc = EarthLocation.of_address("New York, NY")
assert quantity_allclose(loc.lat, 40.7128*u.degree)
assert quantity_allclose(loc.lon, -74.0059*u.degree)
assert np.allclose(loc.height.value, 0.)
# a location and height
loc = EarthLocation.of_address("New York, NY", get_height=True)
assert quantity_allclose(loc.lat, 40.7128*u.degree)
assert quantity_allclose(loc.lon, -74.0059*u.degree)
assert quantity_allclose(loc.height, 10.438659669*u.meter, atol=1.*u.cm)
try:
loc = EarthLocation.of_address("New York, NY", get_height=True)
except NameResolveError as e:
# Buffer above sometimes insufficient to get around API limit but
# we also do not want to drag things out with time.sleep(0.195),
# where 0.195 was empirically determined on some physical machine.
pytest.xfail(str(e))
else:
assert quantity_allclose(loc.lat, 40.7128*u.degree)
assert quantity_allclose(loc.lon, -74.0059*u.degree)
assert quantity_allclose(loc.height, 10.438659669*u.meter, atol=1.*u.cm)
def test_geodetic_tuple():
......
......@@ -4,7 +4,7 @@
import pytest
import numpy as np
from ...tests.helper import quantity_allclose