Skip to content

Commit

Permalink
base distribution on older numpy versions to avoid ABI problems
Browse files Browse the repository at this point in the history
  • Loading branch information
bwinkel committed Feb 24, 2019
1 parent f72c4b3 commit 601f77d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 92 deletions.
100 changes: 37 additions & 63 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ env:
# For this package-template, we include examples of Cython modules,
# so Cython is required for testing. If your package does not include
# Cython code, you can set CONDA_DEPENDENCIES=''
- CONDA_DEPENDENCIES='Cython pytest'
- CONDA_DEPENDENCIES_DOC='Cython sphinx-astropy pytest scipy astroquery reproject'
- CONDA_DEPENDENCIES='Cython pytest pytest-doctestplus'
- CONDA_DEPENDENCIES_DOC='Cython sphinx-astropy pytest scipy astroquery reproject pytest-doctestplus'

# List other runtime dependencies for the package that are available as
# pip packages here.
Expand Down Expand Up @@ -80,63 +80,61 @@ matrix:

include:

# We have to make the releases based on rather old numpy version
# otherwise users will keep getting "incompatible API" errors
# (For more information on ABI problems with numpy see:
# https://stackoverflow.com/questions/17709641/valueerror-numpy-dtype-has-the-wrong-size-try-recompiling/18369312)
# for Windows we'll use 1.11, for Linux/MacOS 1.9 is used

# Standard linux; also used for sdist'ing
- os: linux
env: DO_DIST=YES

# MacOS X - clang
# not working, even though we added the necessary compiler flags
# - os: osx
# osx_image: xcode8.3
# env:
# - LDFLAGS='-L/usr/local/opt/libomp/lib -Wl,-rpath,/usr/local/opt/libomp/lib -lomp'
# - CPPFLAGS='-I/usr/local/opt/libomp/include -Xpreprocessor -stdlib=libc++'
# - COMPILER='clang'
env:
- DO_DIST=YES
- NUMPY_VERSION=1.11
# - ASTROPY_VERSION=stable
- ASTROPY_VERSION=2.0.11 # need old astropy, for numpy 1.9

# MacOS X - LLVM
# compiles and builds, but tests often not running (seg-fault?)
# MacOS X - conda-clang, release
- os: osx
osx_image: xcode8.3
env:
- CC='/usr/local/opt/llvm/bin/clang'
- CXX='/usr/local/opt/llvm/bin/clang++'
- CXX11='/usr/local/opt/llvm/bin/clang++'
- LDFLAGS='-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -lgomp'
- CPPFLAGS='-I/usr/local/opt/llvm/include -stdlib=libc++'
- COMPILER='llvm'
- DO_MAC_DIST=YES
- COMPILER='conda-clang'
- NUMPY_VERSION=1.11
- ASTROPY_VERSION=2.0.11

# MacOS X - gcc
# MacOS X - conda-clang, release
- os: osx
osx_image: xcode8.3
env:
- COMPILER='gcc'
- PYTHON_VERSION=3.6
- DO_MAC_DIST=YES
- COMPILER='conda-clang'
- NUMPY_VERSION=1.11
- ASTROPY_VERSION=2.0.11

# MacOS X - conda-clang
# MacOS X - conda-clang, release
- os: osx
osx_image: xcode8.3
env:
- PYTHON_VERSION=3.5
- DO_MAC_DIST=YES
- COMPILER='conda-clang'
- NUMPY_VERSION=1.11
- ASTROPY_VERSION=2.0.11

# MacOS X - gcc
- os: osx
osx_image: xcode8.3
env:
- COMPILER='gcc'

# MacOS X - conda-gcc
- os: osx
osx_image: xcode8.3
env:
- COMPILER='conda-gcc'

# MacOS X - conda-llvm
# not working at all, the packages (see below) seem to not install
# a compiler
# - os: osx
# osx_image: xcode8.3
# env:
# - CC='/Users/travis/miniconda/bin/clang'
# - CXX='/Users/travis/miniconda/bin/clang++'
# - CXX11='/Users/travis/miniconda/bin/clang++'
# - LDFLAGS='-L/Users/travis/miniconda/lib -Wl,-rpath,/Users/travis/miniconda/lib -lgomp'
# - CPPFLAGS='-I/Users/travis/miniconda/include -stdlib=libc++'
# - COMPILER='conda-llvm'

# Do a coverage test.
- os: linux
env: SETUP_CMD='test --coverage'
Expand All @@ -148,39 +146,15 @@ matrix:
- PYTHON_VERSION=3.6
- SETUP_CMD='build_docs'
- CONDA_DEPENDENCIES=$CONDA_DEPENDENCIES_DOC
- NUMPY_VERSION=1.14.3
- ASTROPY_VERSION=3.0.2
- NUMPY_VERSION=1.11
- ASTROPY_VERSION=2.0.11
- UPLOAD_DOCS=YES

# Now try Astropy dev with the latest Python and LTS with Python 2.7 and 3.x.
# Now try Astropy dev with the latest Python
- os: linux
env: ASTROPY_VERSION=development
EVENT_TYPE='pull_request push cron'

# No python 2.7 support anymore!
# - os: linux
# env: PYTHON_VERSION=2.7 ASTROPY_VERSION=lts

# - os: linux
# env: ASTROPY_VERSION=lts

# Try all python versions and Numpy versions. Since we can assume that
# the Numpy developers have taken care of testing Numpy with different
# versions of Python, we can vary Python and Numpy versions at the same
# time.

- os: linux
env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.12
# - os: linux
# env: PYTHON_VERSION=3.6 NUMPY_VERSION=1.13
# - os: linux
# env: NUMPY_VERSION=1.14

# Try numpy pre-release
# - os: linux
# env: NUMPY_VERSION=prerelease
# EVENT_TYPE='pull_request push cron'

# Do a PEP8 test with flake8
- os: linux
env: MAIN_CMD='flake8 cygrid --count --show-source --statistics $FLAKE8_OPT' SETUP_CMD=''
Expand Down
37 changes: 23 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ environment:
# For this package-template, we include examples of Cython modules,
# so Cython is required for testing. If your package does not include
# Cython code, you can set CONDA_DEPENDENCIES: ""
CONDA_DEPENDENCIES: "Cython pytest twine"
CONDA_DEPENDENCIES: "Cython pytest pytest-doctestplus twine"

# List other runtime dependencies for the package that are available as
# pip packages here.
Expand All @@ -32,28 +32,37 @@ environment:
CONDA_CHANNELS: "conda-forge"

matrix:
# We test Python 2.7 for Python 2 support.
# Apparently not working on Windows
# - PYTHON_VERSION: "2.7"
# ASTROPY_VERSION: "stable"
# NUMPY_VERSION: "stable"

# We test Python 3.5 for Python 3 support.
# We have to make the releases based on rather old numpy version
# otherwise users will keep getting "incompatible API" errors
# (For more information on ABI problems with numpy see:
# https://stackoverflow.com/questions/17709641/valueerror-numpy-dtype-has-the-wrong-size-try-recompiling/18369312)
# for Windows we'll use 1.11, for Linux/MacOS 1.9 is used

- PYTHON_VERSION: "3.5"
ASTROPY_VERSION: "stable"
NUMPY_VERSION: "stable"
ASTROPY_VERSION: "2.0.11"
NUMPY_VERSION: "1.11"
DO_RELEASE: "yes"

- PYTHON_VERSION: "3.6"
ASTROPY_VERSION: "2.0.11"
NUMPY_VERSION: "1.11"
DO_RELEASE: "yes"

# We test Python 3.7 for Python 3 support.
- PYTHON_VERSION: "3.7"
ASTROPY_VERSION: "2.0.11"
NUMPY_VERSION: "1.11"
DO_RELEASE: "yes"

# try more recent numpy+astropy

