astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- ASCII Tables (`astropy.io.ascii`) »
- FixedWidthHeader

# FixedWidthHeader

class `astropy.io.ascii.fixedwidth.``FixedWidthHeader`

  Bases: `astropy.io.ascii.core.BaseHeader`

  Fixed width table header reader.

  The key settable class attributes are:

  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
  - position_line – row index of line that specifies position (default = 1)
  - position_char – character used to write the position line (default = “-”)
  - col_starts – list of start positions for each column (0-based counting)
  - col_ends – list of end positions (inclusive) for each column
  - delimiter_pad – padding around delimiter when writing (default = None)
  - bookend – put the delimiter at start and end of line when writing (default = False)

  Attributes Summary

  `position_line` |

  Methods Summary

  `get_cols`(lines) | Initialize the header Column objects from the table `lines`.
  `get_fixedwidth_params`(line) | Split `line` on the delimiter and determine column values and column start and end positions.
  `get_line`(lines, index) |
  `write`(lines) |

  Attributes Documentation

  `position_line` = None

  Methods Documentation

  `get_cols`(lines)

    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.

    Parameters: | lines – list of table lines
    Returns: | None

  `get_fixedwidth_params`(line)

    Split `line` on the delimiter and determine column values and column start and end positions. This might include null columns with zero length (e.g. for `header row = "| col1 || col2 | col3 |"` or `header2_row = "----- ------- -----"`). The null columns are stripped out. Returns the values between delimiters and the corresponding start and end positions.

    Parameters: | line – input line
    Returns: | (vals, starts, ends)

  `get_line`(lines, index)
  `write`(lines)