HdrTrans/CGS4Old.pm

filter: Statementstmt 86.8% 79 / 91 Branchbran 45.0% 18 / 40 Conditioncond 55.7% 39 / 70 MC/DCmcdc 17.1% 6 / 35 Subroutinesub 100% 14 / 14 Podpod 100% 9 / 9 totaltotal 63.7% 165 / 259 CC 45 SCAR 24.3
CC
45
Cov
68%
can_translate
17.5
from_DEC_TELESCOPE_OFFSET
16.9
from_RA_TELESCOPE_OFFSET
16.9
CRAP 11.4
« HdrTrans/UKIRTDB.pm ↑ Summary HdrTrans/RxH3.pm »
1 package Astro::FITS::HdrTrans::CGS4Old;
2  
3 =head1 NAME
4  
5 Astro::FITS::HdrTrans::CGS4 - UKIRT CGS4 translations for "old" style
6 CGS4 headers.
7  
8 =head1 SYNOPSIS
9  
10 use Astro::FITS::HdrTrans::CGS4Old;
11  
12 %gen = Astro::FITS::HdrTrans::CGS4Old->translate_from_FITS( %hdr );
13  
14 =head1 DESCRIPTION
15  
16 This class provides a generic set of translations that are specific
17 to the CGS4 spectrometer of the United Kingdom Infrared Telescope.
18  
19 =cut
20  
21 10 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 # Inherit from UKIRT "Old"
27 10 ▶use base qw/ Astro::FITS::HdrTrans::UKIRTOld /;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 10 our $VERSION = "1.66";
30  
31 # for a constant mapping, there is no FITS header, just a generic
32 # header that is constant
33 10 my %CONST_MAP = (
34  
35 );
36  
37 # unit mapping implies that the value propogates directly
38 # to the output with only a keyword name change
39  
40 10 my %UNIT_MAP = (
41 # CGS4 Specific
42 GRATING_DISPERSION => "GDISP",
43 GRATING_NAME => "GRATING",
44 GRATING_ORDER => "GORDER",
45 GRATING_WAVELENGTH => "GLAMBDA",
46 SLIT_ANGLE => "SANGLE",
47 SLIT_NAME => "SLIT",
48 SLIT_WIDTH => "SWIDTH",
49 # MICHELLE compatible
50 NSCAN_POSITIONS => "DETNINCR",
51 SCAN_INCREMENT => "DETINCR",
52 # MICHELLE + UIST + WFCAM
53 CONFIGURATION_INDEX => 'CNFINDEX',
54 );
55  
56  
57 # Create the translation methods
58 10 __PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP );
59  
60 # Im
61  
62 =head1 METHODS
63  
64 =over 4
65  
66 =item B<can_translate>
67  
68 Returns true if the supplied headers can be handled by this class.
69  
70 $cando = $class->can_translate( \%hdrs );
71  
72 This method returns true if the INSTRUME header exists and is equal to
73 'CGS4', and if the IDATE header exists, matches the regular
74 expression '\d{8}', and is less than 20081115.
75  
76 It also handles the reverse (to FITS) case where the INSTRUMENT header
77 replaces INSTRUME, and UTDATE replaces IDATE in the above tests.
78  
79 =cut
80  
81 22 ▶sub can_translate {
Subroutine can_translate: called CC=16 SCAR=28.6
Pod documented
82 22 my $self = shift;
83 22 my $headers = shift;
84  
85 22 ▶ if ( exists $headers->{IDATE} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115 and exists $headers->{"INSTRUME"} and defined $headers->{"INSTRUME"} and not exists $headers->{"RAJ2000"} and uc $headers->{"INSTRUME"} eq "CGS4") 2 20 22
Condition71%15/21
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115 and exists $headers->{"INSTRUME"} and defined $headers->{"INSTRUME"} and not exists $headers->{"RAJ2000"} and uc $headers->{"INSTRUME"} eq "CGS4"
!ll&&!rl&&r
1642
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115 and exists $headers->{"INSTRUME"} and defined $headers->{"INSTRUME"} and not exists $headers->{"RAJ2000"}
!ll&&!rl&&r
1606
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115 and exists $headers->{"INSTRUME"} and defined $headers->{"INSTRUME"}
!ll&&!rl&&r
1606
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115 and exists $headers->{"INSTRUME"}
!ll&&!rl&&r
1606
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115
!ll&&!rl&&r
1606
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/
!ll&&!rl&&r
1606
exists $headers->{"IDATE"} and defined $headers->{"IDATE"}
!ll&&!rl&&r
1606
MC/DC25%2/8
exists $headers->{"IDATE"} and defined $headers->{"IDATE"} and $headers->{"IDATE"} =~ /\d{8}/ and $headers->{"IDATE"} < 20081115 and exists $headers->{"INSTRUME"} and defined $headers->{"INSTRUME"} and not exists $headers->{"RAJ2000"} and uc $headers->{"INSTRUME"} eq "CGS4"
exists $headers->{"IDATE"} defined $headers->{"IDATE"} $headers->{"IDATE"} =~ /\d{8}/ $headers->{"IDATE"} < 20081115 exists $headers->{"INSTRUME"} defined $headers->{"INSTRUME"} not exists $headers->{"RAJ2000"} uc $headers->{"INSTRUME"} eq "CGS4"
Truth table33%3/9
A and B and C and D and E and F and not(G) and H
A= exists $headers->{"IDATE"}B= defined $headers->{"IDATE"}C= $headers->{"IDATE"} =~ /\d{8}/D= $headers->{"IDATE"} < 20081115E= exists $headers->{"INSTRUME"}F= defined $headers->{"INSTRUME"}G= not exists $headers->{"RAJ2000"}H= uc $headers->{"INSTRUME"} eq "CGS4"
ABCDEFGHresult
0XXXXXXX0
10XXXXXX0
110XXXXX0
1110XXXX0
11110XXX0
111110XX0
1111110X0
111111100
111111111
86 defined $headers->{IDATE} &&
87 $headers->{IDATE} =~ /\d{8}/ &&
88 $headers->{IDATE} < 20081115 &&
89 exists $headers->{INSTRUME} &&
90 defined $headers->{INSTRUME} &&
91 ! exists $headers->{RAJ2000} &&
92 uc( $headers->{INSTRUME} ) eq 'CGS4' ) {
93 2 return 1;
94 }
95  
96 # Need to handle the reverse case as well. This module can translate
97 # CGS4 headers older than 20081115. Note that the translations mean
98 # different header names are tested.
99 20 ▶ if ( exists $headers->{UTDATE} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/ and $headers->{"UTDATE"} < 20081115 and exists $headers->{"INSTRUMENT"} and defined $headers->{"INSTRUMENT"} and uc $headers->{"INSTRUMENT"} eq "CGS4") 2 18 20
Condition83%15/18
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/ and $headers->{"UTDATE"} < 20081115 and exists $headers->{"INSTRUMENT"} and defined $headers->{"INSTRUMENT"} and uc $headers->{"INSTRUMENT"} eq "CGS4"
!ll&&!rl&&r
1802
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/ and $headers->{"UTDATE"} < 20081115 and exists $headers->{"INSTRUMENT"} and defined $headers->{"INSTRUMENT"}
!ll&&!rl&&r
1802
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/ and $headers->{"UTDATE"} < 20081115 and exists $headers->{"INSTRUMENT"}
!ll&&!rl&&r
992
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/ and $headers->{"UTDATE"} < 20081115
!ll&&!rl&&r
8111
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/
!ll&&!rl&&r
4412
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"}
!ll&&!rl&&r
4016
MC/DC57%4/7
exists $headers->{"UTDATE"} and defined $headers->{"UTDATE"} and $headers->{"UTDATE"} =~ /\d{8}/ and $headers->{"UTDATE"} < 20081115 and exists $headers->{"INSTRUMENT"} and defined $headers->{"INSTRUMENT"} and uc $headers->{"INSTRUMENT"} eq "CGS4"
exists $headers->{"UTDATE"} defined $headers->{"UTDATE"} $headers->{"UTDATE"} =~ /\d{8}/ $headers->{"UTDATE"} < 20081115 exists $headers->{"INSTRUMENT"} defined $headers->{"INSTRUMENT"} uc $headers->{"INSTRUMENT"} eq "CGS4"
Truth table62%5/8
A and B and C and D and E and F and G
A= exists $headers->{"UTDATE"}B= defined $headers->{"UTDATE"}C= $headers->{"UTDATE"} =~ /\d{8}/D= $headers->{"UTDATE"} < 20081115E= exists $headers->{"INSTRUMENT"}F= defined $headers->{"INSTRUMENT"}G= uc $headers->{"INSTRUMENT"} eq "CGS4"
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
100 defined $headers->{UTDATE} &&
101 $headers->{UTDATE} =~ /\d{8}/ &&
102 $headers->{UTDATE} < 20081115 &&
103 exists $headers->{INSTRUMENT} &&
104 defined $headers->{INSTRUMENT} &&
105 uc( $headers->{INSTRUMENT} ) eq 'CGS4' ) {
106 2 return 1;
107 }
108  
109 18 return 0;
110 }
111  
112 =back
113  
114 =head1 COMPLEX CONVERSIONS
115  
116 These methods are more complicated than a simple mapping. We have to
117 provide both from- and to-FITS conversions All these routines are
118 methods and the to_ routines all take a reference to a hash and return
119 the translated value (a many-to-one mapping) The from_ methods take a
120 reference to a generic hash and return a translated hash (sometimes
121 these are many-to-many)
122  
123 =over 4
124  
125 =item B<to_POLARIMETRY>
126  
127 Checks the C<FILTER> FITS header keyword for the existance of
128 'prism'. If 'prism' is found, then the C<POLARIMETRY> generic
129 header is set to 1, otherwise 0.
130  
131 =cut
132  
133 2 ▶sub to_POLARIMETRY {
Subroutine to_POLARIMETRY: called CC=3 SCAR=11.2
Pod documented
134 2 my $self = shift;
135 2 my $FITS_headers = shift;
136 2 my $return;
137 2 ▶ if (exists($FITS_headers->{FILTER})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"FILTER"}) 2 0 2
138 2 ▶ $return = ( $FITS_headers->{FILTER} =~ /prism/i ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$FITS_headers->{'FILTER'} =~ /prism/i ? : 0 2 2
139 }
140 2 return $return;
141 }
142  
143 =item B<to_DEC_TELESCOPE_OFFSET>
144  
145 The header keyword for the Dec telescope offset changed from DECOFF to
146 TDECOFF on 20050315, so switch on this date to use the proper header.
147  
148 =cut
149  
150 2 ▶sub to_DEC_TELESCOPE_OFFSET {
Subroutine to_DEC_TELESCOPE_OFFSET: called CC=4 SCAR=15.2
Pod documented
151 2 my $self = shift;
152 2 my $FITS_headers = shift;
153 2 my $return;
154 2 ▶ if ( exists( $FITS_headers->{IDATE} ) && defined( $FITS_headers->{IDATE} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"IDATE"} and defined $FITS_headers->{"IDATE"}) 2 0 2
Condition33%1/3
exists $FITS_headers->{"IDATE"} and defined $FITS_headers->{"IDATE"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $FITS_headers->{"IDATE"} and defined $FITS_headers->{"IDATE"}
exists $FITS_headers->{"IDATE"} defined $FITS_headers->{"IDATE"}
Truth table33%1/3
A and B
A= exists $FITS_headers->{"IDATE"}B= defined $FITS_headers->{"IDATE"}
ABresult
0X0
100
111
155 2 ▶ if ( $FITS_headers->{IDATE} < 20050315 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($FITS_headers->{'IDATE'} < 20050315) { } 2 0 2
156 2 $return = $FITS_headers->{DECOFF};
157 } else {
158 0 $return = $FITS_headers->{TDECOFF};
159 }
160 }
161 2 return $return;
162 }
163  
164 =item B<from_DEC_TELESCOPE_OFFSET>
165  
166 The header keyword for the Dec telescope offset changed from DECOFF to
167 TDECOFF on 20050315, so return the proper keyword depending on observation
168 date.
169  
170 =cut
171  
172 2 ▶sub from_DEC_TELESCOPE_OFFSET {
Subroutine from_DEC_TELESCOPE_OFFSET: called CC=8 SCAR=28.2
Pod documented
173 2 my $self = shift;
174 2 my $generic_headers = shift;
175 2 my %return;
176 2 ▶ if ( exists( $generic_headers->{UTDATE} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{'UTDATE'} and defined $generic_headers->{'UTDATE'}) { } 2 0 2
Condition33%1/3
exists $generic_headers->{"UTDATE"} and defined $generic_headers->{"UTDATE"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $generic_headers->{"UTDATE"} and defined $generic_headers->{"UTDATE"}
exists $generic_headers->{"UTDATE"} defined $generic_headers->{"UTDATE"}
Truth table33%1/3
A and B
A= exists $generic_headers->{"UTDATE"}B= defined $generic_headers->{"UTDATE"}
ABresult
0X0
100
111
177 defined( $generic_headers->{UTDATE} ) ) {
178 2 my $ut = $generic_headers->{UTDATE};
179 2 ▶ if ( exists( $generic_headers->{DEC_TELESCOPE_OFFSET} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} and defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}) 2 0 2
Condition33%1/3
exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} and defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} and defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
Truth table33%1/3
A and B
A= exists $generic_headers->{"DEC_TELESCOPE_OFFSET"}B= defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
ABresult
0X0
100
111
180 defined( $generic_headers->{DEC_TELESCOPE_OFFSET} ) ) {
181 2 ▶ if ( $ut < 20050315 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ut < 20050315) { } 2 0 2
182 2 $return{'DECOFF'} = $generic_headers->{DEC_TELESCOPE_OFFSET};
183 } else {
184 0 $return{'TDECOFF'} = $generic_headers->{DEC_TELESCOPE_OFFSET};
185 }
186 }
187 } else {
188 0 ▶ if ( exists( $generic_headers->{DEC_TELESCOPE_OFFSET} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} and defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}) 0 0 0
Condition0%0/3
exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} and defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} and defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
exists $generic_headers->{"DEC_TELESCOPE_OFFSET"} defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
Truth table0%0/3
A and B
A= exists $generic_headers->{"DEC_TELESCOPE_OFFSET"}B= defined $generic_headers->{"DEC_TELESCOPE_OFFSET"}
ABresult
0X0
100
111
189 defined( $generic_headers->{DEC_TELESCOPE_OFFSET} ) ) {
190 0 $return{'TDECOFF'} = $generic_headers->{DEC_TELESCOPE_OFFSET};
191 }
192 }
193 2 return %return;
194 }
195  
196 =item B<to_RA_TELESCOPE_OFFSET>
197  
198 The header keyword for the RA telescope offset changed from RAOFF to
199 TRAOFF on 20050315, so switch on this date to use the proper header.
200  
201 =cut
202  
203 2 ▶sub to_RA_TELESCOPE_OFFSET {
Subroutine to_RA_TELESCOPE_OFFSET: called CC=4 SCAR=15.2
Pod documented
204 2 my $self = shift;
205 2 my $FITS_headers = shift;
206 2 my $return;
207 2 ▶ if ( exists( $FITS_headers->{IDATE} ) && defined( $FITS_headers->{IDATE} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"IDATE"} and defined $FITS_headers->{"IDATE"}) 2 0 2
Condition33%1/3
exists $FITS_headers->{"IDATE"} and defined $FITS_headers->{"IDATE"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $FITS_headers->{"IDATE"} and defined $FITS_headers->{"IDATE"}
exists $FITS_headers->{"IDATE"} defined $FITS_headers->{"IDATE"}
Truth table33%1/3
A and B
A= exists $FITS_headers->{"IDATE"}B= defined $FITS_headers->{"IDATE"}
ABresult
0X0
100
111
208 2 ▶ if ( $FITS_headers->{IDATE} < 20050315 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($FITS_headers->{'IDATE'} < 20050315) { } 2 0 2
209 2 $return = $FITS_headers->{RAOFF};
210 } else {
211 0 $return = $FITS_headers->{TRAOFF};
212 }
213 }
214 2 return $return;
215 }
216  
217 =item B<from_RA_TELESCOPE_OFFSET>
218  
219 The header keyword for the RA telescope offset changed from RAOFF to
220 TRAOFF on 20050315, so return the proper keyword depending on observation
221 date.
222  
223 =cut
224  
225 2 ▶sub from_RA_TELESCOPE_OFFSET {
Subroutine from_RA_TELESCOPE_OFFSET: called CC=8 SCAR=28.2
Pod documented
226 2 my $self = shift;
227 2 my $generic_headers = shift;
228 2 my %return;
229 2 ▶ if ( exists( $generic_headers->{UTDATE} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{'UTDATE'} and defined $generic_headers->{'UTDATE'}) { } 2 0 2
Condition33%1/3
exists $generic_headers->{"UTDATE"} and defined $generic_headers->{"UTDATE"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $generic_headers->{"UTDATE"} and defined $generic_headers->{"UTDATE"}
exists $generic_headers->{"UTDATE"} defined $generic_headers->{"UTDATE"}
Truth table33%1/3
A and B
A= exists $generic_headers->{"UTDATE"}B= defined $generic_headers->{"UTDATE"}
ABresult
0X0
100
111
230 defined( $generic_headers->{UTDATE} ) ) {
231 2 my $ut = $generic_headers->{UTDATE};
232 2 ▶ if ( exists( $generic_headers->{RA_TELESCOPE_OFFSET} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{"RA_TELESCOPE_OFFSET"} and defined $generic_headers->{"RA_TELESCOPE_OFFSET"}) 2 0 2
Condition33%1/3
exists $generic_headers->{"RA_TELESCOPE_OFFSET"} and defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $generic_headers->{"RA_TELESCOPE_OFFSET"} and defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
exists $generic_headers->{"RA_TELESCOPE_OFFSET"} defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
Truth table33%1/3
A and B
A= exists $generic_headers->{"RA_TELESCOPE_OFFSET"}B= defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
ABresult
0X0
100
111
233 defined( $generic_headers->{RA_TELESCOPE_OFFSET} ) ) {
234 2 ▶ if ( $ut < 20050315 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ut < 20050315) { } 2 0 2
235 2 $return{'RAOFF'} = $generic_headers->{RA_TELESCOPE_OFFSET};
236 } else {
237 0 $return{'TRAOFF'} = $generic_headers->{RA_TELESCOPE_OFFSET};
238 }
239 }
240 } else {
241 0 ▶ if ( exists( $generic_headers->{RA_TELESCOPE_OFFSET} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{"RA_TELESCOPE_OFFSET"} and defined $generic_headers->{"RA_TELESCOPE_OFFSET"}) 0 0 0
Condition0%0/3
exists $generic_headers->{"RA_TELESCOPE_OFFSET"} and defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $generic_headers->{"RA_TELESCOPE_OFFSET"} and defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
exists $generic_headers->{"RA_TELESCOPE_OFFSET"} defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
Truth table0%0/3
A and B
A= exists $generic_headers->{"RA_TELESCOPE_OFFSET"}B= defined $generic_headers->{"RA_TELESCOPE_OFFSET"}
ABresult
0X0
100
111
242 defined( $generic_headers->{RA_TELESCOPE_OFFSET} ) ) {
243 0 $return{'TRAOFF'} = $generic_headers->{RA_TELESCOPE_OFFSET};
244 }
245 }
246 2 return %return;
247 }
248  
249 =item B<to_DETECTOR_READ_TYPE>
250  
251 Should be the "MODE" header but if this is missing we can look
252 at INTTYPE instead.
253  
254 =cut
255  
256 2 ▶sub to_DETECTOR_READ_TYPE {
Subroutine to_DETECTOR_READ_TYPE: called CC=4 SCAR=20.1
Pod documented
257 2 my $self = shift;
258 2 my $FITS_headers = shift;
259  
260 2 my %mode = (
261 CHOP => 'CHOP',
262 'STARE+NDR' => 'ND_STARE',
263 STARE => 'STARE',
264 );
265  
266 2 ▶ if (exists $FITS_headers->{'MODE'}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $FITS_headers->{'MODE'}) { } 2 0 2
elsif (exists $FITS_headers->{'INTTYPE'}) { } 0 0 0
267 2 return $FITS_headers->{'MODE'};
268 }
269 elsif (exists $FITS_headers->{'INTTYPE'}) {
270 0 my $inttype = $FITS_headers->{'INTTYPE'};
271 0 ▶ if (exists $mode{$inttype}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $mode{$inttype}) 0 0 0
272 0 return $mode{$inttype};
273 }
274 }
275  
276 0 return undef;
277 }
278  
279 =item B<to_SAMPLING>
280  
281 Converts FITS header values in C<DETINCR> and C<DETNINCR> to a single
282 descriptive string.
283  
284 =cut
285  
286 2 ▶sub to_SAMPLING {
Subroutine to_SAMPLING: called CC=5 SCAR=17.3
Pod documented
287 2 my $self = shift;
288 2 my $FITS_headers = shift;
289 2 my $return;
290 2 ▶ if (exists($FITS_headers->{DETINCR}) && exists($FITS_headers->{DETNINCR})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"DETINCR"} and exists $FITS_headers->{"DETNINCR"}) 2 0 2
Condition33%1/3
exists $FITS_headers->{"DETINCR"} and exists $FITS_headers->{"DETNINCR"}
!ll&&!rl&&r
002
MC/DC0%0/2
exists $FITS_headers->{"DETINCR"} and exists $FITS_headers->{"DETNINCR"}
exists $FITS_headers->{"DETINCR"} exists $FITS_headers->{"DETNINCR"}
Truth table33%1/3
A and B
A= exists $FITS_headers->{"DETINCR"}B= exists $FITS_headers->{"DETNINCR"}
ABresult
0X0
100
111
291 2 ▶ my $detincr = $FITS_headers->{DETINCR} || 1;
Condition50%1/2
$FITS_headers->{'DETINCR'} || 1
l!l
20
MC/DC0%0/1
$FITS_headers->{'DETINCR'} || 1
$FITS_headers->{'DETINCR'}
Truth table50%1/2
A
A= $FITS_headers->{'DETINCR'}
Aresult
11
00
292 2 ▶ my $detnincr = $FITS_headers->{DETNINCR} || 1;
Condition50%1/2
$FITS_headers->{'DETNINCR'} || 1
l!l
20
MC/DC0%0/1
$FITS_headers->{'DETNINCR'} || 1
$FITS_headers->{'DETNINCR'}
Truth table50%1/2
A
A= $FITS_headers->{'DETNINCR'}
Aresult
11
00
293 2 $return = int ( 1 / $detincr ) . 'x' . int ( $detincr * $detnincr );
294 }
295 2 return $return;
296 }
297  
298 =item B<from_TELESCOPE>
299  
300 Returns 'UKIRT, Mauna Kea, HI' for the C<TELESCOP> FITS header.
301  
302 =cut
303  
304 2 ▶sub from_TELESCOPE {
Subroutine from_TELESCOPE: called CC=1 SCAR=0.0
Pod documented
305 2 my %return = ( "TELESCOP", "UKIRT, Mauna Kea, HI" );
306 2 return %return;
307 }
308  
309 =back
310  
311 =head1 SEE ALSO
312  
313 C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::UKIRT>.
314  
315 =head1 AUTHOR
316  
317 Brad Cavanagh E<lt>b.cavanagh@jach.hawaii.eduE<gt>,
318 Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>.
319  
320 =head1 COPYRIGHT
321  
322 Copyright (C) 2003-2005 Particle Physics and Astronomy Research Council.
323 All Rights Reserved.
324  
325 This program is free software; you can redistribute it and/or modify it under
326 the terms of the GNU General Public License as published by the Free Software
327 Foundation; either version 2 of the License, or (at your option) any later
328 version.
329  
330 This program is distributed in the hope that it will be useful,but WITHOUT ANY
331 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
332 PARTICULAR PURPOSE. See the GNU General Public License for more details.
333  
334 You should have received a copy of the GNU General Public License along with
335 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
336 Place,Suite 330, Boston, MA 02111-1307, USA
337  
338 =cut
339  
340 10 1;
« HdrTrans/UKIRTDB.pm ↑ Summary HdrTrans/RxH3.pm »