Note
There are probably as many ASCII table formats as astronomers (if not more). These generally store a single table, and can sometimes include meta-data.
Reading ASCII tables is supported thanks to the asciitable module, which makes it easy to read in arbitrary ASCII files.
By default, several pre-defined formats are available. These include CDS tables (also called Machine-Readable tables), DAOPhot tables, and RDB tables. To read these formats, simply use:
>>> t = atpy.Table('table.mrt', type='mrt')
>>> t = atpy.Table('table.cds', type='cds')
>>> t = atpy.Table('table.phot', type='daophot')
>>> t = atpy.Table('table.rdb', type='rdb')
The type= argument is optional for these formats, if they have appropriate file extensions, but due to the large number of ASCII file formats, it is safer to include it.
ATpy also allows full access to asciitable. If the type='ascii' argument is specified in Table(), all arguments are passed to asciitable.read, and the result is automatically stored in the ATpy Table instance. For more information on the arguments available in asciitable.read, see here.
Note
As for all file formats, the verbose argument can be specified to control whether warning messages are shown when reading (the default is verbose=True), and the overwrite argument can be used when writing to overwrite a file (the default is overwrite=False).
Note
The following functions should not be called directly - the arguments should be passed to Table()/Table.read().
Read data from a CDS table (also called Machine Readable Tables) file
Required Arguments:
- filename: [ string ]
- The file to read the table from
Keyword Arguments are passed to astropy.io.ascii
Read data from a DAOphot table
Required Arguments:
- filename: [ string ]
- The file to read the table from
Keyword Arguments are passed to astropy.io.ascii
Read data from an RDB table
Required Arguments:
- filename: [ string ]
- The file to read the table from
Keyword Arguments are passed to astropy.io.ascii
Read a table from an ASCII file using astropy.io.ascii
Optional Keyword Arguments:
Reader - Reader class (default= BasicReader ) Inputter - Inputter class delimiter - column delimiter string comment - regular expression defining a comment line in table quotechar - one-character string to quote fields containing special characters header_start - line index for the header line not counting comment lines data_start - line index for the start of data not counting comment lines data_end - line index for the end of data (can be negative to count from end) converters - dict of converters data_Splitter - Splitter class to split data columns header_Splitter - Splitter class to split header columns names - list of names corresponding to each data column include_names - list of names to include in output (default=None selects all names) exclude_names - list of names to exlude from output (applied after include_names)
Note that the Outputter argument is not passed to astropy.io.ascii.
See the astropy.io.ascii documentation at http://docs.astropy.org/en/latest/io/ascii/index.html for more details.
Read a table from an ASCII file using astropy.io.ascii
Optional Keyword Arguments:
Writer - Writer class (default= Basic) delimiter - column delimiter string write_comment - string defining a comment line in table quotechar - one-character string to quote fields containing special characters formats - dict of format specifiers or formatting functions names - list of names corresponding to each data column include_names - list of names to include in output (default=None selects all names) exclude_names - list of names to exlude from output (applied after include_names)
See the astropy.io.ascii documentation at http://docs.astropy.org/en/latest/io/ascii/index.html for more details.