Bases: object
Class providing methods to read and write an ASCII table using the specified header, data, inputter, and outputter instances.
Typical usage is to instantiate a Reader() object and customize the header, data, inputter, and outputter attributes. Each of these is an object of the corresponding class.
There is one method inconsistent_handler that can be used to customize the behavior of read() in the event that a data row doesn’t match the header. The default behavior is to raise an InconsistentTableError.
Attributes Summary
comment_lines | Return lines in the table that match header.comment regexp |
exclude_names | |
include_names | |
names | |
strict_names | bool(x) -> bool |
Methods Summary
inconsistent_handler(str_vals, ncols) | Adjust or skip data entries if a row is inconsistent with the header. |
read(table) | Read the table and return the results in a format determined by the outputter attribute. |
write(table) | Write table as list of strings. |
Attributes Documentation
Return lines in the table that match header.comment regexp
Methods Documentation
Adjust or skip data entries if a row is inconsistent with the header.
The default implementation does no adjustment, and hence will always trigger an exception in read() any time the number of data entries does not match the header.
Note that this will not be called if the row already matches the header.
Parameters: |
|
---|---|
Returns: | list of strings to be parsed into data entries in the output table. If the length of this list does not match ncols, an exception will be raised in read(). Can also be None, in which case the row will be skipped. |
Read the table and return the results in a format determined by the outputter attribute.
The table parameter is any string or object that can be processed by the instance inputter. For the base Inputter class table can be one of:
Parameters: | table – table input |
---|---|
Returns: | output table |
Write table as list of strings.
Parameters: | table – input table data (astropy.table.Table object) |
---|---|
Returns: | list of strings corresponding to ASCII table |