Astro-FITS-HdrTrans
view release on metacpan or search on metacpan
lib/Astro/FITS/HdrTrans/ClassicCam.pm view on Meta::CPAN
my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
my $junk = $FITS_headers->{"DATE-OBS"};
my $day = substr( $junk, 0, 2 );
my $smonth = substr( $junk, 2, 3 );
my $mindex = 0;
while ( $mindex < 11 && uc( $smonth ) ne uc( $months[ $mindex ] ) ) {
$mindex++;
}
$mindex++;
my $month = "0" x ( 2 - length( $mindex ) ) . $mindex;
my $year = substr( $junk, 5, 2 );
if ( $year > 90 ) {
$year += 1900;
} else {
$year += 2000;
}
return join "", $year, $month, $day;
}
=item B<get_UT_hours>
Returns the UT time of the end of observation in decimal hours from
the C<UT> keyeword.
=cut
sub get_UT_hours {
my $self = shift;
my $FITS_headers = shift;
if ( exists $FITS_headers->{UT} && $FITS_headers->{UT} =~ /:/ ) {
my ($hour, $minute, $second) = split( /:/, $FITS_headers->{UT} );
return $hour + ($minute / 60) + ($second / 3600);
} else {
return $FITS_headers->{UT};
}
}
=item B<hms_to_degrees>
Converts a sky angle specified in h:m:s format into decimal degrees.
It takes no account of latitude. The argument is the sexagesimal
format angle.
=cut
sub hms_to_degrees {
my $self = shift;
my $sexa = shift;
my $hms;
if ( defined( $sexa ) ) {
my @pos = split( /:/, $sexa );
$hms = 15.0 * ( $pos[ 0 ] + $pos[ 1 ] / 60.0 + $pos [ 2 ] / 3600. );
}
return $hms;
}
=item B<quad_bounds>
Returns the detector bounds in pixels of the region of the detector
used. The region will be one of the four quadrants or the full
detector. We guess for the moment that keword C<QUAD> values of
1, 2, 3, 4 correspond to lower-left, lower-right, upper-left,
upper-right quadrants respectively, and 5 is the whole
256x256-pixel array.
=cut
sub quad_bounds {
my $self = shift;
my $FITS_headers = shift;
my @bounds = ( 1, 1, 256, 256 );
my $quad = $FITS_headers->{"QUAD"};
if ( defined( $quad ) ) {
if ( $quad < 5 ) {
$bounds[ 0 ] += 128 * ( $quad + 1 ) % 2;
$bounds[ 2 ] -= 128 * $quad % 2;
if ( $quad > 2 ) {
$bounds[ 1 ] += 128;
} else {
$bounds[ 3 ]-= 128;
}
}
}
return @bounds;
}
=back
=head1 SEE ALSO
C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::UKIRT>.
=head1 AUTHOR
Malcolm J. Currie E<lt>mjc@jach.hawaii.eduE<gt>
Tim Jenness E<lt>t.jenness@jach.hawaii.eduE<gt>.
=head1 COPYRIGHT
Copyright (C) 2008 Science and Technology Facilities Council.
Copyright (C) 1998-2007 Particle Physics and Astronomy Research Council.
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either Version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful,but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307, USA.
=cut
1;
( run in 0.502 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )