nom.tam.fits
Class BinaryTableHDU

java.lang.Object
  extended by nom.tam.fits.BasicHDU
      extended by nom.tam.fits.ExtensionHDU
          extended by nom.tam.fits.TableHDU
              extended by nom.tam.fits.BinaryTableHDU
Direct Known Subclasses:
A3DTableHDU

public class BinaryTableHDU
extends TableHDU

FITS binary table header/data unit


Field Summary
 
Fields inherited from class nom.tam.fits.BasicHDU
BITPIX_BYTE, BITPIX_DOUBLE, BITPIX_FLOAT, BITPIX_INT, BITPIX_LONG, BITPIX_SHORT
 
Constructor Summary
BinaryTableHDU()
          Build an empty binary table HDU.
BinaryTableHDU(Header header)
          Create a binary table header/data unit.
BinaryTableHDU(java.lang.Object[][] table)
          Build a binary table HDU from the supplied data.
 
Method Summary
 void addColumn(Column col)
          Add a column to tabular data.
 void addColumn(java.lang.Object[] data)
          Add a column without any associated header information.
 int findColumn(java.lang.String name)
          Find the column which has the given name (i.e., TTYPE)
 Column getColumn(int colNumber)
          Get the header and data associated with the given column.
 Column getColumn(java.lang.String name)
          Get the header and data information for a given column.
 java.lang.String getColumnFITSType(int index)
          Get the FITS type of a column in the table.
 java.lang.String getColumnName(int index)
          Get the name of a column in the table.
 int getNumColumns()
          Get the number of columns for this table
 int getNumRows()
          Get the number of rows for this table
 java.lang.Object getVarData(int col)
          Return a variable column.
 java.lang.Object getVarData(java.lang.String name)
          Return a variable column.
 void info()
          Print out some information about this HDU.
 boolean isHeader()
          Check that this HDU has a valid header.
static boolean isHeader(Header header)
          Check that this is a valid binary table header.
 Column makeVarColumn(java.lang.Object[] data)
          Create a variable column from the supplied data.
 Column makeVarColumn(java.lang.Object[] data, java.lang.String type)
          Create a variable column from the supplied data.
 Column makeVarColumn(java.lang.Object[] data, java.lang.String type, java.lang.String[] keys)
          Create a variable column from the supplied data.
 Data manufactureData()
          Create a Data object to correspond to the header description.
protected  void setColumnStrings()
          Set the default base keys which are expected to be associated with a binary table.
 
Methods inherited from class nom.tam.fits.TableHDU
addColumnString
 
Methods inherited from class nom.tam.fits.ExtensionHDU
getExtensionLevel, getExtensionName, getExtensionType, getExtensionVersion
 
Methods inherited from class nom.tam.fits.BasicHDU
getAuthor, getAxes, getBitPix, getBlankValue, getBScale, getBUnit, getBZero, getCreationDate, getData, getEpoch, getEquinox, getGroupCount, getHeader, getInstrument, getMaximumValue, getMinimumValue, getObject, getObservationDate, getObserver, getOrigin, getParameterCount, getReference, getSize, getTelescope, getTrimmedString, readData, skipData, skipData, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryTableHDU

public BinaryTableHDU(Header header)
               throws FitsException
Create a binary table header/data unit.

Parameters:
header - the template specifying the binary table.
Throws:
FitsException - if there was a problem with the header.

BinaryTableHDU

public BinaryTableHDU(java.lang.Object[][] table)
               throws FitsException
Build a binary table HDU from the supplied data.

Parameters:
table - the array used to build the binary table.
Throws:
FitsException - if there was a problem with the data.

BinaryTableHDU

public BinaryTableHDU()
               throws FitsException
Build an empty binary table HDU.

Throws:
FitsException - if there was a problem building the empty HDU.
Method Detail

isHeader

public static boolean isHeader(Header header)
Check that this is a valid binary table header.

Parameters:
header - to validate.
Returns:
true if this is a binary table header.

isHeader

public boolean isHeader()
Check that this HDU has a valid header.

Returns:
true if this HDU has a valid header.

setColumnStrings

