@@ -14,24 +14,14 @@ function parse_input_data(input_data::ImageHDU)
14
14
return read (input_data), WCS. from_header (read_header (input_data, String))[1 ]
15
15
end
16
16
17
- function parse_input_data (input_data:: String ; hdu_in = nothing )
18
- return parse_input_data (FITS (input_data), hdu_in = hdu_in )
17
+ function parse_input_data (input_data:: String , hdu_in)
18
+ return parse_input_data (FITS (input_data), hdu_in)
19
19
end
20
20
21
- function parse_input_data (input_data:: FITS ; hdu_in = nothing )
22
- if hdu_in === nothing
23
- if length (input_data) > 1
24
- throw (ArgumentError (" More than one HDU is present, please specify which HDU to use with 'hdu_in' option" ))
25
- else
26
- hdu_in = 1
27
- end
28
- end
21
+ function parse_input_data (input_data:: FITS , hdu_in)
29
22
return parse_input_data (input_data[hdu_in])
30
23
end
31
24
32
- function parse_input_data (input_data; hdu_in = nothing )
33
- throw (ArgumentError (" Input should be in Union{String, FITS, ImageHDU}" ))
34
- end
35
25
36
26
# TODO : extend support for passing FITSHeader when FITSHeader to WCSTransform support is possible.
37
27
@@ -49,17 +39,15 @@ Parse output projection and returns a WCS object and shape of output.
49
39
- `shape_out`: shape of the output image.
50
40
- `hdu_number`: specifies HDU number when file name is given as input.
51
41
"""
52
- function parse_output_projection (output_projection:: WCSTransform ; shape_out = nothing )
53
- if shape_out === nothing
54
- throw (ArgumentError (" Need to specify shape when specifying output_projection as WCS object" ))
55
- elseif length (shape_out) == 0
42
+ function parse_output_projection (output_projection:: WCSTransform , shape_out)
43
+ if length (shape_out) == 0
56
44
throw (DomainError (shape_out, " The shape of the output image should not be an empty tuple" ))
57
45
end
58
46
59
47
return output_projection, shape_out
60
48
end
61
49
62
- function parse_output_projection (output_projection:: ImageHDU ; shape_out = nothing )
50
+ function parse_output_projection (output_projection:: ImageHDU , shape_out)
63
51
wcs_out = WCS. from_header (read_header (output_projection, String))[1 ]
64
52
if shape_out === nothing
65
53
shape_out = size (output_projection)
@@ -70,25 +58,19 @@ function parse_output_projection(output_projection::ImageHDU; shape_out = nothin
70
58
return wcs_out, shape_out
71
59
end
72
60
73
- function parse_output_projection (output_projection:: String ; hdu_number = nothing )
74
- hdu_list = FITS (output_projection)
75
- if hdu_number === nothing
76
- wcs_out = WCS. from_header (read_header (hdu_list[1 ], String))[1 ]
77
- hdu_number = 1
78
- else
79
- wcs_out = WCS. from_header (read_header (hdu_list[hdu_number], String))[1 ]
80
- end
61
+ function parse_output_projection (output_projection:: String , hdu_number)
62
+ parse_output_projection (FITS (output_projection), hdu_number)
63
+ end
64
+
65
+ function parse_output_projection (output_projection:: FITS , hdu_number)
66
+ wcs_out = WCS. from_header (read_header (output_projection[hdu_number], String))[1 ]
81
67
82
- if hdu_list [hdu_number] isa ImageHDU
83
- shape_out = size (hdu_list [hdu_number])
68
+ if output_projection [hdu_number] isa ImageHDU
69
+ shape_out = size (output_projection [hdu_number])
84
70
else
85
71
throw (ArgumentError (" Given FITS file doesn't have ImageHDU" ))
86
72
end
87
73
88
74
return wcs_out, shape_out
89
75
end
90
76
91
- function parse_output_projection (output_projection; shape_out = nothing )
92
- throw (ArgumentError (" output_projection should be in Union{String, WCSTransform, FITSHeader}" ))
93
- end
94
-
0 commit comments