Astro-FITS-HdrTrans

 view release on metacpan or  search on metacpan

lib/Astro/FITS/HdrTrans/LCO.pm  view on Meta::CPAN


=item B<to_XBINNING>

Determines the binning in the X direction of the frame. We look for C<XBINNING>
if it exists, otherwise we look for the C<CCDSUM> keyword and extract the first
part.

=cut

sub to_XBINNING {
  my $self = shift;
  my $FITS_headers = shift;
  my $xbinning = 2;
  if ( exists ( $FITS_headers->{XBINNING} ) ) {
    $xbinning = $FITS_headers->{XBINNING};
  } elsif ( exists ( $FITS_headers->{CCDSUM} ) ) {
    my $ccdsum = $FITS_headers->{CCDSUM};
    my @pos = split( / /, $ccdsum );
    $xbinning = $pos[ 0 ];
  }
  return $xbinning;
}

=item B<to_YBINNING>

Determines the binning in the Y direction of the frame. We look for C<YBINNING>
if it exists, otherwise we look for the C<CCDSUM> keyword and extract the second
part.

=cut

sub to_YBINNING {
  my $self = shift;
  my $FITS_headers = shift;
  my $ybinning = 2;
  if ( exists ( $FITS_headers->{YBINNING} ) ) {
    $ybinning = $FITS_headers->{YBINNING};
  } elsif ( exists ( $FITS_headers->{CCDSUM} ) ) {
    my $ccdsum = $FITS_headers->{CCDSUM};
    my @pos = split( / /, $ccdsum );
    $ybinning = $pos[ 1 ];
  }
  return $ybinning;
}

# Supplementary methods for the translations
# ------------------------------------------

=item B<dms_to_degrees>

Converts a sky angle specified in d m s format into decimal degrees.
The argument is the sexagesimal-format angle.

=cut

sub dms_to_degrees {
  my $self = shift;
  my $sexa = shift;
  my $dms;
  if ( defined( $sexa ) ) {
    if ($sexa =~ /UNKNOWN/i or $sexa eq "N/A" or $sexa eq "NaN" ) {
      $dms = 0.0;
    } else {
      my @pos = split( /:/, $sexa );
      $dms = abs($pos[ 0 ]) + $pos[ 1 ] / 60.0 + $pos [ 2 ] / 3600.0;
      if ( $pos[ 0 ] =~ /-/ ) {
        $dms = -$dms;
      }
    }
  }
  return $dms;
}

=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 ) ) {
    if ($sexa =~ /UNKNOWN/i or $sexa eq "N/A" or $sexa eq "NaN" ) {
      $hms = 0.0;
    } else {
      my @pos = split( /:/, $sexa );
      $hms = 15.0 * ( $pos[ 0 ] + $pos[ 1 ] / 60.0 + $pos [ 2 ] / 3600.0 );
    }
  }
  return $hms;
}

# Returns the UT date in YYYYMMDD format.
sub _get_UT_date {
  my $self = shift;
  my $FITS_headers = shift;

  #  use Data::Dumper;print Dumper $FITS_headers;die;
  # This is UT start and time.
  my $dateobs = $FITS_headers->{"DATE-OBS"};
  #    print "DATE-OBS=$dateobs\n";
  my $utdate =  substr( $dateobs, 0, 4 ) . substr( $dateobs, 5, 2 ) . substr( $dateobs, 8, 2 );
  #    print "UTDATE=$utdate\n";
  # Extract out the data in yyyymmdd format.
  return $utdate;
}

=back

=head1 SEE ALSO

C<Astro::FITS::HdrTrans>, C<Astro::FITS::HdrTrans::Base>.

=head1 AUTHOR

Tim Lister E<lt>tlister@lcogt.netE<gt>

=head1 COPYRIGHT

=cut

1;



( run in 0.617 second using v1.01-cache-2.11-cpan-98e64b0badf )