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

FileIO


Files

file  psFits.h
 Contains Fits I/O routines.
file  psFitsHeader.h
 Contains Fits header I/O routines.
file  psFitsImage.h
 Contains Fits I/O routines.
file  psFitsTable.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

psFitspsFitsOpen (const char *filename, const char *mode)
 Opens a FITS file and allocates the associated psFits object.
bool psFitsClose (psFits *fits)
 Closes a FITS file.
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.
bool psFitsMoveLast (psFits *fits)
 Moves the FITS HDU to the end of the file.
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.
bool psFitsDeleteExtNum (psFits *fits, int extnum, bool relative)
 Remove the an HDU as specified by number.
bool psFitsDeleteExtName (psFits *fits, const char *extname)
 Remove the an HDU as specified by extension name.
psFitsType psFitsGetExtType (const psFits *fits)
 Get the extension type of the current HDU.
bool psFitsTruncate (psFits *fits)
 Delete all extensions after the current position.
psMetadatapsFitsReadHeader (psMetadata *out, const psFits *fits)
 Reads the header of the current HDU.
psMetadatapsFitsReadHeaderSet (psMetadata *out, const psFits *fits)
 Reads the header of all HDUs.
bool psFitsWriteHeader (psFits *fits, const psMetadata *output)
 Writes the values of the metadata to the current HDU header.
bool psFitsWriteBlank (psFits *fits, const psMetadata *output)
 Writes a "blank" --- a header only, with no image or table.
bool psFitsHeaderValidate (psMetadata *header)
 psFitsHeaderValidate validates the supplied header so that it is in compliance to the FITS standard for header keyword names and types.
psImagepsFitsReadImage (const psFits *fits, psRegion region, int z)
 Reads an image, given the desired region and z-plane.
bool psFitsWriteImage (psFits *fits, const psMetadata *header, const psImage *input, int depth, const char *extname)
 Writes an image, given the desired region and z-plane.
bool psFitsInsertImage (psFits *fits, const psMetadata *header, const psImage *input, int depth, const char *extname, bool after)
 Writes an image, given the desired region and z-plane.
bool psFitsUpdateImage (psFits *fits, const psImage *input, int x0, int y0, int z)
 Updates the FITS file image, given the desired region and z-plane.
psArraypsFitsReadImageCube (const psFits *fits, psRegion region)
bool psFitsWriteImageCube (psFits *fits, psMetadata *header, const psArray *input, const char *extname)
bool psFitsUpdateImageCube (psFits *fits, const psArray *input, int x0, int y0)
psMetadatapsFitsReadTableRow (const psFits *fits, int row)
 Reads a table row.
psArraypsFitsReadTableColumn (const psFits *fits, const char *colname)
 Reads a table column.
psVectorpsFitsReadTableColumnNum (const psFits *fits, const char *colname)
 Reads a table column of numbers.
psArraypsFitsReadTable (const psFits *fits)
 Reads a whole FITS table.
bool psFitsWriteTable (psFits *fits, const psMetadata *header, const psArray *table, const char *extname)
 Writes a whole FITS table.
bool psFitsInsertTable (psFits *fits, const psMetadata *header, const psArray *table, const char *extname, bool after)
 Inserts 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.

Enumerator:
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

bool psFitsClose psFits fits  ) 
 

Closes a FITS file.

Returns:
bool TRUE if FITS file was successfully closed, otherwise FALSE
Parameters:
fits  psFits object to close

bool psFitsDeleteExtName psFits fits,
const char *  extname
 

Remove the an HDU as specified by extension name.

Returns:
bool TRUE if the specified HDU was removed, otherwise FALSE
Parameters:
fits  the psFits object
extname  the extension name to delete

bool psFitsDeleteExtNum psFits fits,
int  extnum,
bool  relative
 

Remove the an HDU as specified by number.

