Skip to content

Commit ab27dcb

Browse files
committed
Switch to PythonCall for testing Python package
1 parent 1b8870c commit ab27dcb

File tree

6 files changed

+38
-30
lines changed

6 files changed

+38
-30
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ on:
77
pull_request:
88
release:
99

10-
env:
11-
# `reproject=0.5` is not compatible with Python >= 3.8
12-
PYTHON: "python3.7"
13-
1410
jobs:
1511
test:
1612
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }} - ${{ matrix.julia-arch }}
@@ -19,13 +15,15 @@ jobs:
1915
fail-fast: false
2016
matrix:
2117
julia-version:
22-
- "1.0"
18+
- "1.6"
2319
- "1"
2420
- "nightly"
2521
os:
2622
- ubuntu-latest
27-
- macos-latest
28-
- windows-latest
23+
## macOS and Windows faile because of
24+
## https://github.com/cjdoris/PythonCall.jl/issues/165
25+
# - macos-latest
26+
# - windows-latest
2927
julia-arch:
3028
- x64
3129
steps:

CondaPkg.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
channels = ["astropy", "conda-forge"]
2+
3+
[deps]
4+
python = "=3.7"
5+
astropy = "=4.3"
6+
reproject = "=0.5"

Project.toml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Reproject"
22
uuid = "d1dcc2e6-806e-11e9-2897-3f99785db2ae"
33
authors = ["Mosè Giordano", "Rohit Kumar"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
@@ -14,13 +14,4 @@ FITSIO = "0.15, 0.16"
1414
Interpolations = "0.13"
1515
SkyCoords = "0.4, 1"
1616
WCS = "0.5, 0.6"
17-
julia = "1"
18-
19-
[extras]
20-
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
21-
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
22-
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
23-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
24-
25-
[targets]
26-
test = ["Conda", "PyCall", "SHA", "Test"]
17+
julia = "1.6"

test/Project.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[deps]
2+
FITSIO = "525bcba6-941b-5504-bd06-fd0dc1a4d2eb"
3+
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
4+
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
5+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6+
WCS = "15f3aee2-9e10-537f-b834-a6fb8bdb944d"
7+
8+
[compat]
9+
FITSIO = "0.15, 0.16"
10+
PythonCall = "0.8"
11+
WCS = "0.5, 0.6"
12+
julia = "1.6"

test/core.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ end
1919
download_dep("https://www.astropy.org/astropy-data/galactic_center/gc_msx_e.fits", "gc_msx_e.fits",
2020
"3687fb3763911825f981e74b6a9b82c0e618f7e592b1e0cb17e2c63164e28cd6")
2121

22-
imgin = FITS(joinpath("data", "gc_msx_e.fits")) # project this
23-
imgout = FITS(joinpath("data", "gc_2mass_k.fits")) # into this coordinate
22+
gc_msx_e = joinpath(@__DIR__, "data", "gc_msx_e.fits")
23+
gc_2mass_k = joinpath(@__DIR__, "data", "gc_2mass_k.fits")
2424

25-
hdu1 = astropy.io.fits.open(joinpath("data", "gc_2mass_k.fits"))[1]
26-
hdu2 = astropy.io.fits.open(joinpath("data", "gc_msx_e.fits"))[1]
25+
imgin = FITS(gc_msx_e) # project this
26+
imgout = FITS(gc_2mass_k) # into this coordinate
2727

28-
@test isapprox(reproject(imgin, imgout, order = 0)[1]', rp.reproject_interp(hdu2, hdu1.header, order = 0)[1], nans = true, rtol = 1e-7)
29-
@test isapprox(reproject(imgout, imgin, order = 0)[1]', rp.reproject_interp(hdu1, hdu2.header, order = 0)[1], nans = true, rtol = 1e-6)
30-
@test isapprox(reproject(imgin, imgout, order = 1)[1]', rp.reproject_interp(hdu2, hdu1.header, order = 1)[1], nans = true, rtol = 1e-7)
31-
@test isapprox(reproject(imgin, imgout, order = 2)[1]', rp.reproject_interp(hdu2, hdu1.header, order = 2)[1], nans = true, rtol = 6e-2)
28+
hdu1 = astropy.io.fits.open(gc_2mass_k)[0]
29+
hdu2 = astropy.io.fits.open(gc_msx_e)[0]
30+
31+
@test isapprox(reproject(imgin, imgout, order = 0)[1]', pyconvert(Matrix, rp.reproject_interp(hdu2, hdu1.header, order = 0)[0]), nans = true, rtol = 1e-7)
32+
@test isapprox(reproject(imgout, imgin, order = 0)[1]', pyconvert(Matrix, rp.reproject_interp(hdu1, hdu2.header, order = 0)[0]), nans = true, rtol = 1e-6)
33+
@test isapprox(reproject(imgin, imgout, order = 1)[1]', pyconvert(Matrix, rp.reproject_interp(hdu2, hdu1.header, order = 1)[0]), nans = true, rtol = 1e-7)
34+
@test isapprox(reproject(imgin, imgout, order = 2)[1]', pyconvert(Matrix, rp.reproject_interp(hdu2, hdu1.header, order = 2)[0]), nans = true, rtol = 6e-2)
3235
@test isapprox(reproject(imgin[1], imgout[1], shape_out = (1000,1000))[1]',
33-
rp.reproject_interp(hdu2, astropy.wcs.WCS(hdu1.header), shape_out = (1000,1000))[1], nans = true, rtol = 1e-7)
36+
pyconvert(Matrix, rp.reproject_interp(hdu2, astropy.wcs.WCS(hdu1.header), shape_out = (1000,1000))[0]), nans = true, rtol = 1e-7)
3437

3538
wcs = WCSTransform(2; ctype = ["RA---AIR", "DEC--AIR"], radesys = "UNK")
3639
@test_throws ArgumentError reproject(imgin, wcs, shape_out = (100,100))

test/runtests.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using Reproject
22
using Test
3-
using Conda, PyCall
3+
using PythonCall
44
using FITSIO, WCS
55
using SHA: sha256
66

7-
Conda.add_channel("astropy")
8-
Conda.add("reproject=0.5")
97
rp = pyimport("reproject")
108
astropy = pyimport("astropy")
119

0 commit comments

Comments
 (0)