Class BinaryTableHDU
- All Implemented Interfaces:
FitsElement
- Direct Known Subclasses:
CompressedImageHDU, CompressedTableHDU
-
Field Summary
Fields inherited from class BasicHDU
BITPIX_BYTE, BITPIX_DOUBLE, BITPIX_FLOAT, BITPIX_INT, BITPIX_LONG, BITPIX_SHORTModifier and TypeFieldDescriptionstatic final intDeprecated.static final intDeprecated.UseBitpix.VALUE_FOR_DOUBLEinstead.static final intDeprecated.UseBitpix.VALUE_FOR_FLOATinstead.static final intDeprecated.UseBitpix.VALUE_FOR_INTinstead.static final intDeprecated.UseBitpix.VALUE_FOR_LONGinstead.static final intDeprecated.UseBitpix.VALUE_FOR_SHORTinstead. -
Constructor Summary
ConstructorsConstructorDescriptionBinaryTableHDU(Header hdr, BinaryTable datum) Deprecated.(for internal use) Its visibility should be reduced to package level in the future. -
Method Summary
Modifier and TypeMethodDescriptionintAdd a column to the table without any associated header information.final booleanconvertToBits(int col) Converts a column from FITS logical values to bits.static BinaryTableDeprecated.(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 tablevoidinfo(PrintStream stream) Print out some information about this HDU.static booleanDeprecated.(for internal use) Will reduce visibility in the futurebooleanisHeader()Deprecated.(for internal use) Will reduce visibility in the futurestatic booleanDeprecated.(for internal use) Will reduce visibility in the futurestatic BinaryTablemanufactureData(Header header) Deprecated.(for internal use) Will reduce visibility in the futurestatic HeadermanufactureHeader(Data data) Deprecated.(for internal use) Will reduce visibility in the futurevoidsetColumnName(int index, String name, String comment) Sets the name / ID of a specific column in this table.booleansetComplexColumn(int index) Convert a column in the table to complex.static BinaryTableHDUwrap(BinaryTable tab) Wraps the specified table in an HDU, creating a header for it with the essential table description.voidwrite(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 TableHDU
addRow, deleteColumnsIndexOne, deleteColumnsIndexOne, deleteColumnsIndexZero, deleteColumnsIndexZero, deleteRows, deleteRows, findColumn, getColumn, getColumn, getColumnFormat, getColumnMeta, getColumnMeta, getColumnName, getColumns, getDefaultColumnName, getElement, getNCols, getNRows, getRow, setColumn, setColumn, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setCurrentColumn, setCurrentColumn, setElement, setRowModifier and TypeMethodDescriptionintAdd a row to the end of the table.voiddeleteColumnsIndexOne(int column, int len) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to useTableData.deleteColumns(int, int)to edit tables before wrapping them in an HDU and editing the header as necessary to incorporate custom entries.voiddeleteColumnsIndexOne(int column, int len, String[] fields) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to useTableData.deleteColumns(int, int)to edit tables before wrapping them in an HDU and editing the header as necessary to incorporate custom entries.voiddeleteColumnsIndexZero(int column, int len) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to useTableData.deleteColumns(int, int)to edit tables before wrapping them in an HDU and editing the header as necessary to incorporate custom entries.voiddeleteColumnsIndexZero(int column, int len, IFitsHeader[] fields) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to useTableData.deleteColumns(int, int)to edit tables before wrapping them in an HDU and editing the header as necessary to incorporate custom entries.voiddeleteRows(int row) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to useTableData.deleteRows(int, int)to edit tables before wrapping them in an HDU and editing the header as necessary to incorporate custom entries.voiddeleteRows(int firstRow, int nRow) Deprecated.It is not entirely foolproof for keeping the header in sync -- it is better to useTableData.deleteRows(int, int)to edit tables before wrapping them in an HDU and editing the header as necessary to incorporate custom entries.intfindColumn(String colName) Find the 0-based column index corresponding to a particular column name.getColumn(int col) Returns the data for a particular column in as an array of elements.Returns the data for a particular column in as an array of elements.getColumnFormat(int index0) Get the FITS type of a column in the table.getColumnMeta(int index0, String keyBase) Convenience method for getting column metadata, as a string.getColumnMeta(int index0, IFitsHeader keyBase) Convenience method for getting column metadata, as a string.getColumnName(int index0) Gets the name of a column in the table, as it appears in this HDU's header.Object[]Returns the data for all columns in as an array.static StringgetDefaultColumnName(int col) Returns the default name for a columns with the specified index, to use if no column name was explicitly definedgetElement(int row, int col) Returns a specific element from this tableintgetNCols()Get the number of columns for this tableintgetNRows()Get the number of rows for this tableObject[]getRow(int row) Returns a specific row from this tablevoidUpdate a column within a table.voidUpdate a column within a table.voidsetColumnMeta(int index0, String key, Boolean value, String comment, boolean after) Specify column metadata for a given column in a way that allows all of the column metadata for a given column to be organized together.voidsetColumnMeta(int index0, String key, Number value, int precision, String comment, boolean after) Specify column metadata for a given column in a way that allows all of the column metadata for a given column to be organized together.voidsetColumnMeta(int index0, String key, Number value, String comment, boolean after) Specify column metadata for a given column in a way that allows all of the column metadata for a given column to be organized together.voidsetColumnMeta(int index0, String key, String value, String comment) Specify column metadata for a given column in a way that allows all of the column metadata for a given column to be organized together.voidsetColumnMeta(int index0, String key, String value, String comment, boolean after) voidsetColumnMeta(int index0, IFitsHeader key, Number value, String comment, boolean after) Specify column metadata for a given column in a way that allows all of the column metadata for a given column to be organized together.voidsetColumnMeta(int index0, IFitsHeader key, String value, String comment, boolean after) Specify column metadata for a given column in a way that allows all of the column metadata for a given column to be organized together.voidsetCurrentColumn(int col) Deprecated.(for internal use) Will be removed int the future (no longer used).voidsetCurrentColumn(int col0, boolean after) Deprecated.(for internal use) Will have private access in the future.voidsetElement(int row, int col, Object element) Update a single element within the table.voidUpdate a row within a table.Methods inherited from class 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, verifyIntegrityModifier and TypeMethodDescriptionvoidAdd information to the header.voidAdd information to the header.voidAdd information to the header.voidAdd information to the header.voidaddValue(IFitsHeader key, boolean val) Add information to the header.voidaddValue(IFitsHeader key, double val) Add information to the header.voidaddValue(IFitsHeader key, int val) Add information to the header.voidaddValue(IFitsHeader key, String val) Add information to the header.longDeprecated.UseBasicHDU.verifyIntegrity()instead when appropriate.card(IFitsHeader key) Returns a header card builder for filling the header cards using the builder pattern.Return the name of the person who compiled the information in the data associated with this header.int[]getAxes()In FITS files the index represented by NAXIS1 is the index that changes most rapidly.Return the Bitpix enum type for this HDU.final intDeprecated.(for internal use) Will reduce visibility or remove entirely in the future.longDeprecated.This is only applicable toImageHDUorRandomGroupsHDUwith integer type data and not for other HDU or data types.doubleDeprecated.This is only applicable toImageHDUorRandomGroupsHDUwith integer type data and not for other HDU or data types.getBUnit()Deprecated.This is only applicable toImageHDUorRandomGroupsHDUand not for other HDU or data types.doublegetBZero()Deprecated.This is only applicable toImageHDUorRandomGroupsHDUwith integer type data and not for other HDU or data types.Get the FITS file creation date as aDateobject.getData()Returns the data component of this HDU.static NullDataHDUDeprecated.UseNullDataHDUinstead.doublegetEpoch()Deprecated.useBasicHDU.getEquinox()insteaddoubleGet the equinox in years for the celestial coordinate system in which positions given in either the header or data are expressed.longReturns the byte offset at which this element starts ina file.intDeprecated.Should not be exposed outside ofRandomGroupsHDU-- will reduce visibility in the future/Returns the FITS header component of this HDUGet the name of the instrument which was used to acquire the data in this FITS file.final ObjectReturns the underlying Java object (usually an array of some type) that stores the data internally.doubleReturn the minimum valid value in the array.doubleReturn the minimum valid value in the array.Get the name of the observed object in this FITS file.Get the FITS file observation date as aDateobject.Get the name of the person who acquired the data in this FITS file.Get the name of the organization which created this FITS file.intDeprecated.Should not be exposed outside ofRandomGroupsHDU-- will reduce visibility in the future.Return the citation of a reference where the data associated with this header are published.longgetSize()Returns the size of this elements in the FITS representation.longDeprecated.Not very useful, since it has no meaning other than ensuring that the checksum of the HDU yields(int) -1(that is0xffffffff) after including this value for the CHECKSUM keyword in the header.longReturns the FITS checksum for the HDU's data that is stored in the header of this HDU under theDATASUMkeyword.Get the name of the telescope which was used to acquire the data in this FITS file.getTrimmedString(String keyword) Deprecated.(for internal use) Will reduced visibility in the future.getTrimmedString(IFitsHeader keyword) Deprecated.(for internal use) Will reduced visibility in the future.voidread(ArrayDataInput stream) Read a FITS element from the input, starting at the current position.booleanreset()Reset the input stream to point to the beginning of this elementvoidrewrite()Rewrite the contents of the element in place.booleanChecks if we can write this element back to its source.voidComputes the checksums for this HDU and stores theCHECKSUMandDATASUMvalues in the header.booleanChecks that the HDUs data checksum is correct.booleanChecks the HDU's integrity, using the recorded CHECKSUM and/or DATASUM keywords if present.
-
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,TUNITnetc. 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:
trueif 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:
trueif 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:TableHDUAdd a column to the table without any associated header information.- Overrides:
addColumnin 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:BasicHDUPrint out some information about this HDU.- Specified by:
infoin 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:
trueif 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:TableHDUSets 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:
setColumnNamein classTableHDU<BinaryTable>- Parameters:
index- the 0-based 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:FitsElementWrites 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:
writein interfaceFitsElement- Overrides:
writein classBasicHDU<BinaryTable>- Parameters:
out- The data sink.- Throws:
FitsException- if the write was unsuccessful.
-
Bitpix.VALUE_FOR_BYTEinstead.