- PYTHON_VERSION: "3.5"
ASTROPY_VERSION: "stable"
NUMPY_VERSION: "stable"

- PYTHON_VERSION: "3.6"
# ASTROPY_VERSION: "2.0"
# NUMPY_VERSION: "1.11"
- PYTHON_VERSION: "3.7"
ASTROPY_VERSION: "stable"
NUMPY_VERSION: "stable"
DO_RELEASE: "yes"

platform:
-x64
Expand Down
32 changes: 17 additions & 15 deletions docs/user_manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,14 @@ we will simply create a mock data set, with the help of a utility function,
... )

>>> np.set_printoptions(precision=4)
>>> print(lons) # doctest: +FLOAT_CMP
[59.473 61.3992 56.8253 ... 59.957 57.5156 59.176 ]
>>> print(lats) # doctest: +FLOAT_CMP
[28.0106 31.0641 30.3142 ... 28.5785 32.1307 28.8626]
>>> print(signal) # doctest: +FLOAT_CMP
[ 0.0856 1.1899 -0.3375 ... 1.7997 -0.5739 0.0358]
>>> if np.__version__ >= '1.14':
... np.set_printoptions(legacy='1.13')
>>> print(lons) # doctest: +FLOAT_CMP +NORMALIZE_WHITESPACE
[59.473 61.3992 56.8253 ..., 59.957 57.5156 59.176 ]
>>> print(lats) # doctest: +FLOAT_CMP +NORMALIZE_WHITESPACE
[28.0106 31.0641 30.3142 ..., 28.5785 32.1307 28.8626]
>>> print(signal) # doctest: +FLOAT_CMP +NORMALIZE_WHITESPACE
[ 0.0856 1.1899 -0.3375 ..., 1.7997 -0.5739 0.0358]

.. note::

Expand Down Expand Up @@ -481,14 +483,14 @@ the `signal`)::
The result can be queried using the `~cygrid.WcsGrid.get_data` method::

>>> gridded_data = gridder.get_datacube()
>>> print(gridded_data) # doctest: +FLOAT_CMP
[[[ 0.0519 -0.0529 0.0298 ... 0.0086 0.0492 0.1135]
[ 0.0456 -0.0954 -0.0979 ... -0.0122 -0.0485 -0.0387]
[ 0.0309 -0.0625 -0.0642 ... -0.0075 -0.0275 -0.038 ]
...
[-0.0313 -0.0172 -0.0346 ... -0.008 0.117 0.0905]
[-0.1239 -0.0636 -0.0854 ... -0.0311 0.0787 0.0655]
[-0.0851 -0.0691 -0.0671 ... 0.1039 0.1192 0.0964]]]
>>> print(gridded_data) # doctest: +FLOAT_CMP +NORMALIZE_WHITESPACE
[[[ 0.0519 -0.0529 0.0298 ..., 0.0086 0.0492 0.1135]
[ 0.0456 -0.0954 -0.0979 ..., -0.0122 -0.0485 -0.0387]
[ 0.0309 -0.0625 -0.0642 ..., -0.0075 -0.0275 -0.038 ]
...,
[-0.0313 -0.0172 -0.0346 ..., -0.008 0.117 0.0905]
[-0.1239 -0.0636 -0.0854 ..., -0.0311 0.0787 0.0655]
[-0.0851 -0.0691 -0.0671 ..., 0.1039 0.1192 0.0964]]]

As said above, this has three dimensions, but the third axis (the spectral
axis) has length-1 and is not necessary in this case. We can get rid of it::
Expand Down Expand Up @@ -863,7 +865,7 @@ pairs to the constructor::
>>> gridder.grid(lons, lats, signal[:, np.newaxis])

>>> gridded_sightlines = gridder.get_datacube().squeeze()
>>> print( # doctest: +FLOAT_CMP
>>> print(
... 'lon lat sightline-value\n',
... '\n'.join(
... '{:4.1f} {:4.1f} {:6.3f}'.format(*t)
Expand Down

0 comments on commit 601f77d

Please sign in to comment.