Returns:
bool TRUE if the specified HDU was removed, otherwise FALSE
Parameters:
fits  the psFits object
extnum  the extension number to delete (zero is primary HDU)
relative  if true, extnum is a relative number to the current position

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 psFitsHeaderValidate psMetadata header  ) 
 

psFitsHeaderValidate validates the supplied header so that it is in compliance to the FITS standard for header keyword names and types.

Returns:
bool TRUE if the resulting header conforms to the FITS standard, otherwise FALSE

bool psFitsInsertImage psFits fits,
const psMetadata header,
const psImage input,
int  depth,
const char *  extname,
bool  after
 

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

A new IMAGE HDU is appended to the end of the FITS file.

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
extname  FITS extension name
after  if TRUE, inserts HDU after current HDU, otherwise before

bool psFitsInsertTable psFits fits,
const psMetadata header,
const psArray table,
const char *  extname,
bool  after
 

Inserts a whole FITS table.

A new HDU of the type BINTABLE is inserted either before or after, depending on the AFTER parameter, the current HDU.

Returns:
bool TRUE if the insert/write was successful, otherwise FALSE
See also:
psFitsWriteTable
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.
extname  Extension name
after  TRUE if insert is done after CHDU, otherwise table is inserted before CHDU

bool psFitsMoveExtName const psFits fits,
const char *  extname
 

Moves the FITS HDU to the specified extension name.

Returns:
bool TRUE if the extension name was found and move was successful, otherwise FALSE
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:
bool TRUE if the extension number was found and move was successful, otherwise FALSE
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

bool psFitsMoveLast psFits fits  ) 
 

Moves the FITS HDU to the end of the file.

Returns:
bool TRUE if the move was successful, otherwise FALSE
Parameters:
fits  the psFits object to move

psFits* psFitsOpen const char *  filename,
const char *  mode
 

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:
filename  the FITS file name
mode  File open mode. Could be one of the following: 'r' (read only), 'r+' (read & write), 'rw' (same as 'r+'), or 'w' (create new file for writing)

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  output metadata or NULL if new psMetadata is to be created.
fits  the psFits object

psImage* psFitsReadImage 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:
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* psFitsReadImageCube const psFits fits,
psRegion  region
 

psArray* psFitsReadTable const 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 psFitsTruncate psFits fits  ) 
 

Delete all extensions after the current position.

Returns:
bool TRUE if the operation was successful, otherwise FALSE
Parameters:
fits  the psFits object

bool psFitsUpdateImage psFits fits,
const psImage input,
int  x0,
int  y0,
int  z
 

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

a new IMAGE HDU is inserted before or after, depending on the AFTER parameter, the current HDU.

Returns:
bool TRUE is the write was successful, otherwise FALSE.
Parameters:
fits  the psFits object
input  the image to output
x0  psImage's x-axis origin in FITS image coordinates
y0  psImage's y-axis origin in FITS image coordinates
z  the z-planes of the FITS image data cube to write

bool psFitsUpdateImageCube psFits fits,
const psArray input,
int  x0,
int  y0
 

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 psFitsWriteBlank psFits fits,
const psMetadata output
 

Writes a "blank" --- a header only, with no image or table.

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

bool psFitsWriteHeader psFits fits,
const psMetadata output
 

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

Doesn't check if the header has to be created.

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

bool psFitsWriteImage psFits fits,
const psMetadata header,
const psImage input,
int  depth,
const char *  extname
 

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
extname  FITS extension name

bool psFitsWriteImageCube psFits fits,
psMetadata header,
const psArray input,
const char *  extname
 

bool psFitsWriteTable psFits fits,
const psMetadata header,
const psArray table,
const char *  extname
 

Writes a whole FITS table.

A new HDU of the type BINTABLE is appended to the file.

Returns:
bool TRUE if the write was successful, otherwise FALSE
See also:
psFitsReadTable

psFitsInsertTable

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.
extname  Extension name

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 Mon Jul 3 14:15:13 2006 for Pan-STARRS Foundation Library by  doxygen 1.4.4