protected void setColumnStrings()
Set the default base keys which are expected to be associated with a binary table. The user can add to these by calling addColumnString directly.


addColumn

public void addColumn(java.lang.Object[] data)
               throws FitsException
Add a column without any associated header information.

Parameters:
data - The column data to be added. Data should be an Object[] where type of all of the constituents is identical. The length of data should match the other columns. Note: It is valid for data to be a 2 or higher dimensionality primitive array. In this case the column index is the first (in Java speak) index of the array. E.g., if called with int[30][20][10], the number of rows in the table should be 30 and this column will have elements which are 2-d integer arrays with TDIM = (10,20).
Throws:
FitsException - the column could not be added.

findColumn

public int findColumn(java.lang.String name)
Find the column which has the given name (i.e., TTYPE)

Parameters:
name - The desired name.
Returns:
The Fits index of the column (first column = 1);

getColumn

public Column getColumn(java.lang.String name)
                 throws FitsException
Get the header and data information for a given column.

Parameters:
name - The name (TTYPE) of column desired.
Returns:
A Column object with the desired information or null if the column could not be found.
Throws:
FitsException - if colNumber could not be deleted.

getColumn

public Column getColumn(int colNumber)
                 throws FitsException
Get the header and data associated with the given column.

Parameters:
colNumber - The Fits (first=1) index of the desired column.
Returns:
The associated information.
Throws:
FitsException - if colNumber could not be found.

addColumn

public void addColumn(Column col)
               throws FitsException
Add a column to tabular data.

Parameters:
col - The column to be added. It should have the same dimension as all of the other columns.
Throws:
FitsException - if col could not be added.

makeVarColumn

public Column makeVarColumn(java.lang.Object[] data)
                     throws FitsException
Create a variable column from the supplied data.

Parameters:
data - The column of data to be added. It should have the same dimension as all of the other columns.
Throws:
FitsException - if column could not be added.

makeVarColumn

public Column makeVarColumn(java.lang.Object[] data,
                            java.lang.String type)
                     throws FitsException
Create a variable column from the supplied data.

Parameters:
data - The column of data to be added. It should have the same dimension as all of the other columns.
type - The Fits type for this column (S, L, B, etc.)
Throws:
FitsException - if column could not be added.

makeVarColumn

public Column makeVarColumn(java.lang.Object[] data,
                            java.lang.String type,
                            java.lang.String[] keys)
                     throws FitsException
Create a variable column from the supplied data.

Parameters:
data - The column of data to be added. It should have the same dimension as all of the other columns.
type - The Fits type for this column (S, L, B, etc.)
keys - The list of keys for this column (may be null).
Throws:
FitsException - if column could not be added.

getVarData

public java.lang.Object getVarData(java.lang.String name)
                            throws FitsException
Return a variable column.

Parameters:
name - The name of the column to fetch.
Returns:
either null if name was not found, or an array of data (as an Object).
Throws:
FitsException - if the column could not be found or returned.

getVarData

public java.lang.Object getVarData(int col)
                            throws FitsException
Return a variable column.

Parameters:
col - The column number to fetch.
Returns:
an array of data (as an Object).
Throws:
FitsException - if col was not a valid column number, was not a variable column, or had an invalid Fits type.

manufactureData

public Data manufactureData()
                     throws FitsException
Create a Data object to correspond to the header description.

Returns:
An unfilled Data object which can be used to read in the data for this HDU.
Throws:
FitsException - if the binary table could not be created.

getNumColumns

public int getNumColumns()
Get the number of columns for this table

Returns:
The number of columns in the table.

getNumRows

public int getNumRows()
Get the number of rows for this table

Returns:
The number of rows in the table.

getColumnName

public java.lang.String getColumnName(int index)
                               throws FitsException
Get the name of a column in the table.

Returns:
The column name.
Throws:
FitsException - if an invalid index was requested.

getColumnFITSType

public java.lang.String getColumnFITSType(int index)
                                   throws FitsException
Get the FITS type of a column in the table.

Returns:
The FITS type.
Throws:
FitsException - if an invalid index was requested.

info

public void info()
Print out some information about this HDU.

Specified by:
info in class BasicHDU