The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PDL::IO::NDF - PDL Module for reading and writing Starlink N-dimensional data structures as PDLs.

SYNOPSIS

  use PDL::IO::NDF;

  $a = PDL->rndf($file);

  $a = rndf('test_image');
  $a = rndf('test_image', 1);

  $a->wndf($file);
  wndf($a, 'out_image');

  propndfx($a, 'template', 'out_image');

DESCRIPTION

This module adds the ability to read and write Starlink N-dimensional data files as N-dimensional PDLs.

rndf()

Reads a piddle from a NDF format data file.

     $pdl = rndf('file.sdf');
     $pdl = rndf('file.sdf',1);

The '.sdf' suffix is optional. The optional second argument turns off automatic quality masking and returns a quality array as well.

Header information and NDF Extensions are stored in the piddle as a hash which can be retreived with the $pdl->gethdr command. Array extensions are stored in the header as follows:

     $a - the base DATA_ARRAY

If $hdr = $a->gethdr;

then:

      %{$hdr}        contains all the FITS headers plus:
      $$hdr{Error}   contains the Error/Variance PDL
      $$hdr{Quality} The quality byte array (if reqeusted)
      @{$$hdr{Axis}} Is an array of piddles containing the information
                     for axis 0, 1, etc.
      $$hdr{NDF_EXT} Contains all the NDF extensions
      $$hdr{Hist}    Contains the history information
      $$hdr{NDF_EXT}{_TYPES} - Data types for non-PDL NDF extensions so that
                           wndf can reconstruct a NDF.

All extension information is stored in the header hash array. Extension structures are preserved in hashes, so that the PROJ_PARS component of the IRAS.ASTROMETRY extension is stored in $$hdr{NDF_EXT}{IRAS}{ASTROMETRY}{'PROJ_PARS'}. All array structures are stored as arrays in the Hdr: numeric arrays are stored as PDLs, logical and character arrays are stored as plain Perl arrays. FITS arrays are a special case and are expanded as scalars into the header.

wndf()

Writes a piddle to a NDF format file:

   $pdl->wndf($file);
   wndf($pdl,$file);

wndf can be used for writing PDLs to NDF files. All the extensions created by rndf are supported by wndf. This means that error, axis and quality arrays will be written if they exist. Extensions are also reconstructed by using their name (ie FIGARO.TEST would be expanded as a FIGARO extension and a TEST component). Hdr keywords Label, Title and Units are treated as special cases and are written to the label, title and units fields of the NDF.

Header information is written to corresponding NDF extensions. NDF extensions can also be created in the {NDF} hash by using a key containing '.', ie {NDF}{'IRAS.DATA'} would write the information to an IRAS.DATA extension in the NDF. rndf stores this as $$hdr{NDF}{IRAS}{DATA} and the two systems are interchangeable.

rndf stores type information in {NDF}{'_TYPES'} and below so that wndf can reconstruct the data type of non-PDL extensions. If no entry exists in _TYPES, wndf chooses between characters, integer and double on a best guess basis. Any perl arrays are written as CHAR array extensions (on the assumption that numeric arrays will exist as PDLs).

propndfx()

Routine to write a PDL to an NDF by copying the extension information from an existing NDF and writing DATA,VARIANCE, QUALITY and AXIS info from a PDL (if they exist).

Extensions, labels and history are propogated from the old NDF. No new extension information is written.

This command has been superseded by wndf().

NOTES

The perl NDF module must be available.

AUTHOR

This module was written by Tim Jenness, t.jenness@jach.hawaii.edu. Copyright (C) Tim Jenness 1997-1999.

SEE ALSO

PDL::FAQ for general information on the Perl Data language, PDL::IO::NDF for information on the NDF module.