Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

FileIO


Files

file  psFits.h
 Contains Fits I/O routines.

Data Structures

struct  psFits
 FITS file object. More...

Enumerations

enum  psFitsType { PS_FITS_TYPE_NONE = -1, PS_FITS_TYPE_IMAGE = IMAGE_HDU, PS_FITS_TYPE_BINARY_TABLE = BINARY_TBL, PS_FITS_TYPE_ASCII_TABLE = ASCII_TBL, PS_FITS_TYPE_ANY = ANY_HDU }
 FITS HDU type. More...

Functions

psFits * psFitsAlloc (const char *name)
 Opens a FITS file and allocates the associated psFits object.
bool psMemCheckFits (psPtr ptr)
 Checks the type of a particular pointer.
bool psFitsMoveExtName (const psFits *fits, const char *extname)
 Moves the FITS HDU to the specified extension name.
bool psFitsMoveExtNum (const psFits *fits, int extnum, bool relative)
 Moves the FITS HDU to the specified extension number.
int psFitsGetExtNum (const psFits *fits)
 Get the current extension number, where 0 is the primary HDU.
psString psFitsGetExtName (const psFits *fits)
 Get the current extension name.
bool psFitsSetExtName (psFits *fits, const char *name)
 Set the current extension's name.
int psFitsGetSize (const psFits *fits)
 Get the total number of HDUs in the FITS file.
psFitsType psFitsGetExtType (const psFits *fits)
 Get the extension type of the current HDU.
psMetadata * psFitsReadHeader (psMetadata *out, const psFits *fits)
 Reads the header of the current HDU.
psMetadata * psFitsReadHeaderSet (psMetadata *out, const psFits *fits)
 Reads the header of all HDUs.
bool psFitsWriteHeader (const psMetadata *output, psFits *fits)
 Writes the values of the metadata to the current HDU header.
psImage * psFitsReadImage (psImage *out, const psFits *fits, psRegion region, int z)
 Reads an image, given the desired region and z-plane.
bool psFitsWriteImage (psFits *fits, psMetadata *header, const psImage *input, int depth)
 Writes an image, given the desired region and z-plane.
bool psFitsUpdateImage (psFits *fits, const psImage *input, psRegion region, int z)
 Updates the FITS file image, given the desired region and z-plane.
psMetadata * psFitsReadTableRow (const psFits *fits, int row)
 Reads a table row.
psArray * psFitsReadTableColumn (const psFits *fits, const char *colname)
 Reads a table column.
psVector * psFitsReadTableColumnNum (const psFits *fits, const char *colname)
 Reads a table column of numbers.
psArray * psFitsReadTable (psFits *fits)
 Reads a whole FITS table.
bool psFitsWriteTable (psFits *fits, const psMetadata *header, const psArray *table)
 Writes a whole FITS table.
bool psFitsUpdateTable (psFits *fits, const psMetadata *data, int row)
 Updates a FITS table.


Enumeration Type Documentation

enum psFitsType
 

FITS HDU type.

Enumeration for FITS HDU type.

Enumeration values:
PS_FITS_TYPE_NONE  Unknown HDU type.
PS_FITS_TYPE_IMAGE  Image HDU type.
PS_FITS_TYPE_BINARY_TABLE  Binary table HDU type.
PS_FITS_TYPE_ASCII_TABLE  ASCII table HDU type.
PS_FITS_TYPE_ANY  Any HDU type.

Definition at line 34 of file psFits.h.


Function Documentation

psFits* psFitsAlloc (  const char *  name  ) 
 

Opens a FITS file and allocates the associated psFits object.

Returns:
psFits* new psFits object for the FITS files specified or NULL if the open of the FITS file failed
Parameters:
name  the FITS file name

psString psFitsGetExtName (  const psFits *  fits  ) 
 

Get the current extension name.

Returns:
int Current HDU name of the psFits file or NULL if an error occurred.
Parameters:
fits  the psFits object

int psFitsGetExtNum (  const psFits *  fits  ) 
 

Get the current extension number, where 0 is the primary HDU.

Returns:
int Current HDU number of the psFits file or < 0 if an error occurred.
Parameters:
fits  the psFits object

psFitsType psFitsGetExtType (  const psFits *  fits  ) 
 

Get the extension type of the current HDU.

Returns:
psFitsType The type of the current HDU. If PS_FITS_TYPE_UNKNOWN, the type could not be determined.
Parameters:
fits  the psFits object

int psFitsGetSize (  const psFits *  fits  ) 
 

Get the total number of HDUs in the FITS file.

Returns:
int The total number of HDUs in the FITS file or < 0 if an error occurred.
Parameters:
fits  the psFits object

bool psFitsMoveExtName (  const psFits *  fits,
const char *  extname
) 
 

Moves the FITS HDU to the specified extension name.

Returns:
psFitsType The HDU type, or PS_FITS_TYPE_NONE if move failed.
Parameters:
fits  the psFits object to move
extname  the extension name

bool psFitsMoveExtNum (  const psFits *  fits,
int  extnum,
bool  relative
) 
 

Moves the FITS HDU to the specified extension number.

Returns:
psFitsType The HDU type, or PS_FITS_TYPE_NONE if move failed.
Parameters:
fits  the psFits object to move
extnum  the extension number to move to (zero is primary HDU)
relative  if true, extnum is a relative number to the current position

psMetadata* psFitsReadHeader (  psMetadata *  out,
const psFits *  fits
) 
 

Reads the header of the current HDU.

Returns:
psMetadata* the header data
Parameters:
out  The psMetadata to add the header data. If null, a new psMetadata is created.
fits  the psFits object

psMetadata* psFitsReadHeaderSet (  psMetadata *  out,
const psFits *  fits
) 
 

Reads the header of all HDUs.

The current HDU is not changed.

Returns:
psMetadata* the header data set as a number of metadata entries
Parameters:
out  The psMetadata to add the header data via psMetadata items. If null, a new psMetadata is created. The keys of the psMetadata are the extension names of the cooresponding HDUs.
fits  the psFits object

psImage* psFitsReadImage (  psImage *  out,
const psFits *  fits,
psRegion  region,
int  z
) 
 

Reads an image, given the desired region and z-plane.

Returns:
psImage* the read image or NULL if there was an error.
Parameters:
out  a psImage to recycle.
fits  the psFits object
region  the region in the FITS image to read
z  the z-plane in the FITS image cube to read

psArray* psFitsReadTable (  psFits *  fits  ) 
 

Reads a whole FITS table.

The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.

Returns:
psArray* Array of psMetadata items, which contains the output data items of each row.
See also:
psFitsReadTableRow
Parameters:
fits  the psFits object

psArray* psFitsReadTableColumn (  const psFits *  fits,
const char *  colname
) 
 

Reads a table column.

The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.

Returns:
psArray* Array of data items for the specified column or NULL if an error occurred.
Parameters:
fits  the psFits object
colname  the column name

psVector* psFitsReadTableColumnNum (  const psFits *  fits,
const char *  colname
) 
 

Reads a table column of numbers.

The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.

Returns:
psVector* Vector of data for the specified column or NULL if an error occurred.
Parameters:
fits  the psFits object
colname  the column name

psMetadata* psFitsReadTableRow (  const psFits *  fits,
int  row
) 
 

Reads a table row.

The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.

Returns:
psMetadata* The table row's data. The keys are the column names.
Parameters:
fits  the psFits object
row  row number to read

bool psFitsSetExtName (  psFits *  fits,
const char *  name
) 
 

Set the current extension's name.

Returns:
bool TRUE if the extension was successfully set, otherwise FALSE.
Parameters:
fits  the psFits object
name  the extension name

bool psFitsUpdateImage (  psFits *  fits,
const psImage *  input,
psRegion  region,
int  z
) 
 

Updates the FITS file image, given the desired region and z-plane.

Returns:
bool TRUE is the write was successful, otherwise FALSE.
Parameters:
fits  the psFits object
input  the image to output
region  the region in the FITS image to write
z  the z-planes of the FITS image data cube to write

bool psFitsUpdateTable (  psFits *  fits,
const psMetadata *  data,
int  row
) 
 

Updates a FITS table.

The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.

Returns:
bool TRUE if the write was successful, otherwise FALSE
See also:
psFitsWriteTable
Parameters:
fits  the psFits object
data  Array of psMetadata items, which contains the output data items of each row.
row  the row number to update.

bool psFitsWriteHeader (  const psMetadata *  output,
psFits *  fits
) 
 

Writes the values of the metadata to the current HDU header.

Returns:
bool if TRUE, the write was successful, otherwise FALSE.
Parameters:
output  the psMetadata data in which to write
fits  the psFits object

bool psFitsWriteImage (  psFits *  fits,
psMetadata *  header,
const psImage *  input,
int  depth
) 
 

Writes an image, given the desired region and z-plane.

Returns:
bool TRUE is the write was successful, otherwise FALSE.
Parameters:
fits  the psFits object
header  header items for the new HDU. Can be NULL.
input  the image to output
depth  the number of z-planes of the FITS image data cube

bool psFitsWriteTable (  psFits *  fits,
const psMetadata *  header,
const psArray *  table
) 
 

Writes a whole FITS table.

The current HDU type must be either PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.

Returns:
bool TRUE if the write was successful, otherwise FALSE
See also:
psFitsReadTableRow
Parameters:
fits  the psFits object
header  header items for the new HDU. Can be NULL.
table  Array of psMetadata items, which contains the output data items of each row.

bool psMemCheckFits (  psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psFits structure, false otherwise.
Parameters:
ptr  the pointer whose type to check


Generated on Thu Oct 13 14:33:50 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2