|
1 |
| -@testset "reproject-core" begin |
2 |
| - if !isfile("data/gc_2mass_k.fits") |
3 |
| - mkpath("data") |
4 |
| - download("https://astropy.stsci.edu/data/galactic_center/gc_2mass_k.fits", "data/gc_2mass_k.fits") |
5 |
| - end |
6 |
| - if !isfile("data/gc_msx_e.fits") |
7 |
| - mkpath("data") |
8 |
| - download("https://astropy.stsci.edu/data/galactic_center/gc_msx_e.fits", "data/gc_msx_e.fits") |
| 1 | +function download_dep(orig, dest, hash) |
| 2 | + dest_file = joinpath("data", dest) |
| 3 | + if isfile(dest_file) |
| 4 | + dest_hash = open(dest_file, "r") do f |
| 5 | + bytes2hex(sha256(f)) |
| 6 | + end |
| 7 | + if dest_hash == hash |
| 8 | + return nothing |
| 9 | + end |
9 | 10 | end
|
| 11 | + mkpath("data") |
| 12 | + download(orig, dest_file) |
| 13 | + return nothing |
| 14 | +end |
| 15 | + |
| 16 | +@testset "reproject-core" begin |
| 17 | + download_dep("https://astropy.stsci.edu/data/galactic_center/gc_2mass_k.fits", "gc_2mass_k.fits", |
| 18 | + "763ef344df3ac8fa80ff46f00ca1ec59946ca3f99502562d6fcfb73320b1cec3") |
| 19 | + download_dep("https://astropy.stsci.edu/data/galactic_center/gc_msx_e.fits", "gc_msx_e.fits", |
| 20 | + "3687fb3763911825f981e74b6a9b82c0e618f7e592b1e0cb17e2c63164e28cd6") |
10 | 21 |
|
11 |
| - imgin = FITS("data/gc_msx_e.fits") # project this |
12 |
| - imgout = FITS("data/gc_2mass_k.fits") # into this coordinate |
| 22 | + imgin = FITS(joinpath("data", "gc_msx_e.fits")) # project this |
| 23 | + imgout = FITS(joinpath("data", "gc_2mass_k.fits")) # into this coordinate |
13 | 24 |
|
14 |
| - hdu1 = astropy.io.fits.open("data/gc_2mass_k.fits")[1] |
15 |
| - hdu2 = astropy.io.fits.open("data/gc_msx_e.fits")[1] |
| 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] |
16 | 27 |
|
17 | 28 | function check_diff(arr1, arr2)
|
18 | 29 | diff = 1e-3
|
|
0 commit comments