Package glue :: Package ligolw :: Package utils :: Module print_tables
[hide private]
[frames] | no frames]

Module print_tables

source code

A collection of utilities to convert xml-tables to other formats, such as wiki or html.


Version: 8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5

Date: 2017-12-05 15:29:36 +0000

Author: Collin Capano <cdcapano@ligo.caltech.edu>

Functions [hide private]
 
format_cell(val, round_floats=False, decimal_places=2, format_links=False, hlx='', hxl='', xhl='')
Applys smart_round and format_hyperlink to values in a cell if desired.
source code
 
format_header_cell(val)
Formats given header column.
source code
 
format_hyperlink(val, hlx, hxl, xhl)
Formats an html hyperlink into other forms.
source code
 
get_row_data(row, column_name, cat_time_ns=True)
Retrieves the requested column's data from the given row.
source code
 
print_tables(xmldoc, output, output_format, tableList=[], columnList=[], round_floats=True, decimal_places=2, format_links=True, title=None, print_table_names=True, unique_rows=False, row_span_columns=[], rspan_break_columns=[])
Method to print tables in an xml file in other formats.
source code
 
set_output_format(output_format)
Sets output format; returns standard bits of table.
source code
 
smart_round(val, decimal_places=2)
For floats >= 10.**-(decimal_places - 1), rounds off to the valber of decimal places specified.
source code
Variables [hide private]
  __package__ = 'glue.ligolw.utils'
Function Details [hide private]

format_header_cell(val)

source code 

Formats given header column. This involves changing '_Px_' to '(', '_xP_' to ')' and all other '_' to spaces.

format_hyperlink(val, hlx, hxl, xhl)

source code 

Formats an html hyperlink into other forms.

@hlx, hxl, xhl: values returned by set_output_format

print_tables(xmldoc, output, output_format, tableList=[], columnList=[], round_floats=True, decimal_places=2, format_links=True, title=None, print_table_names=True, unique_rows=False, row_span_columns=[], rspan_break_columns=[])

source code 

Method to print tables in an xml file in other formats. Input is an xmldoc, output is a file object containing the tables.

set_output_format(output_format)

source code 

Sets output format; returns standard bits of table. These are:
    ttx: how to start a title for a set of tables
    xtt: how to end a title for a set of tables
    tx: how to start a table
    xt: how to close a table
    capx: how to start a caption for the table
    xcap: how to close a caption for the table
    rx: how to start a row and the first cell in the row
    xr: how to close a row and the last cell in the row
    rspx: how to start a cell with a row span argument
    xrsp: how to close the row span argument
    cx: how to open a cell
    xc: how to close a cell

smart_round(val, decimal_places=2)

source code 

For floats >= 10.**-(decimal_places - 1), rounds off to the valber of decimal places specified. For floats < 10.**-(decimal_places - 1), puts in exponential form then rounds off to the decimal places specified.