printtable

Tabular output.

class mr_utils.utils.printtable.Table(headings, widths, formatters=None, pad=2, symbol='#')[source]

Table with header and columns. Nothing fancy.

Class meant for simple column printing, e.g., printing updates for each iteration of an iterative algorithm.

headings

List of strings giving column labels.

Type:list
symbol

Character to use as separator between header and table rows.

Type:str
pad

Number of spaces between columns.

Type:int
widths

List of widths for each column in number of characters.

Type:int or list
formatters

String formatters, will use %g if None is given.

Type:list
header()[source]

Return table header.

Returns:hdr – Table header.
Return type:str
row(vals)[source]

Return row of table.

Parameters:vals (list) – List of numbers corresponding to display for each row.
Returns:line – The row.
Return type:str