genipe.reporting package

Module contents

Submodules

genipe.reporting.autoreport module

genipe.reporting.autoreport.generate_report(out_dir, run_opts, run_info)[source]

Generate the report.

Parameters
  • out_dir (str) – the output directory for the report

  • run_opts (dict) – the run options

  • run_info (dict) – the run information

genipe.reporting.utils module

genipe.reporting.utils.colorize_time(total_seconds)[source]

Colorize the time.

Parameters

total_seconds (int) – the total number of seconds

Returns

a colorized LaTeX string representation of time

Return type

str

The time is displayed as HH:MM:SS, but insignificant zeros are grayed-out.

genipe.reporting.utils.config_jinja2()[source]

Configure the jinja2 environment for LaTeX.

Note

The configuration used is for LaTeX documents. Hence, a block command is done using \BLOCK{} and variables using \VAR{} in the Jinja2 template.

genipe.reporting.utils.create_float(template, float_type, caption, label, content, placement='H')[source]

Creates a TeX float.

Parameters
  • template (jinja2.Template) – the float template

  • float_type (str) – the type of float (figure or table)

  • caption (str) – the caption of the float

  • label (str) – the label of the float

  • content (str) – the content of the float

  • placement (str) – the float placement (e.g. H)

Returns

a string representation of a LaTeX float

Return type

str

genipe.reporting.utils.create_tabular(template, header, data, header_multicol=None, col_align=None)[source]

Creates a TeX tabular.

Parameters
  • template (jinja2.Template) – the tabular template

  • header (list) – the header of the tabular

  • data (list) – the tabular data

  • header_multicol (list) – the number of columns for the header

  • col_align (list) – the column alignement

Returns

a string representation of a LaTeX tabular

Return type

str

genipe.reporting.utils.format_tex(text, tex_format)[source]

Change the TeX text format.

Parameters
  • text (str) – the text for which the format needs to be specified

  • tex_format (str) – the format of the text to return

Returns

the formatted text

Return type

str

This will change the format by adding the LaTeX format command (e.g. from text to \texttt{text}).

Note

Only the following format are available:

  • texttt

  • emph

  • textbf

  • textit

genipe.reporting.utils.format_time(total_seconds, written_time=False)[source]

Format time (either “HH:MM:SS” or “H hours, M minutes and S seconds”.

Parameters
  • total_seconds (int) – the total number of seconds

  • written_time (bool) – whether to write time in written language

Returns

a string representation of the total time

Return type

str

If written_time is True, time will be displayed as “H hours, M minutes and S seconds”. Otherwise, the time will be represented as HH:MM:SS.

genipe.reporting.utils.sanitize_tex(original_text)[source]

Sanitize TeX text.

Parameters

original_text (str) – the text to sanitize for LaTeX

Text is sanitized by following these steps:

  1. Replaces \\ by \textbackslash

  2. Escapes certain characters (such as $, %, _, }, {, & and #) by adding a backslash (e.g. from & to \&).

  3. Replaces special characters such as ~ by the LaTeX equivalent (e.g. from ~ to $\sim$).

genipe.reporting.utils.tex_inline_math(content)[source]

Creates an inline mathematical formula in TeX.

Parameters

content (str) – the content of the mathematical formula

Returns

the formatted mathematical formula

Return type

str

The function only adds $ symbols before and after the content (e.g. from \pi to $\pi$).

genipe.reporting.utils.wrap_tex(original_text)[source]

Wraps the text.

Parameters

original_text (str) – the text to wrap

Returns

a string where the original text was wrapped

Return type

str

Wraps the text so that lines are no longer than 80 characters. Uses the str.join() function on the results of the wrap() function, so that a single string is returned.