NDF(F) User Contributed Perl Documentation NDF(F) 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. FUNCTIONS 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 argu- ment turns off automatic quality masking and returns a quality array as well. BUG? "rndf('bob.sdf',1)" calls ndf_sqmf(1,...), which means that the quality array is turned into bad pixels - ie the opposite of above. Or am I confused? 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 exten- sion is stored in $$hdr{NDF_EXT}{IRAS}{ASTROME- TRY}{'PROJ_PARS'}. All array structures are stored as arrays in the Hdr: numeric arrays are stored as PDLs, log- ical and character arrays are stored as plain Perl arrays. FITS arrays are a special case and are expanded as scalars into the header. PDL does not have a signed byte datatype, so any '_BYTE' data is read into a "byte" (unsigned) piddle and a warning is printed to "STDOUT". 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. The '.sdf' suffix is optional. All the extensions created by rndf are supported by wndf. This means that error, axis and quality arrays will be written if they exist. Exten- sions 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 exten- sions. 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 exten- sions (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,VARI- ANCE, 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. This is available from the author or from Starlink (http://www.star- link.rl.ac.uk). If an NDF is read which contains AST World Coordinate information (a .WCS component) this information is cur- rently ignored. Currently WCS information can only be written and stored using standard FITS headers. See http://rlspc5.bnsc.rl.ac.uk/star/docs/sun211.htx/sun211.html#xref_ for more information on AST. AUTHOR This module was written by Tim Jenness <t.jen- ness@jach.hawaii.edu>. Copyright (C) Tim Jenness 1997-2000. All Rights Reserved. SEE ALSO PDL::FAQ for general information on the Perl Data lan- guage, NDF for information on the NDF module. perl v5.6.1 2002-04-08 NDF(F)