| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Astro::FITS::HdrTrans::UKIRTOld; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Astro::FITS::HdrTrans::UKIRTOld - Base class for translation of old UKIRT instruments |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Astro::FITS::HdrTrans::UKIRTOld; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This class provides a generic set of translations that are common to |
|
14
|
|
|
|
|
|
|
CGS4 and IRCAM from the United Kingdom Infrared Telescope. It should |
|
15
|
|
|
|
|
|
|
not be used directly for translation of instrument FITS headers. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
12
|
|
|
12
|
|
29446269
|
use 5.006; |
|
|
12
|
|
|
|
|
64
|
|
|
20
|
12
|
|
|
12
|
|
67
|
use warnings; |
|
|
12
|
|
|
|
|
34
|
|
|
|
12
|
|
|
|
|
433
|
|
|
21
|
12
|
|
|
12
|
|
87
|
use strict; |
|
|
12
|
|
|
|
|
30
|
|
|
|
12
|
|
|
|
|
368
|
|
|
22
|
12
|
|
|
12
|
|
66
|
use Carp; |
|
|
12
|
|
|
|
|
26
|
|
|
|
12
|
|
|
|
|
1005
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Inherit from UKIRT |
|
25
|
12
|
|
|
12
|
|
97
|
use base qw/ Astro::FITS::HdrTrans::UKIRT /; |
|
|
12
|
|
|
|
|
57
|
|
|
|
12
|
|
|
|
|
6180
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
12
|
|
|
12
|
|
153
|
use vars qw/ $VERSION /; |
|
|
12
|
|
|
|
|
27
|
|
|
|
12
|
|
|
|
|
7950
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$VERSION = "1.64"; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# For a constant mapping, there is no FITS header, just a generic |
|
32
|
|
|
|
|
|
|
# header that is constant. |
|
33
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
my %UNIT_MAP = ( |
|
40
|
|
|
|
|
|
|
DETECTOR_READ_TYPE => "MODE", # Also UFTI |
|
41
|
|
|
|
|
|
|
DR_RECIPE => "DRRECIPE", |
|
42
|
|
|
|
|
|
|
EXPOSURE_TIME => "DEXPTIME", |
|
43
|
|
|
|
|
|
|
GAIN => "DEPERDN", |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Create the translation methods. |
|
47
|
|
|
|
|
|
|
__PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP ); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 COMPLEX CONVERSIONS |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
These methods are more complicated than a simple mapping. We have to |
|
52
|
|
|
|
|
|
|
provide both from- and to-FITS conversions. All these routines are |
|
53
|
|
|
|
|
|
|
methods and the to_ routines all take a reference to a hash and return |
|
54
|
|
|
|
|
|
|
the translated value (a many-to-one mapping). The from_ methods take |
|
55
|
|
|
|
|
|
|
a reference to a generic hash and return a translated hash (sometimes |
|
56
|
|
|
|
|
|
|
these are many-to-many). |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=over 4 |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item B<to_UTDATE> |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Converts IDATE into UTDATE without any modification. Flattens |
|
63
|
|
|
|
|
|
|
duplicate headers into a single header. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub to_UTDATE { |
|
68
|
36
|
|
|
36
|
1
|
62
|
my $self = shift; |
|
69
|
36
|
|
|
|
|
61
|
my $FITS_headers = shift; |
|
70
|
36
|
|
|
|
|
49
|
my $return; |
|
71
|
36
|
50
|
|
|
|
115
|
my $utdate = ( exists $FITS_headers->{IDATE} ? $FITS_headers->{IDATE} : undef ); |
|
72
|
36
|
50
|
33
|
|
|
2024
|
if ( defined( $utdate ) && ref( $utdate ) eq 'ARRAY' ) { |
|
73
|
0
|
|
|
|
|
0
|
$return = $utdate->[0]; |
|
74
|
|
|
|
|
|
|
} else { |
|
75
|
36
|
|
|
|
|
100
|
$return = $utdate; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
36
|
|
|
|
|
88
|
return $return; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item B<from_UTDATE> |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Converts UTDATE into IDATE without any modification. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub from_UTDATE { |
|
87
|
6
|
|
|
6
|
1
|
72
|
return ( "IDATE", $_[1]->{'UTDATE'} ); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item B<to_UTSTART> |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Converts FITS header UT date/time values for the start of the observation |
|
93
|
|
|
|
|
|
|
into a C<Time::Piece> object. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub to_UTSTART { |
|
98
|
12
|
|
|
12
|
1
|
36
|
my $self = shift; |
|
99
|
12
|
|
|
|
|
21
|
my $FITS_headers = shift; |
|
100
|
|
|
|
|
|
|
|
|
101
|
12
|
|
|
|
|
41
|
my $utdate = $self->to_UTDATE( $FITS_headers ); |
|
102
|
12
|
|
|
|
|
47
|
my @rutstart = sort {$a<=>$b} $self->via_subheader( $FITS_headers, "RUTSTART" ); |
|
|
0
|
|
|
|
|
0
|
|
|
103
|
12
|
|
|
|
|
25
|
my $utdechour = $rutstart[0]; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# We do not have a DATE-OBS. |
|
106
|
12
|
|
|
|
|
77
|
return $self->_parse_date_info( undef, $utdate, $utdechour ); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item B<from_UTSTART> |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Converts a C<Time::Piece> object into two FITS headers for IRCAM: IDATE |
|
112
|
|
|
|
|
|
|
(in the format YYYYMMDD) and RUTSTART (decimal hours). |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub from_UTSTART { |
|
117
|
6
|
|
|
6
|
1
|
16
|
my $class = shift; |
|
118
|
6
|
|
|
|
|
12
|
my $generic_headers = shift; |
|
119
|
6
|
|
|
|
|
11
|
my %return_hash; |
|
120
|
6
|
50
|
|
|
|
23
|
if ( exists($generic_headers->{UTSTART} ) ) { |
|
121
|
6
|
|
|
|
|
14
|
my $date = $generic_headers->{UTSTART}; |
|
122
|
6
|
50
|
|
|
|
38
|
if ( ! UNIVERSAL::isa( $date, "Time::Piece" ) ) { |
|
123
|
0
|
|
|
|
|
0
|
return; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
6
|
|
|
|
|
21
|
$return_hash{IDATE} = sprintf( "%4d%02d%02d", $date->year, $date->mon, $date->mday ); |
|
126
|
6
|
|
|
|
|
82
|
$return_hash{RUTSTART} = $date->hour + ( $date->minute / 60 ) + ( $date->second / 3600 ); |
|
127
|
|
|
|
|
|
|
} |
|
128
|
6
|
|
|
|
|
181
|
return %return_hash; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item B<to_UTEND> |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Converts FITS header UT date/time values for the end of the observation into |
|
134
|
|
|
|
|
|
|
a C<Time::Piece> object. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub to_UTEND { |
|
139
|
6
|
|
|
6
|
1
|
25
|
my $self = shift; |
|
140
|
6
|
|
|
|
|
15
|
my $FITS_headers = shift; |
|
141
|
6
|
|
|
|
|
13
|
my $return; |
|
142
|
6
|
|
|
|
|
20
|
my $utdate = $self->to_UTDATE( $FITS_headers ); |
|
143
|
6
|
|
|
|
|
27
|
my @rutend = sort {$a<=>$b} $self->via_subheader( $FITS_headers, "RUTEND" ); |
|
|
0
|
|
|
|
|
0
|
|
|
144
|
6
|
|
|
|
|
16
|
my $utdechour = $rutend[-1]; |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# We do not have a DATE-END. |
|
147
|
6
|
|
|
|
|
27
|
return $self->_parse_date_info( undef, $utdate, $utdechour ); |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item B<from_UTEND> |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Converts a C<Time::Piece> object into two FITS headers for IRCAM: IDATE |
|
153
|
|
|
|
|
|
|
(in the format YYYYMMDD) and RUTEND (decimal hours). |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub from_UTEND { |
|
158
|
6
|
|
|
6
|
1
|
17
|
my $class = shift; |
|
159
|
6
|
|
|
|
|
14
|
my $generic_headers = shift; |
|
160
|
6
|
|
|
|
|
12
|
my %return_hash; |
|
161
|
6
|
50
|
|
|
|
22
|
if ( exists($generic_headers->{UTEND} ) ) { |
|
162
|
6
|
|
|
|
|
36
|
my $date = $generic_headers->{UTEND}; |
|
163
|
6
|
50
|
|
|
|
58
|
if ( ! UNIVERSAL::isa( $date, "Time::Piece" ) ) { |
|
164
|
0
|
|
|
|
|
0
|
return; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
6
|
|
|
|
|
36
|
$return_hash{IDATE} = sprintf( "%4d%02d%02d", $date->year, $date->mon, $date->mday ); |
|
167
|
6
|
|
|
|
|
127
|
$return_hash{RUTEND} = $date->hour + ( $date->minute / 60 ) + ( $date->second / 3600 ); |
|
168
|
|
|
|
|
|
|
} |
|
169
|
6
|
|
|
|
|
195
|
return %return_hash; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item B<to_INST_DHS> |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Sets the instrument data handling system header. Note that for old |
|
175
|
|
|
|
|
|
|
instruments there is no DHSVER header so this simply returns |
|
176
|
|
|
|
|
|
|
the name of the instrument and a UKDHS suffix. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub to_INST_DHS { |
|
181
|
6
|
|
|
6
|
1
|
18
|
my $self = shift; |
|
182
|
6
|
|
|
|
|
13
|
my $FITS_headers = shift; |
|
183
|
6
|
|
|
|
|
138
|
my $inst = $self->to_INSTRUMENT( $FITS_headers ); |
|
184
|
6
|
|
|
|
|
27
|
return $inst . '_UKDHS'; |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=back |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::UKIRT> |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 AUTHOR |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Brad Cavanagh E<lt>b.cavanagh@jach.hawaii.eduE<gt>, |
|
196
|
|
|
|
|
|
|
Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Copyright (C) 2007-2008 Science and Technology Facilities Council. |
|
201
|
|
|
|
|
|
|
Copyright (C) 2003-2007 Particle Physics and Astronomy Research Council. |
|
202
|
|
|
|
|
|
|
All Rights Reserved. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
|
205
|
|
|
|
|
|
|
the terms of the GNU General Public License as published by the Free Software |
|
206
|
|
|
|
|
|
|
Foundation; either Version 2 of the License, or (at your option) any later |
|
207
|
|
|
|
|
|
|
version. |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,but WITHOUT ANY |
|
210
|
|
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
211
|
|
|
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with |
|
214
|
|
|
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|
215
|
|
|
|
|
|
|
Place, Suite 330, Boston, MA 02111-1307, USA. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
1; |