HdrTrans/SPEX.pm

filter: Statementstmt 10.1% 21 / 208 Branchbran 0.0% 0 / 54 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 17.6% 6 / 34 Podpod 13.7% 4 / 29 totaltotal 8.7% 31 / 354 CC 34 SCAR 23.8
CC
34
Cov
8%
to_OBSERVATION_TYPE
30.0
to_UTDATE
30.0
to_RA_TELESCOPE_OFFSET
20.0
CRAP 10.8
« HdrTrans/WFCAM.pm ↑ Summary HdrTrans/INGRID.pm »
1 package Astro::FITS::HdrTrans::SPEX;
2  
3 =head1 NAME
4  
5 Astro::FITS::HdrTrans::SPEX - IRTF SPEX translations
6  
7 =head1 SYNOPSIS
8  
9 use Astro::FITS::HdrTrans::SPEX;
10  
11 %gen = Astro::FITS::HdrTrans::SPEX->translate_from_FITS( %hdr );
12  
13 =head1 DESCRIPTION
14  
15 This class provides a generic set of translations that are specific to
16 the SPEX camera of the IRTF.
17  
18 =cut
19  
20 10 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 # Inherit from ESO
26 10 ▶use base qw/ Astro::FITS::HdrTrans::FITS /;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 10 our $VERSION = "1.66";
29  
30 # for a constant mapping, there is no FITS header, just a generic
31 # header that is constant
32 10 my %CONST_MAP = (
33 # Value in headers is too imprecise
34 DEC_SCALE => (-0.1182/3600.0),
35 DETECTOR_READ_TYPE => 'NDSTARE',
36 GAIN => 13.0,
37 OBSERVATION_MODE => 'imaging',
38 NSCAN_POSITIONS => 1,
39 # Value in headers is too imprecise
40 RA_SCALE => (-0.116/3600.0),
41 ROTATION => -1.03,
42 SPEED_GAIN => 'Normal',
43 );
44  
45 # NULL mappings used to override base class implementations
46 10 my @NULL_MAP = qw/ /;
47  
48 # unit mapping implies that the value propogates directly
49 # to the output with only a keyword name change
50  
51 10 my %UNIT_MAP = (
52 EXPOSURE_TIME => "ITIME",
53 FILTER => "GFLT",
54 OBJECT => 'OBJECT',
55 );
56  
57  
58 # Create the translation methods
59 10 __PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP, \@NULL_MAP );
60  
61 =head1 METHODS
62  
63 =over 4
64  
65 =item B<this_instrument>
66  
67 The name of the instrument required to match (case insensitively)
68 against the INSTRUME/INSTRUMENT keyword to allow this class to
69 translate the specified headers. Called by the default
70 C<can_translate> method.
71  
72 $inst = $class->this_instrument();
73  
74 Returns "INGRID".
75  
76 =cut
77  
78 20 ▶sub this_instrument {
Subroutine this_instrument: called CC=1 SCAR=0.0
Pod documented
79 20 return qr/^SPEX/i;
80 }
81  
82 =back
83  
84 =head1 COMPLEX CONVERSIONS
85  
86 =over 4
87  
88 =cut
89  
90 0 ▶sub to_AIRMASS_START {
Subroutine to_AIRMASS_START: not called CC=2 SCAR=17.9
Pod undocumented
91 0 my $self = shift;
92 0 my $FITS_headers = shift;
93 0 my $airmass = 1.0;
94 0 ▶ if ( defined( $FITS_headers->{AIRMASS} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $FITS_headers->{"AIRMASS"}) 0 0 0
95 0 $airmass = $FITS_headers->{AIRMASS};
96 }
97 0 return $airmass;
98 }
99  
100 0 ▶sub to_AIRMASS_END {
Subroutine to_AIRMASS_END: not called CC=2 SCAR=17.9
Pod undocumented
101 0 my $self = shift;
102 0 my $FITS_headers = shift;
103 0 my $airmass = 1.0;
104 0 ▶ if ( defined( $FITS_headers->{AIRMASS} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $FITS_headers->{"AIRMASS"}) 0 0 0
105 0 $airmass = $FITS_headers->{AIRMASS};
106 }
107 0 return $airmass;
108 }
109  
110 0 ▶sub from_AIRMASS_END {
Subroutine from_AIRMASS_END: not called CC=1 SCAR=6.9
Pod undocumented
111 0 my $self = shift;
112 0 my $generic_headers = shift;
113 0 "AMEND", $generic_headers->{ "AIRMASS_END" };
114 }
115  
116 # Convert from sexagesimal d:m:s to decimal degrees.
117 0 ▶sub to_DEC_BASE {
Subroutine to_DEC_BASE: not called CC=2 SCAR=17.9
Pod undocumented
118 0 my $self = shift;
119 0 my $FITS_headers = shift;
120 0 my $dec = 0.0;
121 0 my $sexa = $FITS_headers->{"DECBASE"};
122 0 ▶ if ( defined( $sexa ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sexa) 0 0 0
123 0 $dec = $self->dms_to_degrees( $sexa );
124 }
125 0 return $dec;
126 }
127  
128 # Assume that the initial offset is 0.0, i.e. the base is the
129 # source position. This also assumes that the reference pixel
130 # is unchanged in the group, as is created in the conversion
131 # script. The other headers are measured in sexagesimal, but
132 # the offsets are in arcseconds.
133 0 ▶sub to_DEC_TELESCOPE_OFFSET {
Subroutine to_DEC_TELESCOPE_OFFSET: not called CC=2 SCAR=17.9
Pod undocumented
134 0 my $self = shift;
135 0 my $FITS_headers = shift;
136 0 my $offset;
137 0 my $base = $self->to_DEC_BASE($FITS_headers);
138  
139 # Convert from sexagesimal d:m:s to decimal degrees.
140 0 my $sexadec = $FITS_headers->{DEC};
141 0 ▶ if ( defined( $sexadec ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sexadec) { } 0 0 0
142 0 my $dec = $self->dms_to_degrees( $sexadec );
143  
144 # The offset is arcseconds with respect to the base position.
145 0 $offset = 3600.0 * ( $dec - $base );
146 } else {
147 0 $offset = 0.0;
148 }
149 0 return $offset;
150 }
151  
152 0 ▶sub to_DR_RECIPE {
Subroutine to_DR_RECIPE: not called CC=3 SCAR=24.8
Pod undocumented
153 0 my $self = shift;
154 0 my $FITS_headers = shift;
155 0 my $recipe = "JITTER_SELF_FLAT";
156 0 ▶ if ( $self->to_OBSERVATION_TYPE($FITS_headers) eq "DARK" ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->to_OBSERVATION_TYPE($FITS_headers) eq 'DARK') { } 0 0 0
elsif ($self->to_STANDARD($FITS_headers)) { } 0 0 0
157 0 $recipe = "REDUCE_DARK";
158 } elsif ( $self->to_STANDARD($FITS_headers) ) {
159 0 $recipe = "JITTER_SELF_FLAT_APHOT";
160 }
161 0 return $recipe;
162 }
163  
164  
165 0 ▶sub to_NUMBER_OF_EXPOSURES {
Subroutine to_NUMBER_OF_EXPOSURES: not called CC=2 SCAR=17.9
Pod undocumented
166 0 my $self = shift;
167 0 my $FITS_headers = shift;
168 0 my $coadds = 1;
169 0 ▶ if ( defined $FITS_headers->{CO_ADDS} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $FITS_headers->{"CO_ADDS"}) 0 0 0
170 0 $coadds = $FITS_headers->{CO_ADDS};
171 }
172  
173 }
174  
175 0 ▶sub to_NUMBER_OF_OFFSETS {
Subroutine to_NUMBER_OF_OFFSETS: not called CC=2 SCAR=17.9
Pod undocumented
176 0 my $self = shift;
177 0 my $FITS_headers = shift;
178  
179 # Allow for the UKIRT convention of the final offset to 0,0, and a
180 # default dither pattern of 5.
181 0 my $noffsets = 6;
182  
183 # The number of gripu members appears to be given by keyword LOOP.
184 0 ▶ if ( defined $FITS_headers->{NOFFSETS} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $FITS_headers->{"NOFFSETS"}) 0 0 0
185 0 $noffsets = $FITS_headers->{NOFFSETS};
186 }
187  
188 0 return $noffsets;
189 }
190  
191 0 ▶sub to_OBSERVATION_TYPE {
Subroutine to_OBSERVATION_TYPE: not called CC=5 SCAR=34.0
Pod undocumented
192 0 my $self = shift;
193 0 my $FITS_headers = shift;
194 0 my $type = "OBJECT";
195 0 ▶ if ( defined $FITS_headers->{OBJECT} && defined $FITS_headers->{GFLT}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $FITS_headers->{"OBJECT"} and defined $FITS_headers->{"GFLT"}) 0 0 0
Condition0%0/3
defined $FITS_headers->{"OBJECT"} and defined $FITS_headers->{"GFLT"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $FITS_headers->{"OBJECT"} and defined $FITS_headers->{"GFLT"}
defined $FITS_headers->{"OBJECT"} defined $FITS_headers->{"GFLT"}
Truth table0%0/3
A and B
A= defined $FITS_headers->{"OBJECT"}B= defined $FITS_headers->{"GFLT"}
ABresult
0X0
100
111
196 0 my $object = uc( $FITS_headers->{OBJECT} );
197 0 my $filter = uc( $FITS_headers->{GFLT} );
198 0 ▶ if ( $filter =~ /blank/i ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($filter =~ /blank/i) { } 0 0 0
elsif ($object =~ /flat/i) { } 0 0 0
199 0 $type = "DARK";
200 } elsif ( $object =~ /flat/i ) {
201 0 $type = "FLAT";
202 }
203 }
204 0 return $type;
205 }
206  
207 # Convert from sexagesimal h:m:s to decimal degrees then to decimal
208 # hours.
209 0 ▶sub to_RA_BASE {
Subroutine to_RA_BASE: not called CC=2 SCAR=17.9
Pod undocumented
210 0 my $self = shift;
211 0 my $FITS_headers = shift;
212 0 my $ra = 0.0;
213 0 my $sexa = $FITS_headers->{"RABASE"};
214 0 ▶ if ( defined( $sexa ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sexa) 0 0 0
215 0 $ra = $self->hms_to_degrees( $sexa );
216 }
217 0 return $ra;
218 }
219  
220 # Assume that the initial offset is 0.0, i.e. the base is the
221 # source position. This also assumes that the reference pixel
222 # is unchanged in the group, as is created in the conversion
223 # script. The other headers are measured in sexagesimal, but
224 # the offsets are in arcseconds.
225 0 ▶sub to_RA_TELESCOPE_OFFSET {
Subroutine to_RA_TELESCOPE_OFFSET: not called CC=4 SCAR=30.0
Pod undocumented
226 0 my $self = shift;
227 0 my $FITS_headers = shift;
228 0 my $offset;
229  
230 # Base RA is in degrees.
231 0 my $base = $self->to_RA_BASE($FITS_headers);
232  
233 # Convert from sexagesimal right ascension h:m:s and declination
234 # d:m:s to decimal degrees.
235 0 my $sexara = $FITS_headers->{RA};
236 0 my $sexadec = $FITS_headers->{DEC};
237 0 ▶ if ( defined( $base ) && defined( $sexara ) && defined( $sexadec ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $base and defined $sexara and defined $sexadec) { } 0 0 0
Condition0%0/6
defined $base and defined $sexara and defined $sexadec
!ll&&!rl&&r
000
defined $base and defined $sexara
!ll&&!rl&&r
000
MC/DC0%0/3
defined $base and defined $sexara and defined $sexadec
defined $base defined $sexara defined $sexadec
Truth table0%0/4
A and B and C
A= defined $baseB= defined $sexaraC= defined $sexadec
ABCresult
0XX0
10X0
1100
1111
238 0 my $dec = $self->dms_to_degrees( $sexadec );
239 0 my $ra = $self->hms_to_degrees( $sexara );
240  
241 # The offset is arcseconds with respect to the base position.
242 0 $offset = 3600.0 * ( $ra - $base ) * $self->cosdeg( $dec );
243 } else {
244 0 $offset = 0.0;
245 }
246 0 return $offset;
247 }
248  
249 # Take a pragmatic way of defining a standard. Not perfect, but
250 # should suffice unitl we know all the names.
251 0 ▶sub to_STANDARD {
Subroutine to_STANDARD: not called CC=3 SCAR=24.8
Pod undocumented
252 0 my $self = shift;
253 0 my $FITS_headers = shift;
254 0 my $standard = 0;
255 0 my $object = $FITS_headers->{"OBJECT"};
256 0 ▶ if ( defined( $object ) && $object =~ /^FS/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $object and $object =~ /^FS/) 0 0 0
Condition0%0/3
defined $object and $object =~ /^FS/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $object and $object =~ /^FS/
defined $object $object =~ /^FS/
Truth table0%0/3
A and B
A= defined $objectB= $object =~ /^FS/
ABresult
0X0
100
111
257 0 $standard = 1;
258 }
259 0 return $standard;
260 }
261  
262 # Allow for multiple occurences of the date, the first being valid and
263 # the second is blank.
264 0 ▶sub to_UTDATE {
Subroutine to_UTDATE: not called CC=5 SCAR=34.0
Pod documented
265 0 my $self = shift;
266 0 my $FITS_headers = shift;
267 0 my $utdate;
268 0 ▶ if ( exists $FITS_headers->{"DATE-OBS"} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $FITS_headers->{'DATE-OBS'}) { } 0 0 0
elsif (exists $FITS_headers->{'DATE_OBS'}) { } 0 0 0
269 0 $utdate = $FITS_headers->{"DATE-OBS"};
270  
271 # This is a kludge to work with old data which has multiple values of
272 # the DATE keyword with the last value being blank (these were early
273 # SPEX data). Return the first value, since the last value can be
274 # blank.
275 0 ▶ if ( ref( $utdate ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $utdate eq "ARRAY") 0 0 0
276 0 $utdate = $utdate->[0];
277 }
278 } elsif (exists $FITS_headers->{'DATE_OBS'}) {
279 0 $utdate = $FITS_headers->{'DATE_OBS'};
280 }
281 0 ▶ $utdate =~ s/-//g if $utdate;
Branch: 1 branch
BranchTrueFalseTotal
if $utdate 0 0 0
282 0 return $utdate;
283 }
284  
285 # Derive from the start time, plus the exposure time and some
286 # allowance for the read time taken from
287 # http://irtfweb.ifa.hawaii.edu/~spex
288 # http://irtfweb.ifa.hawaii.edu/Facility/spex/work/array_params/array_params.html
289 0 ▶sub to_UTEND {
Subroutine to_UTEND: not called CC=3 SCAR=24.8
Pod documented
290 0 my $self = shift;
291 0 my $FITS_headers = shift;
292 0 my $utend = $self->to_UTSTART($FITS_headers);
293 0 ▶ if ( defined $FITS_headers->{ITIME} && defined $FITS_headers->{NDR} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $FITS_headers->{"ITIME"} and defined $FITS_headers->{"NDR"}) 0 0 0
Condition0%0/3
defined $FITS_headers->{"ITIME"} and defined $FITS_headers->{"NDR"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $FITS_headers->{"ITIME"} and defined $FITS_headers->{"NDR"}
defined $FITS_headers->{"ITIME"} defined $FITS_headers->{"NDR"}
Truth table0%0/3
A and B
A= defined $FITS_headers->{"ITIME"}B= defined $FITS_headers->{"NDR"}
ABresult
0X0
100
111
294 0 $utend += ( $FITS_headers->{ITIME} * $FITS_headers->{NDR}) ;
295 }
296 0 return $utend;
297 }
298  
299 0 ▶sub to_UTSTART {
Subroutine to_UTSTART: not called CC=3 SCAR=24.8
Pod documented
300 0 my $self = shift;
301 0 my $FITS_headers = shift;
302 0 my $base = $self->to_UTDATE( $FITS_headers );
303 0 ▶ return unless defined $base;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $base 0 0 0
304 0 ▶ if (exists $FITS_headers->{TIME_OBS}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"TIME_OBS"}) 0 0 0
305 0 my $ymd = substr($base,0,4). "-". substr($base,4,2)."-". substr($base,6,2);
306 0 my $iso = $ymd. "T" . $FITS_headers->{TIME_OBS};
307 0 return $self->_parse_iso_date( $iso );
308 }
309 0 return;
310 }
311  
312 0 ▶sub to_X_LOWER_BOUND {
Subroutine to_X_LOWER_BOUND: not called CC=1 SCAR=6.9
Pod undocumented
313 0 my $self = shift;
314 0 my $FITS_headers = shift;
315 0 my @bounds = $self->get_bounds($FITS_headers);
316 0 return $bounds[ 0 ];
317 }
318  
319 # Specify the reference pixel, which is normally near the frame centre.
320 0 ▶sub to_X_REFERENCE_PIXEL{
Subroutine to_X_REFERENCE_PIXEL: not called CC=2 SCAR=17.9
Pod undocumented
321 0 my $self = shift;
322 0 my $FITS_headers = shift;
323 0 my $xref;
324  
325 # Use the average of the bounds to define the centre and dimension.
326 0 my @bounds = $self->get_bounds($FITS_headers);
327 0 my $xdim = $bounds[ 2 ] - $bounds[ 0 ] + 1;
328 0 my $xmid = $self->nint( ( $bounds[ 2 ] + $bounds[ 0 ] ) / 2 );
329  
330 # SPEX is at the centre for a sub-array along an axis but offset slightly
331 # for a sub-array to avoid the joins between the four sub-array sections
332 # of the frame. Ideally these should come through the headers...
333 0 ▶ if ( $xdim == 512 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($xdim == 512) { } 0 0 0
334 0 $xref = $xmid - 36;
335 } else {
336 0 $xref = $xmid;
337 }
338 0 return $xref;
339 }
340  
341 0 ▶sub from_X_REFERENCE_PIXEL {
Subroutine from_X_REFERENCE_PIXEL: not called CC=1 SCAR=6.9
Pod undocumented
342 0 my $self = shift;
343 0 my $generic_headers = shift;
344 0 "CRPIX1", $generic_headers->{"X_REFERENCE_PIXEL"};
345 }
346  
347 0 ▶sub to_X_UPPER_BOUND {
Subroutine to_X_UPPER_BOUND: not called CC=1 SCAR=6.9
Pod undocumented
348 0 my $self = shift;
349 0 my $FITS_headers = shift;
350 0 my @bounds = $self->get_bounds( $FITS_headers );
351 0 return $bounds[ 2 ];
352 }
353  
354 0 ▶sub to_Y_LOWER_BOUND {
Subroutine to_Y_LOWER_BOUND: not called CC=1 SCAR=6.9
Pod undocumented
355 0 my $self = shift;
356 0 my $FITS_headers = shift;
357 0 my @bounds = $self->get_bounds( $FITS_headers );
358 0 return $bounds[ 1 ];
359 }
360  
361 # Specify the reference pixel, which is normally near the frame centre.
362 0 ▶sub to_Y_REFERENCE_PIXEL{
Subroutine to_Y_REFERENCE_PIXEL: not called CC=2 SCAR=17.9
Pod undocumented
363 0 my $self = shift;
364 0 my $FITS_headers = shift;
365 0 my $yref;
366  
367 # Use the average of the bounds to define the centre and dimension.
368 0 my @bounds = $self->get_bounds($FITS_headers);
369 0 my $ydim = $bounds[ 3 ] - $bounds[ 1 ] + 1;
370 0 my $ymid = $self->nint( ( $bounds[ 3 ] + $bounds[ 1 ] ) / 2 );
371  
372 # SPEX is at the centre for a sub-array along an axis but offset slightly
373 # for a sub-array to avoid the joins between the four sub-array sections
374 # of the frame. Ideally these should come through the headers...
375 0 ▶ if ( $ydim == 512 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ydim == 512) { } 0 0 0
376 0 $yref = $ymid - 40;
377 } else {
378 0 $yref = $ymid;
379 }
380  
381 0 return $yref;
382 }
383  
384 0 ▶sub from_Y_REFERENCE_PIXEL {
Subroutine from_Y_REFERENCE_PIXEL: not called CC=1 SCAR=6.9
Pod undocumented
385 0 my $self = shift;
386 0 my $generic_headers = shift;
387 0 "CRPIX2", $generic_headers->{"Y_REFERENCE_PIXEL"};
388 }
389  
390 0 ▶sub to_Y_UPPER_BOUND {
Subroutine to_Y_UPPER_BOUND: not called CC=1 SCAR=6.9
Pod undocumented
391 0 my $self = shift;
392 0 my $FITS_headers = shift;
393 0 my @bounds = $self->get_bounds( $FITS_headers );
394 0 return $bounds[ 3 ];
395 }
396  
397 # Supplementary methods for the translations
398 # ------------------------------------------
399  
400 # Converts a sky angle specified in d:m:s format into decimal degrees.
401 # Argument is the sexagesimal format angle.
402 0 ▶sub dms_to_degrees {
Subroutine dms_to_degrees: not called CC=2 SCAR=17.9
Pod undocumented
403 0 my $self = shift;
404 0 my $sexa = shift;
405 0 my $dms;
406 0 ▶ if ( defined( $sexa ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sexa) 0 0 0
407 0 my @pos = split( /:/, $sexa );
408 0 $dms = $pos[ 0 ] + $pos[ 1 ] / 60.0 + $pos [ 2 ] / 3600.;
409 }
410 0 return $dms;
411 }
412  
413 0 ▶sub get_bounds {
Subroutine get_bounds: not called CC=2 SCAR=17.9
Pod undocumented
414 0 my $self = shift;
415 0 my $FITS_headers = shift;
416 0 my @bounds = ( 1, 1, 512, 512 );
417 0 ▶ if ( exists $FITS_headers->{ARRAY0} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{"ARRAY0"}) 0 0 0
418 0 my $boundlist = $FITS_headers->{ARRAY0};
419 0 @bounds = split( ",", $boundlist );
420  
421 # Bounds count from zero.
422 0 $bounds[ 0 ]++;
423 0 $bounds[ 1 ]++;
424 }
425 0 return @bounds;
426 }
427  
428 # Returns the UT date in yyyyMMdd format.
429 0 ▶sub get_UT_date {
Subroutine get_UT_date: not called CC=1 SCAR=6.9
Pod undocumented
430 0 my $self = shift;
431 0 my $FITS_headers = shift;
432 0 my $date = $FITS_headers->{"DATE-OBS"};
433 0 $date =~ s/-//g;
434 0 return $date;
435 }
436  
437 # Returns the UT time of observation in decimal hours.
438 0 ▶sub get_UT_hours {
Subroutine get_UT_hours: not called CC=3 SCAR=24.8
Pod undocumented
439 0 my $self = shift;
440 0 my $FITS_headers = shift;
441 0 ▶ if ( exists $FITS_headers->{"TIME-OBS"} && $FITS_headers->{"TIME-OBS"} =~ /:/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $FITS_headers->{'TIME-OBS'} and $FITS_headers->{'TIME-OBS'} =~ /:/) { } 0 0 0
Condition0%0/3
exists $FITS_headers->{"TIME-OBS"} and $FITS_headers->{"TIME-OBS"} =~ /:/
!ll&&!rl&&r
000
MC/DC0%0/2
exists $FITS_headers->{"TIME-OBS"} and $FITS_headers->{"TIME-OBS"} =~ /:/
exists $FITS_headers->{"TIME-OBS"} $FITS_headers->{"TIME-OBS"} =~ /:/
Truth table0%0/3
A and B
A= exists $FITS_headers->{"TIME-OBS"}B= $FITS_headers->{"TIME-OBS"} =~ /:/
ABresult
0X0
100
111
442 0 my ($hour, $minute, $second) = split( /:/, $FITS_headers->{"TIME-OBS"} );
443 0 return $hour + ($minute / 60) + ($second / 3600);
444 } else {
445 0 return $FITS_headers->{"TIME-OBS"};
446 }
447 }
448  
449 # Converts a sky angle specified in h:m:s format into decimal degrees.
450 # It takes no account of latitude. Argument is the sexagesimal format angle.
451 0 ▶sub hms_to_degrees {
Subroutine hms_to_degrees: not called CC=2 SCAR=17.9
Pod undocumented
452 0 my $self = shift;
453 0 my $sexa = shift;
454 0 my $hms;
455 0 ▶ if ( defined( $sexa ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sexa) 0 0 0
456 0 my @pos = split( /:/, $sexa );
457 0 $hms = 15.0 * ( $pos[ 0 ] + $pos[ 1 ] / 60.0 + $pos [ 2 ] / 3600. );
458 }
459 0 return $hms;
460 }
461  
462  
463 =back
464  
465 =head1 SEE ALSO
466  
467 C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::UKIRT>.
468  
469 =head1 AUTHOR
470  
471 Malcolm J. Currie E<lt>mjc@star.rl.ac.ukE<gt>,
472 Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>.
473  
474 =head1 COPYRIGHT
475  
476 Copyright (C) 2008 Science and Technology Facilities Council.
477 Copyright (C) 2003-2005 Particle Physics and Astronomy Research Council.
478 All Rights Reserved.
479  
480 This program is free software; you can redistribute it and/or modify it under
481 the terms of the GNU General Public License as published by the Free Software
482 Foundation; either Version 2 of the License, or (at your option) any later
483 version.
484  
485 This program is distributed in the hope that it will be useful,but WITHOUT ANY
486 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
487 PARTICULAR PURPOSE. See the GNU General Public License for more details.
488  
489 You should have received a copy of the GNU General Public License along with
490 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
491 Place, Suite 330, Boston, MA 02111-1307, USA.
492  
493 =cut
494  
495 10 1;
« HdrTrans/WFCAM.pm ↑ Summary HdrTrans/INGRID.pm »