Astro-FITS-Header
view release on metacpan or search on metacpan
lib/Astro/FITS/Header/AST.pm view on Meta::CPAN
=cut
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;
{
lib/Astro/FITS/Header/AST.pm view on Meta::CPAN
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 --------------------------------------------
lib/Astro/FITS/Header/CFITSIO.pm view on Meta::CPAN
sub configure {
my $self = shift;
my %args = ( ReadOnly => 0, @_ );
# itialise the inherited status to OK.
my $status = 0;
my $ifits;
return $self->SUPER::configure(%args)
if exists $args{Cards} or exists $args{Items};
# read the args hash
if (exists $args{fitsID}) {
$ifits = $args{fitsID};
} elsif (exists $args{File}) {
$ifits = Astro::FITS::CFITSIO::open_file( $args{File},
$args{ReadOnly} ? Astro::FITS::CFITSIO::READONLY() :
Astro::FITS::CFITSIO::READWRITE(),
$status );
lib/Astro/FITS/Header/CFITSIO.pm view on Meta::CPAN
push(@fits, $card);
}
# add an END card. previously this was extracted from CFITSIO
# by reading an extra card. however, the header may not have
# been completed by CFITSIO, so that extra card might not exist.
push @fits, Astro::FITS::Header::Item->new( Keyword => 'END')->card;
if ($status == 0) {
# Parse the FITS array
$self->SUPER::configure( Cards => \@fits );
} else {
# Report bad exit status
croak("Error $status reading FITS array");
}
# Look at the name of the file as it was passed in. If there is a FITS
# extension specified, then this is a single fits image that you want
# read. If there isn't one specified, then we should read each of the
# extensions that exist in the file, if in fact there are any.
lib/Astro/FITS/Header/CFITSIO.pm view on Meta::CPAN
exist, fitsID key takes priority.
Throws an exception (croaks) on error.
=cut
sub writehdr {
my $self = shift;
my %args = @_;
return $self->SUPER::configure(%args) if exists $args{Cards};
# itialise the inherited status to OK.
my $status = 0;
my $ifits;
# read the args hash
if (exists $args{fitsID}) {
$ifits = $args{fitsID};
} elsif (exists $args{File}) {
$ifits = Astro::FITS::CFITSIO::open_file( $args{File},
lib/Astro/FITS/Header/GSD.pm view on Meta::CPAN
=cut
sub configure {
my $self = shift;
my %args = @_;
my ($indf, $started);
my $task = ref($self);
return $self->SUPER::configure(%args) if exists $args{Cards} or
exists $args{Items};
my $gsd;
if (exists $args{gsdobj} && defined $args{gsdobj}) {
$gsd = $args{gsdobj};
croak "gsd object must be of class 'GSD'"
unless UNIVERSAL::isa($gsd, 'GSD');
} elsif (exists $args{File}) {
lib/Astro/FITS/Header/GSD.pm view on Meta::CPAN
Keyword => $name,
Comment => $comment,
Value => $value,
Type => $type,
));
}
}
# Configure the object
$self->SUPER::configure( Items => \@cards );
return;
}
=item B<writehdr>
The GSD library is read-only. The writehdr method is not implemented
for this sub-class.
lib/Astro/FITS/Header/NDF.pm view on Meta::CPAN
=cut
sub configure {
my $self = shift;
my %args = @_;
my ($indf, $started);
my $task = ref($self);
return $self->SUPER::configure(%args)
if exists $args{Cards} or exists $args{Items};
# Store the definition of good locally
my $status = &NDF::SAI__OK;
my $good = $status;
# Start error system (this may be the first time we hit
# starlink)
err_begin( $status );
lib/Astro/FITS/Header/NDF.pm view on Meta::CPAN
# Read the FITS extension
dat_get1c($xloc, $dim[0], @fits, $nfits, $status);
# Annul the locator
dat_annul($xloc, $status);
# Check status and read into hash
if ($status == $good) {
# Parse the FITS array
$self->SUPER::configure( Cards => \@fits );
} else {
err_rep(' ',"$task: Error reading FITS array", $status);
}
} else {
# Add my own message to status
( run in 0.436 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )