bundles / astropy 7.0.1 / astropy / io / fits / convenience / tabledump
function
astropy.io.fits.convenience:tabledump
source: /astropy/io/fits/convenience.py :949
Signature
def tabledump ( filename , datafile = None , cdfile = None , hfile = None , ext = 1 , overwrite = False ) Summary
Dump a 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
filename: path-like or file-likeInput fits file.
datafile: path-like or file-like, optionalOutput data file. The default is the root name of the input fits file appended with an underscore, followed by the extension number (ext), followed by the extension
.txt.cdfile: path-like or file-like, optionalOutput column definitions file. The default is
None, no column definitions output is produced.hfile: path-like or file-like, optionalOutput header parameters file. The default is
None, no header parameters output is produced.ext: intThe number of the extension containing the table HDU to be dumped.
overwrite: bool, optionalIf
True, overwrite the output file if it exists. Raises anOSErrorifFalseand the output file exists. Default isFalse.
Notes
The primary use for the tabledump function is to allow editing in a standard text editor of the table data and parameters. The tableload function can be used to reassemble the table from the three 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
TFORMheader 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.tabledump