line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Astro::FITS::HdrTrans::UKIRT - Base class for translation of UKIRT instruments |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 SYNOPSIS |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Astro::FITS::HdrTrans::UKIRT; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
This class provides a generic set of translations that are common to |
13
|
|
|
|
|
|
|
instrumentation from the United Kingdom Infrared Telescope. It should |
14
|
|
|
|
|
|
|
not be used directly for translation of instrument FITS headers. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use 5.006; |
19
|
20
|
|
|
20
|
|
19204090
|
use warnings; |
|
20
|
|
|
|
|
163
|
|
20
|
20
|
|
|
20
|
|
100
|
use strict; |
|
20
|
|
|
|
|
33
|
|
|
20
|
|
|
|
|
439
|
|
21
|
20
|
|
|
20
|
|
91
|
use Carp; |
|
20
|
|
|
|
|
35
|
|
|
20
|
|
|
|
|
385
|
|
22
|
20
|
|
|
20
|
|
196
|
|
|
20
|
|
|
|
|
38
|
|
|
20
|
|
|
|
|
1218
|
|
23
|
|
|
|
|
|
|
# inherit from the JAC translation class. |
24
|
|
|
|
|
|
|
use base qw/ Astro::FITS::HdrTrans::JAC /; |
25
|
20
|
|
|
20
|
|
99
|
|
|
20
|
|
|
|
|
35
|
|
|
20
|
|
|
|
|
6037
|
|
26
|
|
|
|
|
|
|
use vars qw/ $VERSION /; |
27
|
20
|
|
|
20
|
|
105
|
|
|
20
|
|
|
|
|
37
|
|
|
20
|
|
|
|
|
10022
|
|
28
|
|
|
|
|
|
|
$VERSION = "1.65"; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# In each class we have three sets of data. |
31
|
|
|
|
|
|
|
# - constant mappings |
32
|
|
|
|
|
|
|
# - unit mappings |
33
|
|
|
|
|
|
|
# - complex mappings |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# For a constant mapping, there is no FITS header, just a generic |
36
|
|
|
|
|
|
|
# header that is constant. |
37
|
|
|
|
|
|
|
my %CONST_MAP = ( |
38
|
|
|
|
|
|
|
COORDINATE_UNITS => 'degrees', |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Unit mapping implies that the value propogates directly |
42
|
|
|
|
|
|
|
# to the output with only a keyword name change. |
43
|
|
|
|
|
|
|
my %UNIT_MAP = ( |
44
|
|
|
|
|
|
|
AIRMASS_END => "AMEND", |
45
|
|
|
|
|
|
|
AIRMASS_START => "AMSTART", |
46
|
|
|
|
|
|
|
DEC_BASE => "DECBASE", |
47
|
|
|
|
|
|
|
DETECTOR_INDEX => "DINDEX", # Needs subheader |
48
|
|
|
|
|
|
|
DR_GROUP => "GRPNUM", |
49
|
|
|
|
|
|
|
EQUINOX => "EQUINOX", |
50
|
|
|
|
|
|
|
FILTER => "FILTER", |
51
|
|
|
|
|
|
|
INSTRUMENT => "INSTRUME", |
52
|
|
|
|
|
|
|
NUMBER_OF_EXPOSURES => "NEXP", |
53
|
|
|
|
|
|
|
NUMBER_OF_OFFSETS => "NOFFSETS", |
54
|
|
|
|
|
|
|
OBJECT => "OBJECT", |
55
|
|
|
|
|
|
|
OBSERVATION_NUMBER => "OBSNUM", |
56
|
|
|
|
|
|
|
OBSERVATION_TYPE => "OBSTYPE", |
57
|
|
|
|
|
|
|
PROJECT => "PROJECT", |
58
|
|
|
|
|
|
|
STANDARD => "STANDARD", |
59
|
|
|
|
|
|
|
WAVEPLATE_ANGLE => "WPLANGLE", |
60
|
|
|
|
|
|
|
X_APERTURE => "APER_X", |
61
|
|
|
|
|
|
|
X_DIM => "DCOLUMNS", |
62
|
|
|
|
|
|
|
X_LOWER_BOUND => "RDOUT_X1", |
63
|
|
|
|
|
|
|
X_UPPER_BOUND => "RDOUT_X2", |
64
|
|
|
|
|
|
|
Y_APERTURE => "APER_Y", |
65
|
|
|
|
|
|
|
Y_DIM => "DROWS", |
66
|
|
|
|
|
|
|
Y_LOWER_BOUND => "RDOUT_Y1", |
67
|
|
|
|
|
|
|
Y_UPPER_BOUND => "RDOUT_Y2" |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Create the translation methods. |
71
|
|
|
|
|
|
|
__PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 4 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item B<can_translate> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This implementation of C<can_translate> is used to filter out a |
80
|
|
|
|
|
|
|
database row from an actual file header. The base-class |
81
|
|
|
|
|
|
|
implementation is used if the filter passes. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $self = shift; |
86
|
|
|
|
|
|
|
my $FITS_headers = shift; |
87
|
131
|
|
|
131
|
1
|
245
|
|
88
|
131
|
|
|
|
|
205
|
if ( exists $FITS_headers->{TELESCOP} && |
89
|
|
|
|
|
|
|
$FITS_headers->{TELESCOP} =~ /UKIRT/ && |
90
|
131
|
50
|
100
|
|
|
637
|
exists $FITS_headers->{FILENAME} && |
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
91
|
|
|
|
|
|
|
exists $FITS_headers->{RAJ2000}) { |
92
|
|
|
|
|
|
|
return 0; |
93
|
|
|
|
|
|
|
} |
94
|
6
|
|
|
|
|
21
|
return $self->SUPER::can_translate( $FITS_headers ); |
95
|
|
|
|
|
|
|
} |
96
|
125
|
|
|
|
|
10693
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COMPLEX CONVERSIONS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
These methods are more complicated than a simple mapping. We have to |
102
|
|
|
|
|
|
|
provide both from- and to-FITS conversions. All these routines are |
103
|
|
|
|
|
|
|
methods and the to_ routines all take a reference to a hash and return |
104
|
|
|
|
|
|
|
the translated value (a many-to-one mapping). The from_ methods take a |
105
|
|
|
|
|
|
|
reference to a generic hash and return a translated hash (sometimes |
106
|
|
|
|
|
|
|
these are many-to-many). |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over 4 |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item B<to_COORDINATE_TYPE> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Converts the C<EQUINOX> FITS header into B1950 or J2000, depending |
113
|
|
|
|
|
|
|
on equinox value, and sets the C<COORDINATE_TYPE> generic header. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
$class->to_COORDINATE_TYPE( \%hdr ); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my $self = shift; |
120
|
|
|
|
|
|
|
my $FITS_headers = shift; |
121
|
|
|
|
|
|
|
my $return; |
122
|
12
|
|
|
12
|
1
|
25
|
if ( exists( $FITS_headers->{EQUINOX} ) ) { |
123
|
12
|
|
|
|
|
25
|
if ( $FITS_headers->{EQUINOX} =~ /1950/ ) { |
124
|
12
|
|
|
|
|
20
|
$return = "B1950"; |
125
|
12
|
100
|
|
|
|
43
|
} elsif ( $FITS_headers->{EQUINOX} =~ /2000/ ) { |
126
|
10
|
50
|
|
|
|
235
|
$return = "J2000"; |
|
|
50
|
|
|
|
|
|
127
|
0
|
|
|
|
|
0
|
} |
128
|
|
|
|
|
|
|
} |
129
|
10
|
|
|
|
|
1124
|
return $return; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
12
|
|
|
|
|
45
|
=item B<from_COORDINATE_TYPE> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
A null translation since EQUINOX is translated separately. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
return (); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
12
|
|
|
12
|
1
|
53
|
=item B<to_RA_BASE> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Converts the decimal hours in the FITS header C<RABASE> into |
145
|
|
|
|
|
|
|
decimal degrees for the generic header C<RA_BASE>. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Note that this is different from the original translation within |
148
|
|
|
|
|
|
|
ORAC-DR where it was to decimal hours. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $self = shift; |
153
|
|
|
|
|
|
|
my $FITS_headers = shift; |
154
|
|
|
|
|
|
|
my $return; |
155
|
|
|
|
|
|
|
if ( exists($FITS_headers->{RABASE} ) ) { |
156
|
|
|
|
|
|
|
$return = $FITS_headers->{RABASE} * 15; |
157
|
10
|
|
|
10
|
1
|
27
|
} |
158
|
10
|
|
|
|
|
21
|
return $return; |
159
|
10
|
|
|
|
|
15
|
} |
160
|
10
|
100
|
|
|
|
37
|
|
161
|
8
|
|
|
|
|
185
|
=item B<from_RA_BASE> |
162
|
|
|
|
|
|
|
|
163
|
10
|
|
|
|
|
503
|
Converts the decimal degrees in the generic header C<RA_BASE> |
164
|
|
|
|
|
|
|
into decimal hours for the FITS header C<RABASE>. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
%fits = $class->from_RA_BASE( \%generic ); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my $self = shift; |
171
|
|
|
|
|
|
|
my $generic_headers = shift; |
172
|
|
|
|
|
|
|
my %return_hash; |
173
|
|
|
|
|
|
|
if ( exists( $generic_headers->{RA_BASE} ) && |
174
|
|
|
|
|
|
|
defined( $generic_headers->{RA_BASE} ) ) { |
175
|
|
|
|
|
|
|
$return_hash{'RABASE'} = $generic_headers->{RA_BASE} / 15; |
176
|
11
|
|
|
11
|
1
|
21
|
} |
177
|
11
|
|
|
|
|
24
|
return %return_hash; |
178
|
11
|
|
|
|
|
22
|
} |
179
|
11
|
100
|
66
|
|
|
68
|
|
180
|
|
|
|
|
|
|
=item B<to_TELESCOPE> |
181
|
9
|
|
|
|
|
33
|
|
182
|
|
|
|
|
|
|
Sets the generic header C<TELESCOPE> to 'UKIRT', so that it is |
183
|
11
|
|
|
|
|
112
|
SLALIB-compliant. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
return "UKIRT"; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item B<from_TELESCOPE> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Sets the specific header C<TELESCOP> to 'UKIRT'. Note that this will |
193
|
|
|
|
|
|
|
probably be sub-classed. |
194
|
12
|
|
|
12
|
1
|
36
|
|
195
|
|
|
|
|
|
|
=cut |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
my %return_hash = ( TELESCOP => 'UKIRT' ); |
198
|
|
|
|
|
|
|
return %return_hash; |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 HELPER ROUTINES |
205
|
5
|
|
|
5
|
1
|
20
|
|
206
|
5
|
|
|
|
|
64
|
These are UKIRT-specific helper routines. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=over 4 |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item B<_parse_date_info> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Given either a ISO format date string or a UT date (YYYYMMDD) and |
213
|
|
|
|
|
|
|
decimal hours UT, calculate the time and return it as an object. |
214
|
|
|
|
|
|
|
Preference is given to the ISO version. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
$time = $trans->_parse_date_info($iso, $yyyymmdd, $uthr ); |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my $self = shift; |
221
|
|
|
|
|
|
|
my ($iso, $yyyymmdd, $utdechour) = @_; |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
# If we do not have an ISO string, form one. |
224
|
|
|
|
|
|
|
if ( !defined $iso ) { |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# Convert the decimal hours to hms. |
227
|
|
|
|
|
|
|
my $uthour = int( $utdechour ); |
228
|
|
|
|
|
|
|
my $utminute = int( ( $utdechour - $uthour ) * 60 ); |
229
|
33
|
|
|
33
|
|
304
|
my $utsecond = int( ( ( ( $utdechour - $uthour ) * 60 ) - $utminute ) * 60 ); |
230
|
33
|
|
|
|
|
70
|
if ( !defined( $yyyymmdd ) ) { |
231
|
|
|
|
|
|
|
$yyyymmdd = 19700101; |
232
|
|
|
|
|
|
|
} |
233
|
33
|
100
|
|
|
|
89
|
$iso = sprintf( "%04d-%02d-%02dT%02d:%02d:%02s", |
234
|
|
|
|
|
|
|
substr( $yyyymmdd, 0, 4 ), |
235
|
|
|
|
|
|
|
substr( $yyyymmdd, 4, 2 ), |
236
|
18
|
|
|
|
|
47
|
substr( $yyyymmdd, 6, 2 ), |
237
|
18
|
|
|
|
|
42
|
$uthour, $utminute, $utsecond); |
238
|
18
|
|
|
|
|
35
|
} |
239
|
18
|
50
|
|
|
|
35
|
return $self->_parse_iso_date( $iso ); |
240
|
0
|
|
|
|
|
0
|
} |
241
|
|
|
|
|
|
|
|
242
|
18
|
|
|
|
|
116
|
=back |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head1 SEE ALSO |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::Base> |
247
|
|
|
|
|
|
|
|
248
|
33
|
|
|
|
|
161
|
=head1 AUTHOR |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
Brad Cavanagh E<lt>b.cavanagh@jach.hawaii.eduE<gt>, |
251
|
|
|
|
|
|
|
Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>. |
252
|
|
|
|
|
|
|
Malcolm J. Currie E<lt>mjc@star.rl.ac.ukE<gt> |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 COPYRIGHT |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Copyright (C) 2007-2008 Science and Technology Facilities Council. |
257
|
|
|
|
|
|
|
Copyright (C) 2003-2007 Particle Physics and Astronomy Research Council. |
258
|
|
|
|
|
|
|
All Rights Reserved. |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
261
|
|
|
|
|
|
|
the terms of the GNU General Public License as published by the Free Software |
262
|
|
|
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later |
263
|
|
|
|
|
|
|
version. |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,but WITHOUT ANY |
266
|
|
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
267
|
|
|
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details. |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with |
270
|
|
|
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
271
|
|
|
|
|
|
|
Place,Suite 330, Boston, MA 02111-1307, USA |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=cut |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
1; |