| 1 | package Astro::FITS::HdrTrans::UKIRTNew; | ||||||||||
| 2 | |||||||||||
| 3 | =head1 NAME | ||||||||||
| 4 | |||||||||||
| 5 | Astro::FITS::HdrTrans::UKIRTNew - Base class for translation of new UKIRT instruments | ||||||||||
| 6 | |||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||
| 8 | |||||||||||
| 9 | use Astro::FITS::HdrTrans::UKIRTNew; | ||||||||||
| 10 | |||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||
| 12 | |||||||||||
| 13 | This class provides a generic set of translations that are common to | ||||||||||
| 14 | the newer generation of instruments from the United Kingdom Infrared | ||||||||||
| 15 | Telescope. This includes MICHELLE, UIST, UFTI and WFCAM. It should | ||||||||||
| 16 | not be used directly for translation of instrument FITS headers. | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | 16 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 16 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 16 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 16 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | # Inherit from UKIRT | ||||||||||
| 26 | 16 | ▶ | use base qw/ Astro::FITS::HdrTrans::UKIRT /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 16 | ▶ | use vars qw/ $VERSION /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | 16 | $VERSION = "1.65"; | |||||||||
| 31 | |||||||||||
| 32 | # For a constant mapping, there is no FITS header, just a generic | ||||||||||
| 33 | # header that is constant. | ||||||||||
| 34 | 16 | my %CONST_MAP = ( | |||||||||
| 35 | |||||||||||
| 36 | ); | ||||||||||
| 37 | |||||||||||
| 38 | # Unit mapping implies that the value propogates directly | ||||||||||
| 39 | # to the output with only a keyword name change. | ||||||||||
| 40 | 16 | my %UNIT_MAP = ( | |||||||||
| 41 | DEC_TELESCOPE_OFFSET => "TDECOFF", | ||||||||||
| 42 | DR_RECIPE => "RECIPE", | ||||||||||
| 43 | EXPOSURE_TIME => "EXP_TIME", | ||||||||||
| 44 | GAIN => "GAIN", | ||||||||||
| 45 | RA_TELESCOPE_OFFSET => "TRAOFF", | ||||||||||
| 46 | UTDATE => "UTDATE", | ||||||||||
| 47 | ); | ||||||||||
| 48 | |||||||||||
| 49 | # Create the translation methods. | ||||||||||
| 50 | 16 | __PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP ); | |||||||||
| 51 | |||||||||||
| 52 | =head1 COMPLEX CONVERSIONS | ||||||||||
| 53 | |||||||||||
| 54 | These methods are more complicated than a simple mapping. We have to | ||||||||||
| 55 | provide both from- and to-FITS conversions. All these routines are | ||||||||||
| 56 | methods and the to_ routines all take a reference to a hash and return | ||||||||||
| 57 | the translated value (a many-to-one mapping). The from_ methods take | ||||||||||
| 58 | a reference to a generic hash and return a translated hash (sometimes | ||||||||||
| 59 | these are many-to-many). | ||||||||||
| 60 | |||||||||||
| 61 | =over 4 | ||||||||||
| 62 | |||||||||||
| 63 | =item B<to_INST_DHS> | ||||||||||
| 64 | |||||||||||
| 65 | Sets the instrument data-handling-system header. | ||||||||||
| 66 | |||||||||||
| 67 | =cut | ||||||||||
| 68 | |||||||||||
| 69 | sub to_INST_DHS { | ||||||||||
| 70 | 6 | ▶ | my $self = shift; | ||||||||
|
Subroutine
to_INST_DHS: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 71 | 6 | my $FITS_headers = shift; | |||||||||
| 72 | 6 | my $return; | |||||||||
| 73 | |||||||||||
| 74 | 6 | ▶ | if ( exists( $FITS_headers->{DHSVER} ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | 6 | $FITS_headers->{DHSVER} =~ /^(\w+)/; | |||||||||
| 76 | 6 | my $dhs = uc( $1 ); | |||||||||
| 77 | 6 | $return = $FITS_headers->{INSTRUME} . "_$dhs"; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 6 | return $return; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | =item B<to_UTSTART> | ||||||||||
| 84 | |||||||||||
| 85 | Converts UT date in C<DATE-OBS> header into C<Time::Piece> object. | ||||||||||
| 86 | |||||||||||
| 87 | =cut | ||||||||||
| 88 | |||||||||||
| 89 | sub to_UTSTART { | ||||||||||
| 90 | 8 | ▶ | my $self = shift; | ||||||||
|
Subroutine
to_UTSTART: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 91 | 8 | my $FITS_headers = shift; | |||||||||
| 92 | my $dateobs = (exists $FITS_headers->{"DATE-OBS"} ? | ||||||||||
| 93 | 8 | ▶ | $FITS_headers->{"DATE-OBS"} : undef ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 94 | 8 | my @rutstart = sort {$a<=>$b} $self->via_subheader( $FITS_headers, "UTSTART" ); | |||||||||
| 95 | 8 | my $utstart = $rutstart[0]; | |||||||||
| 96 | 8 | return $self->_parse_date_info( $dateobs, | |||||||||
| 97 | $self->to_UTDATE( $FITS_headers ), | ||||||||||
| 98 | $utstart ); | ||||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||
| 101 | =item B<from_UTSTART> | ||||||||||
| 102 | |||||||||||
| 103 | Returns the starting observation time in ISO8601 format: | ||||||||||
| 104 | YYYY-MM-DDThh:mm:ss. | ||||||||||
| 105 | |||||||||||
| 106 | =cut | ||||||||||
| 107 | |||||||||||
| 108 | sub from_UTSTART { | ||||||||||
| 109 | 5 | ▶ | my $self = shift; | ||||||||
|
Subroutine
from_UTSTART: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||
| 110 | 5 | my $generic_headers = shift; | |||||||||
| 111 | |||||||||||
| 112 | # Use the FITS standard parser. | ||||||||||
| 113 | 5 | my %return_hash = Astro::FITS::HdrTrans::FITS->from_UTSTART( $generic_headers ); | |||||||||
| 114 | |||||||||||
| 115 | 5 | ▶ | if ( exists $return_hash{'DATE-OBS'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 116 | |||||||||||
| 117 | # Prior to April 2005 the UKIRT FITS headers had a trailing Z. | ||||||||||
| 118 | # This is part of the ISO8601 standard but not part of the FITS | ||||||||||
| 119 | # standard (which always assumes UTC), although it was in the | ||||||||||
| 120 | # draft FITS agreement. | ||||||||||
| 121 | $return_hash{'DATE-OBS'} .= "Z" | ||||||||||
| 122 | 5 | ▶ | if $generic_headers->{UTSTART}->epoch < 1112662116; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | } | ||||||||||
| 124 | 5 | return %return_hash; | |||||||||
| 125 | } | ||||||||||
| 126 | |||||||||||
| 127 | =item B<to_UTEND> | ||||||||||
| 128 | |||||||||||
| 129 | Converts UT date in C<DATE-END> header into C<Time::Piece> object. | ||||||||||
| 130 | |||||||||||
| 131 | =cut | ||||||||||
| 132 | |||||||||||
| 133 | sub to_UTEND { | ||||||||||
| 134 | 4 | ▶ | my $self = shift; | ||||||||
|
Subroutine
to_UTEND: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 135 | 4 | my $FITS_headers = shift; | |||||||||
| 136 | my $dateend = (exists $FITS_headers->{"DATE-END"} ? | ||||||||||
| 137 | 4 | ▶ | $FITS_headers->{"DATE-END"} : undef ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 138 | |||||||||||
| 139 | 4 | my @rutend = sort {$a<=>$b} $self->via_subheader( $FITS_headers, "UTEND" ); | |||||||||
| 140 | 4 | my $utend = $rutend[-1]; | |||||||||
| 141 | 4 | return $self->_parse_date_info( $dateend, | |||||||||
| 142 | $self->to_UTDATE( $FITS_headers ), | ||||||||||
| 143 | $utend ); | ||||||||||
| 144 | } | ||||||||||
| 145 | |||||||||||
| 146 | =item B<from_UTEND> | ||||||||||
| 147 | |||||||||||
| 148 | Returns the starting observation time in ISO8601 format: | ||||||||||
| 149 | YYYY-MM-DDThh:mm:ss. | ||||||||||
| 150 | |||||||||||
| 151 | =cut | ||||||||||
| 152 | |||||||||||
| 153 | sub from_UTEND { | ||||||||||
| 154 | 5 | ▶ | my $self = shift; | ||||||||
|
Subroutine
from_UTEND: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||
| 155 | 5 | my $generic_headers = shift; | |||||||||
| 156 | |||||||||||
| 157 | # Use the FITS standard parser. | ||||||||||
| 158 | 5 | my %return_hash = Astro::FITS::HdrTrans::FITS->from_UTEND( $generic_headers); | |||||||||
| 159 | |||||||||||
| 160 | 5 | ▶ | if ( exists $return_hash{'DATE-END'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 161 | |||||||||||
| 162 | # Prior to April 2005 the UKIRT FITS headers had a trailing Z. | ||||||||||
| 163 | # This is part of the ISO8601 standard but not part of the FITS | ||||||||||
| 164 | # standard (which always assumes UTC), although it was in the | ||||||||||
| 165 | # draft FITS agreement. | ||||||||||
| 166 | $return_hash{'DATE-END'} .= "Z" | ||||||||||
| 167 | 5 | ▶ | if $generic_headers->{UTEND}->epoch < 1112662116; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 168 | } | ||||||||||
| 169 | 5 | return %return_hash; | |||||||||
| 170 | } | ||||||||||
| 171 | |||||||||||
| 172 | =back | ||||||||||
| 173 | |||||||||||
| 174 | =head1 SEE ALSO | ||||||||||
| 175 | |||||||||||
| 176 | C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::UKIRT> | ||||||||||
| 177 | |||||||||||
| 178 | =head1 AUTHOR | ||||||||||
| 179 | |||||||||||
| 180 | Brad Cavanagh E<lt>b.cavanagh@jach.hawaii.eduE<gt>, | ||||||||||
| 181 | Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>. | ||||||||||
| 182 | Malcolm J. Currie E<lt>mjc@star.rl.ac.ukE<gt> | ||||||||||
| 183 | |||||||||||
| 184 | =head1 COPYRIGHT | ||||||||||
| 185 | |||||||||||
| 186 | Copyright (C) 2007-2008 Science and Technology Facilities Council. | ||||||||||
| 187 | Copyright (C) 2003-2007 Particle Physics and Astronomy Research Council. | ||||||||||
| 188 | All Rights Reserved. | ||||||||||
| 189 | |||||||||||
| 190 | This program is free software; you can redistribute it and/or modify it under | ||||||||||
| 191 | the terms of the GNU General Public License as published by the Free Software | ||||||||||
| 192 | Foundation; either Version 2 of the License, or (at your option) any later | ||||||||||
| 193 | version. | ||||||||||
| 194 | |||||||||||
| 195 | This program is distributed in the hope that it will be useful,but WITHOUT ANY | ||||||||||
| 196 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||||||||||
| 197 | PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||||||||||
| 198 | |||||||||||
| 199 | You should have received a copy of the GNU General Public License along with | ||||||||||
| 200 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||||||||||
| 201 | Place, Suite 330, Boston, MA 02111-1307, USA. | ||||||||||
| 202 | |||||||||||
| 203 | =cut | ||||||||||
| 204 | |||||||||||
| 205 | 16 | 1; | |||||||||