BaseHeader

class astropy.io.ascii.core.BaseHeader[source] [edit on github]

Bases: object

Base table header reader

Parameters:
  • auto_format – format string for auto-generating column names
  • start_line – None, int, or a function of lines that returns None or int
  • comment – regular expression for comment lines
  • splitter_class – Splitter class for splitting data lines into 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)

Attributes Summary

auto_format str(object=’‘) -> string
colnames Return the column names of the table
comment
exclude_names
include_names
n_data_cols Return the number of expected data columns from data splitting.
names
start_line
write_spacer_lines list() -> new empty list

Methods Summary

get_col_type(col)
get_cols(lines) Initialize the header Column objects from the table lines.
get_type_map_key(col)
process_lines(lines) Generator to yield non-comment lines
write(lines)

Attributes Documentation

auto_format = 'col%d'
colnames[source]

Return the column names of the table

comment = None
exclude_names = None
include_names = None
n_data_cols

Return the number of expected data columns from data splitting. This is either explicitly set (typically for fixedwidth splitters) or set to self.names otherwise.

names = None
start_line = None
write_spacer_lines = ['ASCII_TABLE_WRITE_SPACER_LINE']

Methods Documentation

get_col_type(col)[source] [edit on github]
get_cols(lines)[source] [edit on github]

Initialize the header Column objects from the table lines.

Based on the previously set Header attributes find or create the column names. Sets self.cols with the list of Columns. This list only includes the actual requested columns after filtering by the include_names and exclude_names attributes. See self.names for the full list.

Parameters:lines – list of table lines
Returns:None
get_type_map_key(col)[source] [edit on github]
process_lines(lines)[source] [edit on github]

Generator to yield non-comment lines

write(lines)[source] [edit on github]

Page Contents