diff --git a/.travis.yml b/.travis.yml index 113c902..827456c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,7 +54,6 @@ env: matrix: # Make sure that egg_info works without dependencies - PYTHON_VERSION=2.7 SETUP_CMD='egg_info' - - PYTHON_VERSION=3.3 SETUP_CMD='egg_info' - PYTHON_VERSION=3.4 SETUP_CMD='egg_info' - PYTHON_VERSION=3.5 SETUP_CMD='egg_info' - PYTHON_VERSION=3.6 SETUP_CMD='egg_info' @@ -98,7 +97,7 @@ matrix: - os: linux env: PYTHON_VERSION=2.7 NUMPY_VERSION=1.7 - os: linux - env: PYTHON_VERSION=3.3 NUMPY_VERSION=1.8 + env: PYTHON_VERSION=3.4 NUMPY_VERSION=1.8 - os: linux env: PYTHON_VERSION=3.4 NUMPY_VERSION=1.9 - os: linux diff --git a/CHANGES.rst b/CHANGES.rst index 74d7967..0631a0e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,8 @@ 0.10 (unreleased) ----------------- -- No changes yet. +- Handle non-backwards compatible changes to astropy.constants in astropy 2.0. +- Handle deprecated longitude, latitude attributes for astropy >= 2.0. +- Remove tests against python 3.3 (3.4-3.6 are still tested). 0.9 (2017-05-11) ---------------- diff --git a/specsim/observation.py b/specsim/observation.py index b17733b..def1268 100644 --- a/specsim/observation.py +++ b/specsim/observation.py @@ -222,8 +222,13 @@ def initialize(config): nominal_start = exposure_start point_radec = pointing.transform_to('icrs') hour_angle = astropy.coordinates.Angle(adjust_ha) + try: + lon = location.lon + except AttributeError: + # Required for astropy < 2.0 + lon = location.longitude exposure_start = specsim.transform.adjust_time_to_hour_angle( - nominal_start, point_radec.ra, hour_angle, location.longitude) + nominal_start, point_radec.ra, hour_angle, lon) # Put the requested HA at the middle of the exposure. exposure_start -= 0.5 * constants['exposure_time'] diff --git a/specsim/transform.py b/specsim/transform.py index fe926cf..6c537a6 100644 --- a/specsim/transform.py +++ b/specsim/transform.py @@ -310,7 +310,12 @@ def create_observing_model(where, when, wavelength, temperature=15*u.deg_C, # See https://en.wikipedia.org/wiki/Vertical_pressure_variation if pressure is None: h = where.height - p0 = astropy.constants.atmosphere + # The atmosphere constant in astropy < 2.0 was renamed to atm in 2.0. + try: + p0 = astropy.constants.atm + except AttributeError: + # Fallback for astropy < 2.0. + p0 = astropy.constants.atmosphere g0 = astropy.constants.g0 R = astropy.constants.R air_molar_mass = 0.0289644 * u.kg / u.mol @@ -336,7 +341,7 @@ def sky_to_altaz(sky_coords, observing_model): two steps. First, define the atmosphere through which the sky is being observed with a call to :func:`create_observing_model`. Next, call this function. For example, to locate Polaris from Kitt Peak, observing at - a wavelength of 5400 Angstroms: + a wavelength of 5400 Angstroms (we expect altitude ~ longitude ~ 32 deg): >>> where = observatories['KPNO'] >>> when = astropy.time.Time('2001-01-01T00:00:00') @@ -346,8 +351,6 @@ def sky_to_altaz(sky_coords, observing_model): >>> print('alt = %.3f deg, az = %.3f deg' % ... (altaz.alt.to(u.deg).value, altaz.az.to(u.deg).value)) alt = 32.465 deg, az = 0.667 deg - >>> print('lat = %.3f deg' % where.latitude.to(u.deg).value) - lat = 31.963 deg The output shape is determined by the usual `numpy broadcasting rules `__ applied