{ } Raw JSON

bundles / astropy 7.0.1 / astropy / io / fits / hdu / table / BinTableHDU / dump

function

astropy.io.fits.hdu.table:BinTableHDU.dump

source: /astropy/io/fits/hdu/table.py :1064

Signature

def   dump ( self datafile = None cdfile = None hfile = None overwrite = False )

Summary

Dump the table HDU to a file in ASCII format. The table may be dumped in three separate files, one containing column definitions, one containing header parameters, and one for table data.

Parameters

datafile : path-like or file-like, optional

Output data file. The default is the root name of the fits file associated with this HDU appended with the extension .txt.

cdfile : path-like or file-like, optional

Output column definitions file. The default is None, no column definitions output is produced.

hfile : path-like or file-like, optional

Output header parameters file. The default is None, no header parameters output is produced.

overwrite : bool, optional

If True, overwrite the output file if it exists. Raises an OSError if False and the output file exists. Default is False.

Notes

The primary use for the dump method is to allow viewing and editing the table data and parameters in a standard text editor. The load method can be used to create a new table from the three plain text (ASCII) files.

  • datafile: Each line of the data file represents one row of table data. The data is output one column at a time in column order. If a column contains an array, each element of the column array in the current row is output before moving on to the next column. Each row ends with a new line.

    Integer data is output right-justified in a 21-character field followed by a blank. Floating point data is output right justified using 'g' format in a 21-character field with 15 digits of precision, followed by a blank. String data that does not contain whitespace is output left-justified in a field whose width matches the width specified in the TFORM header parameter for the column, followed by a blank. When the string data contains whitespace characters, the string is enclosed in quotation marks (""). For the last data element in a row, the trailing blank in the field is replaced by a new line character.

    For column data containing variable length arrays ('P' format), the array data is preceded by the string 'VLA_Length= ' and the integer length of the array for that row, left-justified in a 21-character field, followed by a blank.

    For column data representing a bit field ('X' format), each bit value in the field is output right-justified in a 21-character field as 1 (for true) or 0 (for false).

  • cdfile: Each line of the column definitions file provides the definitions for one column in the table. The line is broken up into 8, sixteen-character fields. The first field provides the column name (TTYPEn). The second field provides the column format (TFORMn). The third field provides the display format (TDISPn). The fourth field provides the physical units (TUNITn). The fifth field provides the dimensions for a multidimensional array (TDIMn). The sixth field provides the value that signifies an undefined value (TNULLn). The seventh field provides the scale factor (TSCALn). The eighth field provides the offset value (TZEROn). A field value of "" is used to represent the case where no value is provided.

  • hfile: Each line of the header parameters file provides the definition of a single HDU header card as represented by the card image.

Aliases

  • astropy.io.fits.BinTableHDU.dump