File tree Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Expand file tree Collapse file tree 4 files changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -3,5 +3,6 @@ module Reproject
3
3
using FITSIO, WCS
4
4
5
5
include (" parsers.jl" )
6
+ include (" utils.jl" )
6
7
7
8
end # module
Original file line number Diff line number Diff line change
1
+ const UNDEFINED = 987654321.0e99 # from WCS.jl
2
+
3
+ """
4
+ wcs_to_celestial_frame(wcs::WCSTransform)
5
+
6
+ Returns the reference frame of a WCSTransform.
7
+ The reference frame supported in Julia are FK5, ICRS and Galactic.
8
+ """
9
+ function wcs_to_celestial_frame (wcs:: WCSTransform )
10
+ radesys = wcs. radesys
11
+
12
+ if wcs. equinox != UNDEFINED
13
+ equinox = wcs. equinox
14
+ else
15
+ equinox = nothing
16
+ end
17
+
18
+ xcoord = wcs. ctype[1 ][1 : 4 ]
19
+ ycoord = wcs. ctype[2 ][1 : 4 ]
20
+
21
+ if radesys == " "
22
+ if xcoord == " RA--" && ycoord == " DEC-"
23
+ if equinox === nothing
24
+ radesys = " ICRS"
25
+ elseif equinox < 1984.0
26
+ radesys = " FK4"
27
+ else
28
+ radesys = " FK5"
29
+ end
30
+ elseif xcoord == " GLON" && ycoord == " GLAT"
31
+ radesys = " Gal"
32
+ elseif xcoord == " TLON" && ycoord == " TLAT"
33
+ radesys = " ITRS"
34
+ end
35
+ end
36
+
37
+ return radesys
38
+ end
Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ rp = pyimport("reproject")
10
10
11
11
@testset " Reproject.jl" begin
12
12
include (" parsers.jl" )
13
+ include (" utils.jl" )
13
14
end
Original file line number Diff line number Diff line change
1
+ @testset " wcs to celestial frame" begin
2
+ wcs1 = WCSTransform (2 ;
3
+ ctype = [" RA---AIR" , " DEC--AIR" ],
4
+ )
5
+ wcs2 = WCSTransform (2 ;
6
+ ctype = [" RA---AIR" , " DEC--AIR" ],
7
+ equinox = 1888.67
8
+ )
9
+ wcs3 = WCSTransform (2 ;
10
+ ctype = [" RA---AIR" , " DEC--AIR" ],
11
+ equinox = 2000
12
+ )
13
+ wcs4 = WCSTransform (2 ;
14
+ ctype = [" GLON--" , " GLAT--" ],
15
+ )
16
+ wcs5 = WCSTransform (2 ;
17
+ ctype = [" TLON" , " TLAT" ],
18
+ )
19
+ wcs6 = WCSTransform (2 ;
20
+ ctype = [" RA---AIR" , " DEC--AIR" ],
21
+ radesys = " UNK"
22
+ )
23
+
24
+ @test wcs_to_celestial_frame (wcs1) == " ICRS"
25
+ @test wcs_to_celestial_frame (wcs2) == " FK4"
26
+ @test wcs_to_celestial_frame (wcs3) == " FK5"
27
+ @test wcs_to_celestial_frame (wcs4) == " Gal"
28
+ @test wcs_to_celestial_frame (wcs5) == " ITRS"
29
+ @test wcs_to_celestial_frame (wcs6) == " UNK"
30
+ end
31
+
You can’t perform that action at this time.
0 commit comments