Package nom.tam.fits
Class BinaryTableHDU
- All Implemented Interfaces:
FitsElement
- Direct Known Subclasses:
CompressedImageHDU
,CompressedTableHDU
Binary table header/data unit.
- See Also:
-
Field Summary
Fields inherited from class nom.tam.fits.BasicHDU
BITPIX_BYTE, BITPIX_DOUBLE, BITPIX_FLOAT, BITPIX_INT, BITPIX_LONG, BITPIX_SHORT
-
Constructor Summary
ConstructorDescriptionBinaryTableHDU
(Header hdr, BinaryTable datum) Deprecated.(for internal use) Its visibility should be reduced to package level in the future. -
Method Summary
Modifier and TypeMethodDescriptionint
Add a column to the table without any associated header information.final boolean
convertToBits
(int col) Converts a column from FITS logical values to bits.static BinaryTable
Deprecated.(for internal use) UseBinaryTable.fromColumnMajor(Object[])
orBinaryTable.fromRowMajor(Object[][])
instead.getColumnDescriptor
(int col) Returns a copy of the column descriptor of a given column in this tablevoid
info
(PrintStream stream) Print out some information about this HDU.static boolean
Deprecated.(for internal use) Will reduce visibility in the futureboolean
isHeader()
Deprecated.(for internal use) Will reduce visibility in the futurestatic boolean
Deprecated.(for internal use) Will reduce visibility in the futurestatic BinaryTable
manufactureData
(Header header) Deprecated.(for internal use) Will reduce visibility in the futurestatic Header
manufactureHeader
(Data data) Deprecated.(for internal use) Will reduce visibility in the futurevoid
setColumnName
(int index, String name, String comment) Sets the name / ID of a specific column in this table.boolean
setComplexColumn
(int index) Convert a column in the table to complex.static BinaryTableHDU
wrap
(BinaryTable tab) Wraps the specified table in an HDU, creating a header for it with the essential table description.void
write
(ArrayDataOutput out) Writes the contents of the element to a data sink, adding padding as necessary if the element (such as a header or data segment) is expected to complete the FITS block of 2880 bytes.Methods inherited from class nom.tam.fits.TableHDU
addRow, deleteColumnsIndexOne, deleteColumnsIndexOne, deleteColumnsIndexZero, deleteColumnsIndexZero, deleteRows, deleteRows, findColumn, getColumn, getColumn, getColumnFormat, getColumnMeta, getColumnName, getColumns, getDefaultColumnName, getElement, getNCols, getNRows, getRow, setColumn, setColumn, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setCurrentColumn, setCurrentColumn, setElement, setRow
Methods inherited from class nom.tam.fits.BasicHDU
addValue, addValue, addValue, addValue, addValue, addValue, addValue, addValue, calcChecksum, card, getAuthor, getAxes, getBitpix, getBitPix, getBlankValue, getBScale, getBUnit, getBZero, getCreationDate, getData, getDummyHDU, getEpoch, getEquinox, getFileOffset, getGroupCount, getHeader, getInstrument, getKernel, getMaximumValue, getMinimumValue, getObject, getObservationDate, getObserver, getOrigin, getParameterCount, getReference, getSize, getStoredChecksum, getStoredDatasum, getTelescope, getTrimmedString, getTrimmedString, read, reset, rewrite, rewriteable, setChecksum, verifyDataIntegrity, verifyIntegrity
-
Constructor Details
-
BinaryTableHDU
Deprecated.(for internal use) Its visibility should be reduced to package level in the future.Creates a new binary table HDU from the specified FITS header and associated table data- Parameters:
hdr
- the FITS header describing the data and any user-specific keywordsdatum
- the corresponding data object
-
-
Method Details
-
wrap
Wraps the specified table in an HDU, creating a header for it with the essential table description. Users may want to complete the table description with optional FITS keywords such asTTYPEn
,TUNITn
etc. It is strongly recommended that the table structure (rows or columns) isn't altered after the table is encompassed in an HDU, since there is no guarantee that the header description will be kept in sync.- Parameters:
tab
- the binary table to wrap into a new HDU- Returns:
- A new HDU encompassing and describing the supplied table.
- Throws:
FitsException
- if the table structure is invalid, and cannot be described in a header (should never really happen, but we keep the possibility open to it).- Since:
- 1.18
- See Also:
-
encapsulate
Deprecated.(for internal use) UseBinaryTable.fromColumnMajor(Object[])
orBinaryTable.fromRowMajor(Object[][])
instead. Will reduce visibility in the future.- Parameters:
o
- data to encapsulate- Returns:
- Encapsulate data in a BinaryTable data type
- Throws:
FitsException
- if the type of the data is not usable as data
-
isData
Deprecated.(for internal use) Will reduce visibility in the futureCheck if this data object is consistent with a binary table.- Parameters:
o
- a column table object, an Object[][], or an Object[]. This routine doesn't check that the dimensions of arrays are properly consistent.- Returns:
true
if the data object can be represented as a FITS binary table, otherwisefalse
.
-
isHeader
Deprecated.(for internal use) Will reduce visibility in the futureCheck that this is a valid binary table header.- Parameters:
header
- to validate.- Returns:
true
if this is a binary table header.
-
manufactureData
Deprecated.(for internal use) Will reduce visibility in the futurePrepares a data object into which the actual data can be read from an input subsequently or at a later time.- Parameters:
header
- The FITS header that describes the data- Returns:
- A data object that support reading content from a stream.
- Throws:
FitsException
- if the data could not be prepared to prescriotion.
-
manufactureHeader
Deprecated.(for internal use) Will reduce visibility in the future- Parameters:
data
- the data used to build the binary table. This is typically some kind of array of objects.- Returns:
- a newly created binary table HDU from the supplied data.
- Throws:
FitsException
- if there was a problem with the data.
-
addColumn
Description copied from class:TableHDU
Add a column to the table without any associated header information.- Overrides:
addColumn
in classTableHDU<BinaryTable>
- Parameters:
data
- the new column information. the newCol 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).- Returns:
- the number of columns in the adapted table
- Throws:
FitsException
- if the operation failed
-
info
Description copied from class:BasicHDU
Print out some information about this HDU.- Specified by:
info
in classBasicHDU<BinaryTable>
- Parameters:
stream
- the printstream to write the info on
-
isHeader
Deprecated.(for internal use) Will reduce visibility in the futureCheck that this HDU has a valid header.- Returns:
true
if this HDU has a valid header.
-
getColumnDescriptor
Returns a copy of the column descriptor of a given column in this table- Parameters:
col
- the zero-based column index- Returns:
- a copy of the column's descriptor
- Since:
- 1.18
- See Also:
-
setColumnName
public void setColumnName(int index, String name, String comment) throws IndexOutOfBoundsException, HeaderCardException Description copied from class:TableHDU
Sets the name / ID of a specific column in this table. Naming columns is generally a good idea so that people can figure out what sort of data actually appears in specific table columns.- Overrides:
setColumnName
in classTableHDU<BinaryTable>
- Parameters:
index
- the column indexname
- the name or ID we want to assing to the columncomment
- Any additional comment we would like to store alongside in the FITS header. (The comment may be truncated or even ommitted, depending on space constraints in the FITS header.- Throws:
IndexOutOfBoundsException
- if the table has no column matching the indexHeaderCardException
- if there was a problem wil adding the associated descriptive FITS header keywords to this table's header.- See Also:
-
convertToBits
Converts a column from FITS logical values to bits. Null values (allowed in logical columns) will map tofalse
. It is legal to call this on a column that is already containing bits.- Parameters:
col
- The zero-based index of the column to be reset.- Returns:
- Whether the conversion was possible. *
- Throws:
FitsException
- if the header could not be updated- Since:
- 1.18
-
setComplexColumn
Convert a column in the table to complex. Only tables with appropriate types and dimensionalities can be converted. It is legal to call this on a column that is already complex.- Parameters:
index
- The zero-based index of the column to be converted.- Returns:
- Whether the column can be converted
- Throws:
FitsException
- if the header could not be updated- See Also:
-
write
Description copied from interface:FitsElement
Writes the contents of the element to a data sink, adding padding as necessary if the element (such as a header or data segment) is expected to complete the FITS block of 2880 bytes.- Specified by:
write
in interfaceFitsElement
- Overrides:
write
in classBasicHDU<BinaryTable>
- Parameters:
out
- The data sink.- Throws:
FitsException
- if the write was unsuccessful.
-