Class AsciiTableHDU
- All Implemented Interfaces:
FitsElement
ASCII table header/data unit. ASCII table HDUs were desgined for human readability, e.g. on a console, without any
special tools. However, they are far less flexible or compact than
BinaryTableHDU. As such, users are
generally discouraged from using this type of HDU to encapsulate FITS table data.
FitsFactory.setUseAsciiTables(boolean) can be toggled to adjust whether Fits.makeHDU(Object) or
similar methods should construct ASCII tables when possible. (The default setting is to produce binary tables
always.)- See Also:
-
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
ConstructorsConstructorDescriptionAsciiTableHDU(Header h, AsciiTable d) 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.static AsciiTableDeprecated.(for internal use) UseAsciiTable.fromColumnMajor(Object[])instead.voidinfo(PrintStream stream) Print out some information about this HDU.static booleanDeprecated.(for internal use) Will reduce visibility in the futurestatic booleanDeprecated.(for internal use) Will reduce visibility in the futurebooleanisNull(int row, int col) Checks if a table entry isnullstatic AsciiTablemanufactureData(Header hdr) Deprecated.(for internal use) Will reduce visibility in the futurestatic HeaderDeprecated.(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.voidsetNull(int row, int col, boolean flag) Mark an entry as null.voidsetNullString(int col, String newNull) Set the null string for a column.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, verifyIntegrity, writeModifier 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.voidwrite(ArrayDataOutput stream) 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.
-
Constructor Details
-
AsciiTableHDU
Deprecated.(for internal use) Its visibility should be reduced to package level in the future.Create an ASCII table header/data unit.- Parameters:
h- the template specifying the ASCII table.d- the FITS data structure containing the table data.
-
-
Method Details
-
encapsulate
Deprecated.(for internal use) UseAsciiTable.fromColumnMajor(Object[])instead. Will reduce visibility in the future- Parameters:
o- the array of object to create the ASCII table- Returns:
- a ASCII table data structure from an array of objects representing the columns.
- Throws:
FitsException- if the table could not be created.
-
isData
Deprecated.(for internal use) Will reduce visibility in the future- Parameters:
o- object representing the data- Returns:
- true if this data is usable as an ASCII table.
-
isHeader
Deprecated.(for internal use) Will reduce visibility in the futureCheck that this is a valid ascii table header.- Parameters:
header- to validate.- Returns:
trueif this is an ascii 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:
hdr- 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:
d- data to create a header for- Returns:
- a created header to match the input data.
- Throws:
FitsException- if the header could not b e created
-
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<AsciiTable>- 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:
-
addColumn
Description copied from class:TableHDUAdd a column to the table without any associated header information.- Overrides:
addColumnin classTableHDU<AsciiTable>- Parameters:
newCol- 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<AsciiTable>- Parameters:
stream- the printstream to write the info on
-
isNull
public boolean isNull(int row, int col) Checks if a table entry isnull- Parameters:
row- row index of the elementcol- column index of the element- Returns:
trueif the specified element isnull- See Also:
-
setNull
public void setNull(int row, int col, boolean flag) Mark an entry as null.- Parameters:
row- row index of the elementcol- column index of the elementflag- set to null or not- See Also:
-
setNullString
Set the null string for a column.- Parameters:
col- the column indexnewNull- the String representing null- Throws:
IllegalArgumentException- if the string argument contains characters that are not allowed in FITS headers. That is if it contains characters outside the range of 0x20 thru 0x7E.
-
Bitpix.VALUE_FOR_BYTEinstead.