|
25 | 25 | hdu1 = astropy.io.fits.open(joinpath("data", "gc_2mass_k.fits"))[1]
|
26 | 26 | hdu2 = astropy.io.fits.open(joinpath("data", "gc_msx_e.fits"))[1]
|
27 | 27 |
|
28 |
| - function check_diff(arr1, arr2) |
29 |
| - diff = 1e-3 |
30 |
| - count = 0 |
31 |
| - for i in 1 : size(arr1)[1] - 1 |
32 |
| - for j in 1 : size(arr2)[2] - 1 |
33 |
| - if abs(arr1[i,j] - arr2[j,i]) > diff |
34 |
| - count+=1 |
35 |
| - end |
36 |
| - end |
37 |
| - end |
38 |
| - return iszero(count) |
39 |
| - end |
40 |
| - |
41 |
| - @test check_diff(reproject(imgin, imgout, order = 0)[1], rp.reproject_interp(hdu2, hdu1.header, order = 0)[1]) == true |
42 |
| - @test check_diff(reproject(imgout, imgin, order = 0)[1], rp.reproject_interp(hdu1, hdu2.header, order = 0)[1]) == true |
43 |
| - @test check_diff(reproject(imgin, imgout, order = 1)[1], rp.reproject_interp(hdu2, hdu1.header, order = 1)[1]) == true |
44 |
| - @test check_diff(reproject(imgin, imgout, order = 2)[1], rp.reproject_interp(hdu2, hdu1.header, order = 2)[1]) == true |
45 |
| - @test check_diff(reproject(imgin[1], imgout[1], shape_out = (1000,1000))[1], |
46 |
| - rp.reproject_interp(hdu2, astropy.wcs.WCS(hdu1.header), shape_out = (1000,1000))[1]) == true |
| 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) |
| 32 | + @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) |
47 | 34 |
|
48 | 35 | wcs = WCSTransform(2; ctype = ["RA---AIR", "DEC--AIR"], radesys = "UNK")
|
49 | 36 | @test_throws ArgumentError reproject(imgin, wcs, shape_out = (100,100))
|
|
0 commit comments