Astro::FITS::HdrTrans::UKIRTNew - Base class for translation of new UKIRT instruments


Astro-FITS-HdrTrans documentation Contained in the Astro-FITS-HdrTrans distribution.

Index


Code Index:

NAME

Top

Astro::FITS::HdrTrans::UKIRTNew - Base class for translation of new UKIRT instruments

SYNOPSIS

Top

  use Astro::FITS::HdrTrans::UKIRTNew;

DESCRIPTION

Top

This class provides a generic set of translations that are common to the newer generation of instruments from the United Kingdom Infrared Telescope. This includes MICHELLE, UIST, UFTI and WFCAM. It should not be used directly for translation of instrument FITS headers.

COMPLEX CONVERSIONS

Top

These methods are more complicated than a simple mapping. We have to provide both from- and to-FITS conversions. All these routines are methods and the to_ routines all take a reference to a hash and return the translated value (a many-to-one mapping). The from_ methods take a reference to a generic hash and return a translated hash (sometimes these are many-to-many).

to_INST_DHS

Sets the instrument data-handling-system header.

to_UTSTART

Converts UT date in DATE-OBS header into Time::Piece object.

from_UTSTART

Returns the starting observation time in ISO8601 format: YYYY-MM-DDThh:mm:ss.

to_UTEND

Converts UT date in DATE-END header into Time::Piece object.

from_UTEND

Returns the starting observation time in ISO8601 format: YYYY-MM-DDThh:mm:ss.

REVISION

Top

 $Id$

SEE ALSO

Top

Astro::FITS::HdrTrans, Astro::FITS::HdrTrans::UKIRT

AUTHOR

Top

Brad Cavanagh <b.cavanagh@jach.hawaii.edu>, Tim Jenness <t.jenness@jach.hawaii.edu>. Malcolm J. Currie <mjc@star.rl.ac.uk>

COPYRIGHT

Top


Astro-FITS-HdrTrans documentation Contained in the Astro-FITS-HdrTrans distribution.
package Astro::FITS::HdrTrans::UKIRTNew;

use 5.006;
use warnings;
use strict;
use Carp;

# Inherit from UKIRT
use base qw/ Astro::FITS::HdrTrans::UKIRT /;

use vars qw/ $VERSION /;

$VERSION = "1.50";

# For a constant mapping, there is no FITS header, just a generic
# header that is constant.
my %CONST_MAP = (

                );

# Unit mapping implies that the value propogates directly
# to the output with only a keyword name change.
my %UNIT_MAP = (
                DEC_TELESCOPE_OFFSET => "TDECOFF",
                DR_RECIPE            => "RECIPE",
                EXPOSURE_TIME        => "EXP_TIME",
                GAIN                 => "GAIN",
                RA_TELESCOPE_OFFSET  => "TRAOFF",
                UTDATE               => "UTDATE",
               );

# Create the translation methods.
__PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP );

sub to_INST_DHS {
  my $self = shift;
  my $FITS_headers = shift;
  my $return;

  if ( exists( $FITS_headers->{DHSVER} ) ) {
    $FITS_headers->{DHSVER} =~ /^(\w+)/;
    my $dhs = uc( $1 );
    $return = $FITS_headers->{INSTRUME} . "_$dhs";
  }

  return $return;
}

sub to_UTSTART {
  my $self = shift;
  my $FITS_headers = shift;
  my $dateobs = (exists $FITS_headers->{"DATE-OBS"} ?
                 $FITS_headers->{"DATE-OBS"} : undef );
  my @rutstart = sort {$a<=>$b} $self->via_subheader( $FITS_headers, "UTSTART" );
  my $utstart = $rutstart[0];
  return $self->_parse_date_info( $dateobs,
                                  $self->to_UTDATE( $FITS_headers ),
                                  $utstart );
}

sub from_UTSTART {
  my $self = shift;
  my $generic_headers = shift;

  # Use the FITS standard parser.
  my %return_hash = Astro::FITS::HdrTrans::FITS->from_UTSTART( $generic_headers );

  if ( exists $return_hash{'DATE-OBS'} ) {

    # Prior to April 2005 the UKIRT FITS headers had a trailing Z.
    # This is part of the ISO8601 standard but not part of the FITS
    # standard (which always assumes UTC), although it was in the
    # draft FITS agreement.
    $return_hash{'DATE-OBS'} .= "Z"
      if $generic_headers->{UTSTART}->epoch < 1112662116;
  }
  return %return_hash;
}

sub to_UTEND {
  my $self = shift;
  my $FITS_headers = shift;
  my $dateend = (exists $FITS_headers->{"DATE-END"} ?
                 $FITS_headers->{"DATE-END"} : undef );

  my @rutend = sort {$a<=>$b} $self->via_subheader( $FITS_headers, "UTEND" );
  my $utend = $rutend[-1];
  return $self->_parse_date_info( $dateend,
                                  $self->to_UTDATE( $FITS_headers ),
                                  $utend );
}

sub from_UTEND {
  my $self = shift;
  my $generic_headers = shift;

  # Use the FITS standard parser.
  my %return_hash = Astro::FITS::HdrTrans::FITS->from_UTEND( $generic_headers);

  if ( exists $return_hash{'DATE-END'} ) {

    # Prior to April 2005 the UKIRT FITS headers had a trailing Z.
    # This is part of the ISO8601 standard but not part of the FITS
    # standard (which always assumes UTC), although it was in the
    # draft FITS agreement.
    $return_hash{'DATE-END'} .= "Z"
      if $generic_headers->{UTEND}->epoch < 1112662116;
  }
  return %return_hash;
}

1;