Astro-FITS-HdrTrans
view release on metacpan or search on metacpan
lib/Astro/FITS/HdrTrans/UKIRT.pm view on Meta::CPAN
# For a constant mapping, there is no FITS header, just a generic
# header that is constant.
my %CONST_MAP = (
COORDINATE_UNITS => 'degrees',
);
# Unit mapping implies that the value propogates directly
# to the output with only a keyword name change.
my %UNIT_MAP = (
AIRMASS_END => "AMEND",
AIRMASS_START => "AMSTART",
DEC_BASE => "DECBASE",
DETECTOR_INDEX => "DINDEX", # Needs subheader
DR_GROUP => "GRPNUM",
EQUINOX => "EQUINOX",
FILTER => "FILTER",
INSTRUMENT => "INSTRUME",
NUMBER_OF_EXPOSURES => "NEXP",
NUMBER_OF_OFFSETS => "NOFFSETS",
OBJECT => "OBJECT",
OBSERVATION_NUMBER => "OBSNUM",
OBSERVATION_TYPE => "OBSTYPE",
PROJECT => "PROJECT",
STANDARD => "STANDARD",
WAVEPLATE_ANGLE => "WPLANGLE",
X_APERTURE => "APER_X",
X_DIM => "DCOLUMNS",
X_LOWER_BOUND => "RDOUT_X1",
X_UPPER_BOUND => "RDOUT_X2",
Y_APERTURE => "APER_Y",
Y_DIM => "DROWS",
Y_LOWER_BOUND => "RDOUT_Y1",
Y_UPPER_BOUND => "RDOUT_Y2"
);
# Create the translation methods.
__PACKAGE__->_generate_lookup_methods( \%CONST_MAP, \%UNIT_MAP );
=head1 METHODS
=over 4
=item B<can_translate>
This implementation of C<can_translate> is used to filter out a
database row from an actual file header. The base-class
implementation is used if the filter passes.
=cut
sub can_translate {
my $self = shift;
my $FITS_headers = shift;
if ( exists $FITS_headers->{TELESCOP} &&
$FITS_headers->{TELESCOP} =~ /UKIRT/ &&
exists $FITS_headers->{FILENAME} &&
exists $FITS_headers->{RAJ2000}) {
return 0;
}
return $self->SUPER::can_translate( $FITS_headers );
}
=back
=head1 COMPLEX CONVERSIONS
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).
=over 4
=item B<to_COORDINATE_TYPE>
Converts the C<EQUINOX> FITS header into B1950 or J2000, depending
on equinox value, and sets the C<COORDINATE_TYPE> generic header.
$class->to_COORDINATE_TYPE( \%hdr );
=cut
sub to_COORDINATE_TYPE {
my $self = shift;
my $FITS_headers = shift;
my $return;
if ( exists( $FITS_headers->{EQUINOX} ) ) {
if ( $FITS_headers->{EQUINOX} =~ /1950/ ) {
$return = "B1950";
} elsif ( $FITS_headers->{EQUINOX} =~ /2000/ ) {
$return = "J2000";
}
}
return $return;
}
=item B<from_COORDINATE_TYPE>
A null translation since EQUINOX is translated separately.
=cut
sub from_COORDINATE_TYPE {
return ();
}
=item B<to_RA_BASE>
Converts the decimal hours in the FITS header C<RABASE> into
decimal degrees for the generic header C<RA_BASE>.
Note that this is different from the original translation within
ORAC-DR where it was to decimal hours.
=cut
sub to_RA_BASE {
( run in 1.752 second using v1.01-cache-2.11-cpan-b9db842bd85 )