📄 fits_bintable.tex
字号:
Note that, because the entire columns were read in, the arrays A, B, and C eachhave an extra last dimension of 5. Also, the same comment inSection~\ref{creating} above about FXBCREATE and UNIT also applies to FXBOPEN.The following routines support reading FITS binary table extensions:\begin{quote}\begin{description}\item[FXBOPEN:]Opens a FITS binary table extension for reading. One can open several binarytables at once, either in the same or different files, by specifying differentvariable names for FXBOPEN to store the logical unit number into.\item[FXBREAD or FXBREADM:]Reads data from a column in a FITS binary table. One can read an entirecolumn, a range of rows within a column, or a single row and columncombination. FXBREADM can read multiple columns in a single call.\item[FXBTDIM:]Parses keywords from binary tables with a TDIM-like format. SeeSection~\ref{tdim} for more information.\item[FXBHELP:]Prints to the screen a simple table giving information about each of thecolumns in the binary table.\item[FXBFIND:]Finds the values of keywords in the header associated with the binary tablecolumns. For example, the command\begin{quote}\begin{verbatim}fxbfind, header, 'TTYPE', columns, values, n_found\end{verbatim}\end{quote}would return an array containing the values of the keywords TTYPE1, TTYPE2,etc., the columns for which they were found, and how many were found.\item[FXBCOLNUM:]Returns the column number of a FITS binary table specified either as a numberor by name.\item[FXBHEADER:]Returns the header of a FITS binary table opened with FXBOPEN. (Note that theheader can also be returned as an optional parameter of FXBOPEN.)\item[FXBISOPEN:]Returns whether or not a logical unit number points to a FITS binary table thatis open for read.\item[FXBSTATE:]Similar to FXBISOPEN, but returns a state variable denoting whether or not alogical unit number points to an open FITS binary table, and if so whether thattable is open for read or for write.\item[FXBCLOSE:]Closes a FITS binary table that had been opened with FXBOPEN.\end{description}\end{quote}\section{Modifying Existing FITS Binary Tables}After a FITS binary table extension has been written, a subsequentneed may arise to modify or augment the table. This may be requiredif, for example, new data or corrections must be overwritten in apre-existing data file. In general this is accomplished using thestandard procedures to write data to FITS columns, typically FXBWRITEor FXBWRITM. However, after a table extension has been created, it isnot possible to change its number of columns or the number of headerkeywords.Since the table has already been created, there is no need to callFXBHMAKE or FXBADDCOL again. An existing FITS table extension isopened for write access using the FXBOPEN procedure with the ACCESSkeyword.%\begin{quote}\begin{verbatim}IDL> FXBOPEN,UNIT,'sample.fits','testext',header, ACCESS='RW'\end{verbatim}\end{quote}%The keyword value \verb|'RW'| indicates that the FITS file is bothreadable and writable. [ The default is \verb|'R'|, read-only. ]After the table has be opened for writing, the FXBWRITE and/orFXBWRITM procedures should be used to modify the desired columns.Finally, FXBFINISH should be used to close the table.\section{Enlarging an Existing FITS Binary Table}After a FITS binary table has been created it may also be necessary toincrease the number of rows in the table. As mentioned above, onecannot change the number of columns. The number of rows can bechanged to the new value \verb|NEW_NROWS| by using the followingFXBGROW procedure call. . FXBGROW is safe for variable-length tables.%\begin{quote}\begin{verbatim}IDL> FXBOPEN,UNIT,'sample.fits',1,access='RW'IDL> FXBGROW,UNIT,HEADER, NEW_NROWSIDL> FXFINISH,UNIT\end{verbatim}\end{quote}%Both the header and the unit must be passed to FXBGROW because bothdisk and memory images of the header must be modified. Also, be awarethat the number of rows in the table can never decrease by callingFXBGROW.\section{Tape I/O}The following routines are for writing and reading FITS files to and from tape.Each has a menu driven interface, so that the user only has to enter the nameof the routine itself, and everything else is prompted for. Currently, theseroutines are only supported under VMS and are only available in the /obsoletedirectory of the IDL Astronomy Library\begin{quote}\begin{description}\item[FXTAPEREAD:]Reads FITS files from tape to disk. This routine is for standard FITS tapes,i.e. raw tape files separated by filemarks, with a blocking factor of \mbox{$N\times 2880$}~bytes, where $N$ is between 1 and 10. The selected files arecopied from tape to disk as a byte stream, without any conversion beingapplied.\item[FXTAPEWRITE:]Writes FITS files from disk to tape. This routine writes standard FITS tapes.Optionally a user-selected keyword can be inserted into the primary header aswritten to tape to store the filename of each FITS file. Otherwise, theselected files are copied from tape to disk as a byte stream, without anyconversion being applied.\end{description}\end{quote}\section{Multidimensional Array Facility}\label{tdim}The routines described here provide direct support for the MultidimensionalArray Facility described in C\&T\@. This convention uses keywords TDIM$n$ ofthe format\begin{quote}TDIM$n$ = '($D_1$, $D_2$, \ldots)'\end{quote}to define the dimensions associated with column $n$. For an example of the useof this keyword, see the sample binary table header in Section~\ref{creating}above.Support for this convention is automatic---FXBADDCOL inserts TDIM$n$ keywordsinto the header, and FXBOPEN interprets any found in the header---unless the/NO\_TDIM keyword is used. Values of TDIM$n$ can also be overridden with theDIMENSIONS keyword in the FXBREAD routine.In addition to the keywords described in the binary tables extension proposal,several additional keywords are supported by FXBADDCOL. These keywords have aone-to-one correspondence with standard keywords used in primary FITS headers,i.e.\begin{center}\begin{tabular}{cc}Additional Keyword & Standard Equivalent\\\hline & \\TDMIN$n$ & DATAMIN \\TDMAX$n$ & DATAMAX \\ & \\TDESC$n$ & CTYPE$m$ \\TROTA$n$ & CROTA$m$ \\TRPIX$n$ & CRPIX$m$ \\TRVAL$n$ & CRVAL$m$ \\TDELT$n$ & CDELT$m$ \\\end{tabular}\end{center}The anticipated use of these keywords is such that TDMIN$n$ and TDMAX$n$ wouldhave a ordinary FITS record format, no different from their standardequivalents, and that the rest would have a format similar to TDIM$n$.\section{Variable-Length Array Facility}These routines also support the Variable-Length Array Facility described inC\&T\@. Variable-length array columns are defined by using FXBADDCOL with the/VARIABLE keyword. Other than that, support for variable-length arrays isautomatic. Some operations, such as reading entire columns, and themultidimensional array facility described above, are not allowed withvariable-length arrays.Ordinarily, the default THEAP value \mbox{(NAXIS1 $\times$ NAXIS2)} is used towrite the variable-length arrays. However, a different THEAP value can be usedby using FXADDPAR to insert the desired value into the binary table headerbefore calling FXBCREATE.\section{IEEE Not-a-Number (NaN) Special Values}Data dropout in FITS binary table arrays are signalled in one of two ways.Dropouts in integer arrays are signalled with values specified by TNULL$n$keywords. However, dropouts in floating point arrays (including single ordouble precision, and real or complex) are signalled with standard IEEE NaN(not-a-number) special values. The routine FXBREAD will optionally translatethese NaN numbers into a user-specified value, given by the NANVALUE keyword.Conversely, the same keyword, when used with the FXWRITE or FXBWRITE routines,will write out NaN for any points in the array with the value of the NANVALUEkeyword.\section{Bit, Logical, and Double-precision Complex Arrays}Prior to V4.0, IDL did not support a data type corresponding to double-precisioncomplex (type ``M'' in FITS binary tables). Users with earlier versions ofIDL can still use these routines to read and writedouble complex as ordinary double-precision arrays with an extra firstdimension of two. Support for this is automatic when reading binary tables.Columns can be defined as type ``M'' when writing binary tables if the/DCOMPLEX keyword is passed to FXBADDCOL, and the data array is complex withthe first dimension being of size two. For users with V4.0 or later,these routines will recognize the double complex data type.Bit arrays (type ``X'' in FITS binary tables) are treated in IDL as byte arrayswith approximately 1/8th the number of elements. Support for this is automaticwhen reading binary tables. Columns can be defined as type ``X'' when writingbinary tables if the BIT keyword is passed to FXBADDCOL giving the number ofbits, and the data array is of type byte. Dimension information is ignored forbit arrays, since the dimensions apply to the bits, and not to the bytes thatIDL processes.Logical arrays (type ``L'' in FITS binary tables) are treated in IDL as bytearrays. Support for this is automatic when reading binary tables. Columns canbe defined as type ``L'' when writing binary tables if the /LOGICAL keyword ispassed to FXBADDCOL, and the data array is of type byte.\section{Virtual Columns}It is possible to treat keywords in binary table headers as if they werecolumns in the table, with the same value replicated for every row. Thisvirtual column convention allows the user to have a unified view in a tableregardless of whether the information is stored in a table column and thuscapable of varying from row to row, or stored in the header and thus the samefor every row.To use the virtual column convention, the user must call FXBREAD with the/VIRTUAL keyword, and must also reference the desired information by namerather than by column number. FXBREAD will then look first for a column withthat name. If it doesn't find one, it then looks for a keyword with that namein the header.\section{Associated routines}The remaining routines are mainly used internally by the other routinesmentioned above.\begin{quote}\begin{description}\item[FXHCLEAN:]Remove obsolete keywords---called by FXHMAKE, FXHBMAKE.\item[FXPARPOS:]Find position in FITS header---called by FXADDPAR.\item[FXBFINDLUN:]Find LUN in FXBINTABLE---called by FXBCREATE, FXBOPEN.\item[FXBPARSE:]Parse binary table header---called by FXBCREATE, FXBOPEN.\item[FXBTFORM:]Parse TFORM column descriptor---called by FXBPARSE.\item[FXHREAD:]Read FITS header---called by FXBOPEN.\item[FXFINDEND:]Find the last FITS record---called by FXBCREATE.\item[WHERENAN:]Find points equal to IEEE NaN---called by FXBREAD.\item[BOOST\_ARRAY:]Resize array, and append another array.\item[STORE\_ARRAY:]Resize array, and insert another array.\item[DETABIFY:]Removes tabs from strings.\item[PRODUCT:]Calculates total product of all elements of an array.\item[FXTPIO\_READ:]Reads a file from a tape---called from FXTAPEREAD.\item[FXTPIO\_WRITE:]Writes a file to a tape---called from FXTAPEWRITE.\end{description}\end{quote}\section{Implementation notes}The routines in this directory also make use internally of other routines fromthe SDAS, FITS, and MISC directories from the Astronomy User's Library. Insome cases these files are distributed along with the routines described here.The file ``fxbintable.pro'' is an include file containing the definition of theIDL common block FXBINTABLE. This file must be in one of the directoriespointed to by the IDL search path parameter !PATH\@. Normally, this is ensuredby keeping this file in the same directory with the IDL procedures found here.\end{document}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -