Astro::FITS::Header::AST - Manipulates FITS headers from an AST object


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

Index


Code Index:

NAME

Top

Astro::FITS::Header::AST - Manipulates FITS headers from an AST object

SYNOPSIS

Top

  use Astro::FITS::Header::AST;

  $header = new Astro::FITS::Header::AST( FrameSet => $wcsinfo );
  $header = new Astro::FITS::Header::AST( FrameSet => $wcsinfo,
                                          Encoding => 'FITS-IRAF' );

  $header = new Astro::FITS::Header::AST( Cards => \@cards );

DESCRIPTION

Top

This module makes use of the Starlink::AST module to read the FITS HDU from an AST FrameSet object.

It stores information about a FITS header block in an object. Takes an hash as an arguement, with an array reference pointing to an Starlink::AST FramSet object.

REVISION

Top

$Id$

METHODS

Top

configure

Reads a FITS header from a Starlink::AST FrameSet object

  $header->configure( FrameSet => $wcsinfo );

Base class initialisation also works:

  $header->configure( Cards => \@cards );

Accepts a reference to an Starlink::AST FrameSet object.

If a specific encoding is required, this can be specified using the Encoding argument. Default is FITS-WCS if no Encoding is given. Note that not all framesets can be encoded using FITS-WCS.

  $header->configure( FrameSet => $wcsinfo, Encoding => "Native" );

If Encoding is specified but undefined, the default will be decided by AST.

SEE ALSO

Top

Starlink::AST, Astro::FITS::Header

AUTHORS

Top

Alasdair Allan <aa@astro.ex.ac.uk>, Tim Jenness <t.jenness@jach.hawaii.edu>

COPYRIGHT

Top


Astro-FITS-Header documentation Contained in the Astro-FITS-Header distribution.
package Astro::FITS::Header::AST;

# L O A D   M O D U L E S --------------------------------------------------

use strict;
use vars qw/ $VERSION /;

use Astro::FITS::Header::Item;
use base qw/ Astro::FITS::Header /;
use Carp;

require Starlink::AST;

$VERSION = 3.01;

# C O N S T R U C T O R ----------------------------------------------------

sub configure {
  my $self = shift;
  my %args = @_;

  # initialise the inherited status to OK.
  my $status = 0;

  return $self->SUPER::configure(%args)
    if exists $args{Cards} or exists $args{Items};

  # read the args hash
  unless (exists $args{FrameSet}) {
     croak("Arguement hash does not contain FrameSet or Cards");
  }

  my $wcsinfo = $args{FrameSet};
  my @cards;
  {
     my $fchan = new Starlink::AST::FitsChan(
                                      sink => sub { push @cards, $_[0] } );
     if (exists $args{Encoding}) {
       if (defined $args{Encoding}) {
         # use AST default if undef is supplied
         $fchan->Set( Encoding => $args{Encoding} );
       }
     } else {
       # Historical default
       $fchan->Set( Encoding => "FITS-WCS" );
     }
     $status = $fchan->Write( $wcsinfo );
  }
  return $self->SUPER::configure( Cards => \@cards );
}

# shouldn't need to do this, croak! croak!
sub writehdr {
  my $self = shift;
  croak("Not yet implemented");
}

# T I M E   A T   T H E   B A R  --------------------------------------------

# L A S T  O R D E R S ------------------------------------------------------

1;