blib/lib/Astro/FITS/HdrTrans/JCMT_GSD.pm

filter: Statementstmt 19.8% 30 / 151 Branchbran 1.4% 1 / 70 Conditioncond 1.7% 2 / 114 MC/DCmcdc 0.0% 0 / 52 Subroutinesub 47.0% 8 / 17 Podpod 100% 10 / 10 totaltotal 12.3% 51 / 414 CC 74 SCAR 67.6
CC
74
Cov
10%
to_EXPOSURE_TIME
1806.0
to_BANDWIDTH_MODE
72.0
to_UTSTART
42.0
CRAP 858.8
↑ Summary blib/lib/Astro/FITS/HdrTrans/NACO.pm »
1 package Astro::FITS::HdrTrans::JCMT_GSD;
2  
3 =head1 NAME
4  
5 Astro::FITS::HdrTrans::JCMT_GSD - JCMT GSD Header translations
6  
7 =head1 DESCRIPTION
8  
9 Converts information contained in JCMT heterodyne instrument headers
10 to and from generic headers. See Astro::FITS::HdrTrans for a list of
11 generic headers.
12  
13 =cut
14  
15 10 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 10 ▶use Time::Piece;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 # Inherit from Base
23 10 ▶use base qw/ Astro::FITS::HdrTrans::Base /;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 10 ▶use vars qw/ $VERSION /;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 10 $VERSION = "1.65";
28  
29 # for a constant mapping, there is no FITS header, just a generic
30 # header that is constant
31 10 my %CONST_MAP = (
32 INST_DHS => 'HET_GSD',
33 COORDINATE_UNITS => 'decimal',
34 EQUINOX => 'current',
35 TELESCOPE => 'JCMT',
36 );
37  
38 # NULL mappings used to override base class implementations
39 10 my @NULL_MAP = ();
40  
41 # unit mapping implies that the value propogates directly
42 # to the output with only a keyword name change
43  
44 10 my %UNIT_MAP = (
45 AMBIENT_TEMPERATURE => "C5AT",
46 APERTURE => "C7AP",
47 AZIMUTH_START => "C4AZ",
48 BACKEND => "C1BKE",
49 BACKEND_SECTIONS => "C3NRS",
50 CHOP_FREQUENCY => "C4FRQ",
51 CHOP_THROW => "C4THROW",
52 COORDINATE_SYSTEM => "C4CSC",
53 COORDINATE_TYPE => "C4LSC",
54 CYCLE_LENGTH => "C3CL",
55 # DEC_BASE => "",
56 ELEVATION_START => "C4EL",
57 # FILENAME => "GSDFILE",
58 FILTER => "C7FIL",
59 FREQUENCY_RESOLUTION => "C12FR",
60 FRONTEND => "C1RCV",
61 HUMIDITY => "C5RH",
62 NUMBER_OF_CYCLES => "C3NCI",
63 NUMBER_OF_SUBSCANS => "C3NIS",
64 OBJECT => "C1SNA1",
65 OBSERVATION_MODE => "C6ST",
66 OBSERVATION_NUMBER => "C1SNO",
67 PROJECT => "C1PID",
68 RA_BASE => "C4RADATE",
69 RECEIVER_TEMPERATURE => "C12RT",
70 ROTATION => "CELL_V2Y",
71 REST_FREQUENCY => "C12RF",
72 SEEING => "C7SEEING",
73 SWITCH_MODE => "C6MODE",
74 SYSTEM_TEMPERATURE => "C12SST",
75 TAU => "C7TAU225",
76 USER_AZ_CORRECTION => "UAZ",
77 USER_EL_CORRECTION => "UEL",
78 VELOCITY => "C7VR",
79 VELOCITY_REFERENCE_FRAME => "C12VREF",
80 VELOCITY_TYPE => "C12VDEF",
81 X_BASE => "C4RX",
82 Y_BASE => "C4RY",
83 X_DIM => "C6XNP",
84 Y_DIM => "C6YNP",
85 X_REQUESTED => "C4SX",
86 Y_REQUESTED => "C4SY",
87 X_SCALE => "C6DX",
88 Y_SCALE => "C6DY",
89 );
90  
91 # Create the translation methods
92 10 __PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP, \@NULL_MAP );
93  
94 =head1 METHODS
95  
96 =over 4
97  
98 =item B<can_translate>
99  
100 Returns true if the supplied headers can be handled by this class.
101  
102 $cando = $class->can_translate( \%hdrs );
103  
104 For this class, the method will return true if the B<C1RCV> header exists
105 and matches the regular expression C</^rx(a|b|w)/i>.
106  
107 =cut
108  
109 sub can_translate {
110 20 ▶ my $self = shift;
Subroutine can_translate: called CC=5 SCAR=22.5
Pod documented
111 20 my $headers = shift;
112  
113 20 ▶ if ( exists( $headers->{'C1RCV'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $headers->{'C1RCV'} and defined $headers->{'C1RCV'} and $headers->{'C1RCV'} =~ /^rx(a|b|w)/i || $headers->{'C1RCV'} =~ /^fts/i) { } 0 20 20
Condition22%2/9
exists $headers->{"C1RCV"} and defined $headers->{"C1RCV"} and $headers->{"C1RCV"} =~ /^rx(a|b|w)/i || $headers->{"C1RCV"} =~ /^fts/i
!ll&&!rl&&r
2000
exists $headers->{"C1RCV"} and defined $headers->{"C1RCV"}
!ll&&!rl&&r
2000
$headers->{"C1RCV"} =~ /^rx(a|b|w)/i or $headers->{"C1RCV"} =~ /^fts/i
l!l&&r!l&&!r
000
MC/DC0%0/4
exists $headers->{"C1RCV"} and defined $headers->{"C1RCV"} and $headers->{"C1RCV"} =~ /^rx(a|b|w)/i || $headers->{"C1RCV"} =~ /^fts/i
exists $headers->{"C1RCV"} defined $headers->{"C1RCV"} $headers->{"C1RCV"} =~ /^rx(a|b|w)/i $headers->{"C1RCV"} =~ /^fts/i
Truth table20%1/5
A and B and C or D
A= exists $headers->{"C1RCV"}B= defined $headers->{"C1RCV"}C= $headers->{"C1RCV"} =~ /^rx(a|b|w)/iD= $headers->{"C1RCV"} =~ /^fts/i
ABCDresult
0XXX0
10XX0
11000
111X1
11011
114 defined( $headers->{'C1RCV'} ) &&
115 ( $headers->{'C1RCV'} =~ /^rx(a|b|w)/i ||
116 $headers->{'C1RCV'} =~ /^fts/i ) ) {
117 0 return 1;
118 } else {
119 20 return 0;
120 }
121 }
122  
123 =back
124  
125 =head1 COMPLEX CONVERSIONS
126  
127 These methods are more complicated than a simple mapping. We have to
128 provide both from- and to-FITS conversions All these routines are
129 methods and the to_ routines all take a reference to a hash and return
130 the translated value (a many-to-one mapping) The from_ methods take a
131 reference to a generic hash and return a translated hash (sometimes
132 these are many-to-many)
133  
134 =over 4
135  
136 =item B<to_INSTRUMENT>
137  
138 Sets the C<INSTRUMENT> generic header. For RxA3i, sets the value
139 to RXA3. For RxB, sets the value to RXB3.
140  
141 =cut
142  
143 sub to_INSTRUMENT {
144 0 ▶ my $self = shift;
Subroutine to_INSTRUMENT: not called CC=4 SCAR=30.0
Pod documented
145 0 my $FITS_headers = shift;
146 0 my $return;
147  
148 0 ▶ if ( exists( $FITS_headers->{'C1RCV'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C1RCV"}) 0 0 0
149 0 $return = $FITS_headers->{'C1RCV'};
150 0 ▶ if ( $return =~ /^rxa3/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($return =~ /^rxa3/i) { } 0 0 0
elsif ($return =~ /^rxb/i) { } 0 0 0
151 0 $return = "RXA3";
152 } elsif ( $return =~ /^rxb/i ) {
153 0 $return = "RXB3";
154 }
155 }
156 0 return $return;
157 }
158  
159 =item B<to_OBSERVATION_ID>
160  
161 Calculate a unique Observation ID.
162  
163 =cut
164  
165 # Note this routine is generic for JCMT heterodyne instrumentation.
166 # Would be completely generic if BACKEND was not used in preference to instrument.
167  
168 sub to_OBSERVATION_ID {
169 0 ▶ my $self = shift;
Subroutine to_OBSERVATION_ID: not called CC=1 SCAR=6.9
Pod documented
170 0 my $FITS_headers = shift;
171 0 my $backend = lc( $self->to_BACKEND( $FITS_headers ) );
172 0 my $obsnum = $self->to_OBSERVATION_NUMBER( $FITS_headers );
173 0 my $dateobs = $self->to_UTSTART( $FITS_headers );
174 0 my $datetime = $dateobs->datetime;
175 0 $datetime =~ s/-//g;
176 0 $datetime =~ s/://g;
177  
178 0 my $obsid = join('_', $backend, $obsnum, $datetime);
179 0 return $obsid;
180 }
181  
182 =item B<to_UTDATE>
183  
184 Translates the C<C3DAT> header into a YYYYMMDD integer.
185  
186 =cut
187  
188 sub to_UTDATE {
189 0 ▶ my $self = shift;
Subroutine to_UTDATE: not called CC=3 SCAR=24.8
Pod documented
190 0 my $FITS_headers = shift;
191 0 my $return;
192  
193 0 ▶ if ( exists( $FITS_headers->{'C3DAT'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3DAT"}) 0 0 0
194 0 $FITS_headers->{'C3DAT'} =~ /(\d{4})\.(\d\d)(\d{1,2})/;
195 0 ▶ my $day = (length($3) == 2) ? $3 : $3 . "0";
Branch: 1 branch
BranchTrueFalseTotal
length $3 == 2 ? : 0 0 0
196 0 my $ut = "$1-$2-$day";
197 0 $return = sprintf("%04d%02d%02d", $1, $2, $3);
198 }
199 0 return $return;
200 }
201  
202 =item B<from_UTDATE>
203  
204 Translates YYYYMMDD integer to C3DAT header.
205  
206 =cut
207  
208 sub from_UTDATE {
209 0 ▶ my $self = shift;
Subroutine from_UTDATE: not called CC=3 SCAR=24.8
Pod documented
210 0 my $generic_headers = shift;
211 0 my %return_hash;
212 0 ▶ if (exists $generic_headers->{UTDATE}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $generic_headers->{"UTDATE"}) 0 0 0
213 0 my $date = $generic_headers->{UTDATE};
214 0 ▶ return () unless defined $date;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $date 0 0 0
215 0 $return_hash{UTDATE} = sprintf("%04d.%02d%02d",
216 substr($date,0,4),
217 substr($date,4,2),
218 substr($date,6,2));
219 }
220 0 return %return_hash;
221 }
222  
223 =item B<to_UTSTART>
224  
225 Translates the C<C3DAT> and C<C3UT> headers into a C<Time::Piece> object.
226  
227 =cut
228  
229 sub to_UTSTART {
230 0 ▶ my $self = shift;
Subroutine to_UTSTART: not called CC=6 SCAR=37.4
Pod documented
231 0 my $FITS_headers = shift;
232  
233 0 my $return;
234 0 ▶ if ( exists( $FITS_headers->{'C3DAT'} ) && defined( $FITS_headers->{'C3DAT'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"} and defined $FITS_headers->{"C3UT"}) 0 0 0
Condition0%0/9
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"} and defined $FITS_headers->{"C3UT"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"} and defined $FITS_headers->{"C3UT"}
exists $FITS_headers->{"C3DAT"} defined $FITS_headers->{"C3DAT"} exists $FITS_headers->{"C3UT"} defined $FITS_headers->{"C3UT"}
Truth table0%0/5
A and B and C and D
A= exists $FITS_headers->{"C3DAT"}B= defined $FITS_headers->{"C3DAT"}C= exists $FITS_headers->{"C3UT"}D= defined $FITS_headers->{"C3UT"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
235 exists( $FITS_headers->{'C3UT'} ) && defined( $FITS_headers->{'C3UT'} ) ) {
236 0 my $hour = int( $FITS_headers->{'C3UT'} );
237 0 my $minute = int ( ( $FITS_headers->{'C3UT'} - $hour ) * 60 );
238 0 my $second = int ( ( ( ( $FITS_headers->{'C3UT'} - $hour ) * 60 ) - $minute ) * 60 );
239 0 $FITS_headers->{'C3DAT'} =~ /(\d{4})\.(\d\d)(\d{1,2})/;
240 0 ▶ my $day = (length($3) == 2) ? $3 : $3 . "0";
Branch: 1 branch
BranchTrueFalseTotal
length $3 == 2 ? : 0 0 0
241 0 $return = Time::Piece->strptime(sprintf("%4u-%02u-%02uT%02u:%02u:%02u", $1, $2, $day, $hour, $minute, $second ),
242 "%Y-%m-%dT%T");
243 }
244 0 return $return;
245 }
246  
247 =item B<to_UTEND>
248  
249 Translates the C<C3DAT>, C<C3UT>, C<C3NIS>, C<C3CL>, C<C3NCP>, and C<C3NCI> headers
250 into a C<Time::Piece> object.
251  
252 =cut
253  
254 sub to_UTEND {
255 0 ▶ my $self = shift;
Subroutine to_UTEND: not called CC=6 SCAR=37.4
Pod documented
256 0 my $FITS_headers = shift;
257 0 my ($t, $expt);
258 0 ▶ if ( exists( $FITS_headers->{'C3DAT'} ) && defined( $FITS_headers->{'C3DAT'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"} and defined $FITS_headers->{"C3UT"}) 0 0 0
Condition0%0/9
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"} and defined $FITS_headers->{"C3UT"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $FITS_headers->{"C3DAT"} and defined $FITS_headers->{"C3DAT"} and exists $FITS_headers->{"C3UT"} and defined $FITS_headers->{"C3UT"}
exists $FITS_headers->{"C3DAT"} defined $FITS_headers->{"C3DAT"} exists $FITS_headers->{"C3UT"} defined $FITS_headers->{"C3UT"}
Truth table0%0/5
A and B and C and D
A= exists $FITS_headers->{"C3DAT"}B= defined $FITS_headers->{"C3DAT"}C= exists $FITS_headers->{"C3UT"}D= defined $FITS_headers->{"C3UT"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
259 exists( $FITS_headers->{'C3UT'} ) && defined( $FITS_headers->{'C3UT'} ) ) {
260 0 my $hour = int( $FITS_headers->{'C3UT'} );
261 0 my $minute = int ( ( $FITS_headers->{'C3UT'} - $hour ) * 60 );
262 0 my $second = int ( ( ( ( $FITS_headers->{'C3UT'} - $hour ) * 60 ) - $minute ) * 60 );
263 0 $FITS_headers->{'C3DAT'} =~ /(\d{4})\.(\d\d)(\d{1,2})/;
264 0 ▶ my $day = (length($3) == 2) ? $3 : $3 . "0";
Branch: 1 branch
BranchTrueFalseTotal
length $3 == 2 ? : 0 0 0
265 0 $t = Time::Piece->strptime(sprintf("%4u-%02u-%02uT%02u:%02u:%02u", $1, $2, $day, $hour, $minute, $second ),
266 "%Y-%m-%dT%T");
267 }
268  
269 0 $expt = $self->to_EXPOSURE_TIME( $FITS_headers );
270  
271 0 $t += $expt;
272  
273 0 return $t;
274  
275 }
276  
277 =item B<to_BANDWIDTH_MODE>
278  
279 Uses the C3NRS (number of backend sections), C3NFOC (number of
280 frontend output channels) and C3NCH (number of channels) to form a
281 string that is of the format 250MHzx2048. To obtain this, the
282 bandwidth (250MHz in this example) is calculated as 125MHz * C3NRS /
283 C3NFOC. The number of channels is taken directly and not manipulated
284 in any way.
285  
286 If appropriate, the bandwidth may be given in GHz.
287  
288 =cut
289  
290 sub to_BANDWIDTH_MODE {
291 0 ▶ my $self = shift;
Subroutine to_BANDWIDTH_MODE: not called CC=8 SCAR=42.8
Pod documented
292 0 my $FITS_headers = shift;
293  
294 0 my $return;
295  
296 0 ▶ if ( exists( $FITS_headers->{'C3NRS'} ) && defined( $FITS_headers->{'C3NRS'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"} and exists $FITS_headers->{"C3NFOC"} and defined $FITS_headers->{"C3NFOC"} and exists $FITS_headers->{"C3NCH"} and defined $FITS_headers->{"C3NCH"}) 0 0 0
Condition0%0/15
exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"} and exists $FITS_headers->{"C3NFOC"} and defined $FITS_headers->{"C3NFOC"} and exists $FITS_headers->{"C3NCH"} and defined $FITS_headers->{"C3NCH"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"} and exists $FITS_headers->{"C3NFOC"} and defined $FITS_headers->{"C3NFOC"} and exists $FITS_headers->{"C3NCH"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"} and exists $FITS_headers->{"C3NFOC"} and defined $FITS_headers->{"C3NFOC"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"} and exists $FITS_headers->{"C3NFOC"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"}
!ll&&!rl&&r
000
MC/DC0%0/6
exists $FITS_headers->{"C3NRS"} and defined $FITS_headers->{"C3NRS"} and exists $FITS_headers->{"C3NFOC"} and defined $FITS_headers->{"C3NFOC"} and exists $FITS_headers->{"C3NCH"} and defined $FITS_headers->{"C3NCH"}
exists $FITS_headers->{"C3NRS"} defined $FITS_headers->{"C3NRS"} exists $FITS_headers->{"C3NFOC"} defined $FITS_headers->{"C3NFOC"} exists $FITS_headers->{"C3NCH"} defined $FITS_headers->{"C3NCH"}
Truth table0%0/7
A and B and C and D and E and F
A= exists $FITS_headers->{"C3NRS"}B= defined $FITS_headers->{"C3NRS"}C= exists $FITS_headers->{"C3NFOC"}D= defined $FITS_headers->{"C3NFOC"}E= exists $FITS_headers->{"C3NCH"}F= defined $FITS_headers->{"C3NCH"}
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
297 exists( $FITS_headers->{'C3NFOC'} ) && defined( $FITS_headers->{'C3NFOC'} ) &&
298 exists( $FITS_headers->{'C3NCH'} ) && defined( $FITS_headers->{'C3NCH'} ) ) {
299  
300 0 my $bandwidth = 125 * $FITS_headers->{'C3NRS'} / $FITS_headers->{'C3NFOC'};
301  
302 0 ▶ if ( $bandwidth >= 1000 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bandwidth >= 1000) { } 0 0 0
303 0 $bandwidth /= 1000;
304 0 $return = sprintf( "%dGHzx%d", $bandwidth, $FITS_headers->{'C3NCH'} );
305 } else {
306 0 $return = sprintf( "%dMHzx%d", $bandwidth, $FITS_headers->{'C3NCH'} );
307 }
308 }
309  
310 0 return $return;
311  
312 }
313  
314 =item B<to_EXPOSURE_TIME>
315  
316 =cut
317  
318 sub to_EXPOSURE_TIME {
319 0 ▶ my $self = shift;
Subroutine to_EXPOSURE_TIME: not called CC=42 SCAR=75.0
Pod documented
320 0 my $FITS_headers = shift;
321 0 my $expt = 0;
322  
323 0 ▶ if ( exists( $FITS_headers->{'C6ST'} ) && defined( $FITS_headers->{'C6ST'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C6ST"} and defined $FITS_headers->{"C6ST"}) 0 0 0
Condition0%0/3
exists $FITS_headers->{"C6ST"} and defined $FITS_headers->{"C6ST"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"C6ST"} and defined $FITS_headers->{"C6ST"}
exists $FITS_headers->{"C6ST"} defined $FITS_headers->{"C6ST"}
Truth table0%0/3
A and B
A= exists $FITS_headers->{"C6ST"}B= defined $FITS_headers->{"C6ST"}
ABresult
0X0
100
111
324  
325 0 my $c6st = uc( $FITS_headers->{'C6ST'} );
326  
327 0 ▶ if ( $c6st eq 'RASTER' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($c6st eq 'RASTER') { } 0 0 0
elsif ($c6st eq 'PATTERN' or $c6st eq 'GRID') { } 0 0 0
328  
329 0 ▶ if ( exists( $FITS_headers->{'C3NSAMPL'} ) && defined( $FITS_headers->{'C3NSAMPL'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"} and exists $FITS_headers->{"C3NPP"} and defined $FITS_headers->{"C3NPP"}) 0 0 0
Condition0%0/15
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"} and exists $FITS_headers->{"C3NPP"} and defined $FITS_headers->{"C3NPP"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"} and exists $FITS_headers->{"C3NPP"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3CL"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"}
!ll&&!rl&&r
000
MC/DC0%0/6
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"} and exists $FITS_headers->{"C3NPP"} and defined $FITS_headers->{"C3NPP"}
exists $FITS_headers->{"C3NSAMPL"} defined $FITS_headers->{"C3NSAMPL"} exists $FITS_headers->{"C3CL"} defined $FITS_headers->{"C3CL"} exists $FITS_headers->{"C3NPP"} defined $FITS_headers->{"C3NPP"}
Truth table0%0/7
A and B and C and D and E and F
A= exists $FITS_headers->{"C3NSAMPL"}B= defined $FITS_headers->{"C3NSAMPL"}C= exists $FITS_headers->{"C3CL"}D= defined $FITS_headers->{"C3CL"}E= exists $FITS_headers->{"C3NPP"}F= defined $FITS_headers->{"C3NPP"}
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
330 exists( $FITS_headers->{'C3CL'} ) && defined( $FITS_headers->{'C3CL'} ) &&
331 exists( $FITS_headers->{'C3NPP'} ) && defined( $FITS_headers->{'C3NPP'} ) ) {
332  
333 0 my $c3nsampl = $FITS_headers->{'C3NSAMPL'};
334 0 my $c3cl = $FITS_headers->{'C3CL'};
335 0 my $c3npp = $FITS_headers->{'C3NPP'};
336  
337 # raster.
338 0 $expt = 15 + $c3nsampl * $c3cl * ( 1 + 1 / sqrt( $c3npp ) ) * 1.4;
339 }
340 ▶ } elsif ( $c6st eq 'PATTERN' or $c6st eq 'GRID' ) {
Condition0%0/3
$c6st eq "PATTERN" or $c6st eq "GRID"
l!l&&r!l&&!r
000
MC/DC0%0/2
$c6st eq "PATTERN" or $c6st eq "GRID"
$c6st eq "PATTERN" $c6st eq "GRID"
Truth table0%0/3
A or B
A= $c6st eq "PATTERN"B= $c6st eq "GRID"
ABresult
1X1
011
000
341  
342 0 my $c6mode = '';
343  
344 0 ▶ if ( exists( $FITS_headers->{'C6MODE'} ) && defined( $FITS_headers->{'C6MODE'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{'C6MODE'} and defined $FITS_headers->{'C6MODE'}) { } 0 0 0
Condition0%0/3
exists $FITS_headers->{"C6MODE"} and defined $FITS_headers->{"C6MODE"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"C6MODE"} and defined $FITS_headers->{"C6MODE"}
exists $FITS_headers->{"C6MODE"} defined $FITS_headers->{"C6MODE"}
Truth table0%0/3
A and B
A= exists $FITS_headers->{"C6MODE"}B= defined $FITS_headers->{"C6MODE"}
ABresult
0X0
100
111
345 0 $c6mode = $FITS_headers->{'C6MODE'};
346 } else {
347 0 $c6mode = 'BEAMSWITCH';
348 }
349  
350 0 ▶ if ( exists( $FITS_headers->{'C3NSAMPL'} ) && defined( $FITS_headers->{'C3NSAMPL'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}) 0 0 0
Condition0%0/15
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"}
!ll&&!rl&&r
000
MC/DC0%0/6
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}
exists $FITS_headers->{"C3NSAMPL"} defined $FITS_headers->{"C3NSAMPL"} exists $FITS_headers->{"C3NCYCLE"} defined $FITS_headers->{"C3NCYCLE"} exists $FITS_headers->{"C3CL"} defined $FITS_headers->{"C3CL"}
Truth table0%0/7
A and B and C and D and E and F
A= exists $FITS_headers->{"C3NSAMPL"}B= defined $FITS_headers->{"C3NSAMPL"}C= exists $FITS_headers->{"C3NCYCLE"}D= defined $FITS_headers->{"C3NCYCLE"}E= exists $FITS_headers->{"C3CL"}F= defined $FITS_headers->{"C3CL"}
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
351 exists( $FITS_headers->{'C3NCYCLE'} ) && defined( $FITS_headers->{'C3NCYCLE'} ) &&
352 exists( $FITS_headers->{'C3CL'} ) && defined( $FITS_headers->{'C3CL'} ) ) {
353  
354 0 my $c3nsampl = $FITS_headers->{'C3NSAMPL'};
355 0 my $c3ncycle = $FITS_headers->{'C3NCYCLE'};
356 0 my $c3cl = $FITS_headers->{'C3CL'};
357  
358 0 ▶ if ( $c6mode eq 'POSITION_SWITCH' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($c6mode eq 'POSITION_SWITCH') { } 0 0 0
elsif ($c6mode eq 'BEAMSWITCH') { } 0 0 0
elsif ($c6mode eq 'CHOPPING') { } 0 0 0
359  
360 # position switch pattern/grid.
361 0 $expt = 6 + $c3nsampl * $c3ncycle * $c3cl * 1.35;
362  
363 } elsif ( $c6mode eq 'BEAMSWITCH' ) {
364  
365 # beam switch pattern/grid.
366 0 $expt = 6 + $c3nsampl * $c3ncycle * $c3cl * 1.35;
367  
368 } elsif ( $c6mode eq 'CHOPPING' ) {
369 0 ▶ if ( exists( $FITS_headers->{'C1RCV'} ) && defined( $FITS_headers->{'C1RCV'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C1RCV"} and defined $FITS_headers->{"C1RCV"}) 0 0 0
Condition0%0/3
exists $FITS_headers->{"C1RCV"} and defined $FITS_headers->{"C1RCV"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"C1RCV"} and defined $FITS_headers->{"C1RCV"}
exists $FITS_headers->{"C1RCV"} defined $FITS_headers->{"C1RCV"}
Truth table0%0/3
A and B
A= exists $FITS_headers->{"C1RCV"}B= defined $FITS_headers->{"C1RCV"}
ABresult
0X0
100
111
370 0 my $c1rcv = uc( $FITS_headers->{'C1RCV'} );
371 0 ▶ if ( $c1rcv eq 'RXA3I' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($c1rcv eq 'RXA3I') { } 0 0 0
elsif ($c1rcv eq 'RXB') { } 0 0 0
372  
373 # fast frequency switch pattern/grid, receiver A.
374 0 $expt = 15 + $c3nsampl * $c3ncycle * $c3cl * 1.20;
375  
376 } elsif ( $c1rcv eq 'RXB' ) {
377  
378 # slow frequency switch pattern/grid, receiver B.
379 0 $expt = 18 + $c3nsampl * $c3ncycle * $c3cl * 1.60;
380  
381 }
382 }
383 }
384 }
385 } else {
386  
387 0 my $c6mode;
388 0 ▶ if ( exists( $FITS_headers->{'C6MODE'} ) && defined( $FITS_headers->{'C6MODE'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{'C6MODE'} and defined $FITS_headers->{'C6MODE'}) { } 0 0 0
Condition0%0/3
exists $FITS_headers->{"C6MODE"} and defined $FITS_headers->{"C6MODE"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"C6MODE"} and defined $FITS_headers->{"C6MODE"}
exists $FITS_headers->{"C6MODE"} defined $FITS_headers->{"C6MODE"}
Truth table0%0/3
A and B
A= exists $FITS_headers->{"C6MODE"}B= defined $FITS_headers->{"C6MODE"}
ABresult
0X0
100
111
389 0 $c6mode = $FITS_headers->{'C6MODE'};
390 } else {
391 0 $c6mode = 'BEAMSWITCH';
392 }
393  
394 0 ▶ if ( exists( $FITS_headers->{'C3NSAMPL'} ) && defined( $FITS_headers->{'C3NSAMPL'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}) 0 0 0
Condition0%0/15
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"}
!ll&&!rl&&r
000
MC/DC0%0/6
exists $FITS_headers->{"C3NSAMPL"} and defined $FITS_headers->{"C3NSAMPL"} and exists $FITS_headers->{"C3NCYCLE"} and defined $FITS_headers->{"C3NCYCLE"} and exists $FITS_headers->{"C3CL"} and defined $FITS_headers->{"C3CL"}
exists $FITS_headers->{"C3NSAMPL"} defined $FITS_headers->{"C3NSAMPL"} exists $FITS_headers->{"C3NCYCLE"} defined $FITS_headers->{"C3NCYCLE"} exists $FITS_headers->{"C3CL"} defined $FITS_headers->{"C3CL"}
Truth table0%0/7
A and B and C and D and E and F
A= exists $FITS_headers->{"C3NSAMPL"}B= defined $FITS_headers->{"C3NSAMPL"}C= exists $FITS_headers->{"C3NCYCLE"}D= defined $FITS_headers->{"C3NCYCLE"}E= exists $FITS_headers->{"C3CL"}F= defined $FITS_headers->{"C3CL"}
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
395 exists( $FITS_headers->{'C3NCYCLE'} ) && defined( $FITS_headers->{'C3NCYCLE'} ) &&
396 exists( $FITS_headers->{'C3CL'} ) && defined( $FITS_headers->{'C3CL'} ) ) {
397  
398 0 my $c3nsampl = $FITS_headers->{'C3NSAMPL'};
399 0 my $c3ncycle = $FITS_headers->{'C3NCYCLE'};
400 0 my $c3cl = $FITS_headers->{'C3CL'};
401  
402 0 ▶ if ( $c6mode eq 'POSITION_SWITCH' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($c6mode eq 'POSITION_SWITCH') { } 0 0 0
elsif ($c6mode eq 'BEAMSWITCH') { } 0 0 0
elsif ($c6mode eq 'CHOPPING') { } 0 0 0
403  
404 # position switch sample.
405 0 $expt = 4.8 + $c3nsampl * $c3ncycle * $c3cl * 1.10;
406  
407 } elsif ( $c6mode eq 'BEAMSWITCH' ) {
408  
409 # beam switch sample.
410 0 $expt = 4.8 + $c3nsampl * $c3ncycle * $c3cl * 1.25;
411  
412 } elsif ( $c6mode eq 'CHOPPING' ) {
413 0 ▶ if ( exists( $FITS_headers->{'C1RCV'} ) && defined( $FITS_headers->{'C1RCV'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C1RCV"} and defined $FITS_headers->{"C1RCV"}) 0 0 0
Condition0%0/3
exists $FITS_headers->{"C1RCV"} and defined $FITS_headers->{"C1RCV"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"C1RCV"} and defined $FITS_headers->{"C1RCV"}
exists $FITS_headers->{"C1RCV"} defined $FITS_headers->{"C1RCV"}
Truth table0%0/3
A and B
A= exists $FITS_headers->{"C1RCV"}B= defined $FITS_headers->{"C1RCV"}
ABresult
0X0
100
111
414 0 my $c1rcv = uc( $FITS_headers->{'C1RCV'} );
415 0 ▶ if ( $c1rcv eq 'RXA3I' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($c1rcv eq 'RXA3I') { } 0 0 0
elsif ($c1rcv eq 'RXB') { } 0 0 0
416  
417 # fast frequency switch sample, receiver A.
418 0 $expt = 3 + $c3nsampl * $c3ncycle * $c3cl * 1.10;
419  
420 } elsif ( $c1rcv eq 'RXB' ) {
421  
422 # slow frequency switch sample, receiver B.
423 0 $expt = 3 + $c3nsampl * $c3ncycle * $c3cl * 1.40;
424 }
425 }
426 }
427 }
428 }
429 }
430  
431 0 return $expt;
432 }
433  
434 =item B<to_SYSTEM_VELOCITY>
435  
436 Translate the C<C12VREF> and C<C12VDEF> headers into one combined header.
437  
438 =cut
439  
440 sub to_SYSTEM_VELOCITY {
441 0 ▶ my $self = shift;
Subroutine to_SYSTEM_VELOCITY: not called CC=5 SCAR=34.0
Pod documented
442 0 my $FITS_headers = shift;
443 0 my $return;
444 0 ▶ if ( exists( $FITS_headers->{'C12VREF'} ) && defined( $FITS_headers->{'C12VREF'} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"C12VREF"} and defined $FITS_headers->{"C12VREF"} and exists $FITS_headers->{"C12VDEF"} and defined $FITS_headers->{"C12VDEF"}) 0 0 0
Condition0%0/9
exists $FITS_headers->{"C12VREF"} and defined $FITS_headers->{"C12VREF"} and exists $FITS_headers->{"C12VDEF"} and defined $FITS_headers->{"C12VDEF"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C12VREF"} and defined $FITS_headers->{"C12VREF"} and exists $FITS_headers->{"C12VDEF"}
!ll&&!rl&&r
000
exists $FITS_headers->{"C12VREF"} and defined $FITS_headers->{"C12VREF"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $FITS_headers->{"C12VREF"} and defined $FITS_headers->{"C12VREF"} and exists $FITS_headers->{"C12VDEF"} and defined $FITS_headers->{"C12VDEF"}
exists $FITS_headers->{"C12VREF"} defined $FITS_headers->{"C12VREF"} exists $FITS_headers->{"C12VDEF"} defined $FITS_headers->{"C12VDEF"}
Truth table0%0/5
A and B and C and D
A= exists $FITS_headers->{"C12VREF"}B= defined $FITS_headers->{"C12VREF"}C= exists $FITS_headers->{"C12VDEF"}D= defined $FITS_headers->{"C12VDEF"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
445 exists( $FITS_headers->{'C12VDEF'} ) && defined( $FITS_headers->{'C12VDEF'} ) ) {
446 0 $return = substr( $FITS_headers->{'C12VDEF'}, 0, 3 ) . substr( $FITS_headers->{'C12VREF'}, 0, 3 );
447 }
448 0 return $return;
449 }
450  
451 =back
452  
453 =head1 AUTHOR
454  
455 Brad Cavanagh E<lt>b.cavanagh@jach.hawaii.eduE<gt>,
456 Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>
457  
458 =head1 COPYRIGHT
459  
460 Copyright (C) 2008 Science and Technology Facilities Council.
461 Copyright (C) 2003-2007 Particle Physics and Astronomy Research Council.
462 All Rights Reserved.
463  
464 This program is free software; you can redistribute it and/or modify it under
465 the terms of the GNU General Public License as published by the Free Software
466 Foundation; either version 2 of the License, or (at your option) any later
467 version.
468  
469 This program is distributed in the hope that it will be useful,but WITHOUT ANY
470 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
471 PARTICULAR PURPOSE. See the GNU General Public License for more details.
472  
473 You should have received a copy of the GNU General Public License along with
474 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
475 Place,Suite 330, Boston, MA 02111-1307, USA
476  
477 =cut
478  
479 10 1;
↑ Summary blib/lib/Astro/FITS/HdrTrans/NACO.pm »