org.eso.fits
Class FitsColumn

java.lang.Object
  extended by org.eso.fits.FitsColumn

public class FitsColumn
extends java.lang.Object

FitsColumn class represents a FITS table column in either ASCII or BINARY table format. Note: only binary data formats A,L,I,J,E,D are fully supported.


Constructor Summary
FitsColumn(int type, java.lang.String tform, java.lang.String label, int rows)
          Constructor for FitsColumn class from a file
 
Method Summary
 char getDataType()
          Get the data type character for column as given in the TFORM FITS keyword.
 java.lang.String getDisplay()
          Retrieve the display format for the column (ref.
 int getInt(int row)
          Read single column element as integer value.
 int[] getInts(int row)
          Read single column element as integer array.
 java.lang.String getLabel()
          Retrieve column label.
 double getReal(int row)
          Read single column element as double value.
 double[] getReals(int row)
          Read single column element as double array.
 int getRepeat()
          Retrieve repeat factor that is number of values per column element
 double getScale()
          Get scaling factor for table column.
 java.lang.String getString(int row)
          Read single column element as string.
 java.lang.String getUnit()
          Retrieve unit string for the column.
protected  int getWidth()
          Calculate the number of bytes associated to a column entry.
 double getZero()
          Get scaling zero point for table column.
 void setData(byte[] array, int position, int recordSize)
          Sets data matrix with the table data as a byte array
 void setData(java.io.RandomAccessFile file, long dataOffset, int position, int recordSize)
          Sets data matrix with the table data as a RandomAcessFile.
 void setDim(java.lang.String dim)
          Define dimension of binary table column.
 void setDisplay(java.lang.String display)
          Set the display format of the column.
 void setLabel(java.lang.String label)
          Set label of the column.
 void setNull(int nullValue)
          Define NULL value for interger format Binary table columns
 void setNull(java.lang.String nullValue)
          Define NULL string for ASCII table column.
 void setScale(double scale)
          Define scaling factor for table column.
 void setUnit(java.lang.String unit)
          Set unit string for column.
 void setZero(double zero)
          Define scaling zero point for table column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FitsColumn

public FitsColumn(int type,
                  java.lang.String tform,
                  java.lang.String label,
                  int rows)
           throws FitsException
Constructor for FitsColumn class from a file

Parameters:
type - storage type of column i.e. Fits.ATABLE or Fits.BTABLE, by default Fits.BTABLE is assumed
tform - storage format of data in column
label - name of column
rows - no. of rows in the column
Throws:
FitsException
Method Detail

setData

public void setData(java.io.RandomAccessFile file,
                    long dataOffset,
                    int position,
                    int recordSize)
Sets data matrix with the table data as a RandomAcessFile.

Parameters:
file - associated RandomAccessFile with FITS data
dataOffset - byte offset of the table data unit in the FITS file
position - relative byte start position of of column data within record (first byte is 0)
recordSize - byte size of table record

setData

public void setData(byte[] array,
                    int position,
                    int recordSize)
Sets data matrix with the table data as a byte array

Parameters:
array - byte array with table data matrix
position - relative byte start position of of column data within record (first byte is 0)
recordSize - byte size of table record

getInt

public int getInt(int row)
Read single column element as integer value. An ndefined value is returned as Integer.MIN_VALUE. The following column types are supported i.e. binary I/J formats. For array type elements only the first element is read. Note: ASCII table columns are read with free format and does not conform to the FITS standard in the current implementation.

Parameters:
row - no. of element in column (starting with 0)

getInts

public int[] getInts(int row)
Read single column element as integer array. Undefined values are returned as Integer.MIN_VALUE. The following column types are supported i.e. binary I/J formats. Note: ASCII table columns are read with free format and does not conform to the FITS standard in the current implementation.

Parameters:
row - no. of element in column (starting with 0)

getReal

public double getReal(int row)
Read single column element as double value. An undefined value is returned as Double.NaN. The following column types are supported i.e. binary I/J/E/D formats. For array type elements only the first element is read. Note: ASCII table columns are read with free format and does not conform to the FITS standard in the current implementation.

Parameters:
row - no. of element in column (starting with 0)

getReals

public double[] getReals(int row)
Read single column element as double array. Undefined value are returned as Double.NaN. The following column types are supported: binary I/J/E/D formats. Note: ASCII table columns are read with free format and does not conform to the FITS standard in the current implementation.

Parameters:
row - no. of element in column (starting with 0)

getString

public java.lang.String getString(int row)
Read single column element as string. An undefined value is returned as a NULL string. The following column types are supported: A/L formats.

Parameters:
row - number of element in column (starting with 0)

setNull

public void setNull(java.lang.String nullValue)
Define NULL string for ASCII table column.

Parameters:
nullValue - string with null value

setNull

public void setNull(int nullValue)
Define NULL value for interger format Binary table columns

Parameters:
nullValue - value of NULL integer

setDim

public void setDim(java.lang.String dim)
Define dimension of binary table column. Note: This is not used in the current implementation

Parameters:
dim - string with dimension soecification for column

getRepeat

public int getRepeat()
Retrieve repeat factor that is number of values per column element


getDataType

public char getDataType()
Get the data type character for column as given in the TFORM FITS keyword.


getWidth

protected int getWidth()
Calculate the number of bytes associated to a column entry.


getDisplay

public java.lang.String getDisplay()
Retrieve the display format for the column (ref. TDISP keyword).


setDisplay

public void setDisplay(java.lang.String display)
Set the display format of the column.

Parameters:
display - string with the display format for the column

getUnit

public java.lang.String getUnit()
Retrieve unit string for the column.


setUnit

public void setUnit(java.lang.String unit)
Set unit string for column.

Parameters:
unit - string with the unit of the column

getLabel

public java.lang.String getLabel()
Retrieve column label.


setLabel

public void setLabel(java.lang.String label)
Set label of the column.

Parameters:
label - string with the column label

getZero

public double getZero()
Get scaling zero point for table column.


setZero

public void setZero(double zero)
Define scaling zero point for table column.

Parameters:
zero - scaling zero point applied on raw data values

getScale

public double getScale()
Get scaling factor for table column.


setScale

public void setScale(double scale)
Define scaling factor for table column.

Parameters:
scale - scaling factor applied on raw data values