# pyretis.inout.report package¶

This package contains methods for generating reports.

The reports will typically summarise the results from different analysis and present it as a text file, pdf or web-page.

## Package structure¶

### Modules¶

__init__.py
This file, handles imports for PyRETIS and defines a method for writing a report to a file.
markup.py (pyretis.inout.report.markup)
This module defines some methods for generating simple tables and formatting numbers for rst and latex.
report.py (pyretis.inout.report.report)
General methods for generating reports.
report_md.py (pyretis.inout.report.report_md)
This module defines the molecular dynamics reports. Specifically it defines the report that is made based on results from a MD Flux simulations.
report_path.py (pyretis.inout.report.report_path)
This module defines the reports for path simulations like TIS and RETIS.

### Important methods defined here¶

generate_report (generate_report())
Method for generating reports.

### Folders¶

templates
A folder containing templates for generating reports.

## pyretis.inout.report.markup module¶

Some common functions for generating simple tables and numbers.

This module contains some common functions for the generation of reports. The functions defined here are typically used to format numbers and generate tables for the reports.

### Important methods defined here¶

generate_rst_table (generate_rst_table())
Generate reStructuredText for a table.
generate_latex_table (generate_latex_table())
Generate latex code for a table.
latexify_number (latexify_number())
Change exponential notation into something nicer for latex.
mathexify_number (mathexify_number())
Change exponential notation into something nicer for reStructuredText.
pyretis.inout.report.markup.generate_rst_table(table, title, headings)[source]

Generate reStructuredText for a table.

This is a general function to generate a table in reStructuredText. The table is specified with a title, headings for the columns and the contents of the columns and rows.

Parameters: table (list of lists) – table[i][j] is the contents of column j of row i of the table. title (string) – The header/title for the table. headings (list of strings) – These are the headings for each table column.
pyretis.inout.report.markup.generate_latex_table(table, title, headings, fixnum=None)[source]

Generate latex code for a table.

This function will generate latex code for a table. The table is given with a title, headings for the columns and the contents of the table. For latex we might wish to make some numbers more pretty by removing exponential notation: i.e. 1.e-10 can be replaced by 1.0 \times 10^{-10} (which should render like ).

Parameters: table (list of lists) – table[i][j] is the contents of column j of row i of the table. title (string) – The header/title for the table. headings (list of strings) – These are the headings for each table column. fixnum (list/set of integers) – These integers identifies the columns where latexify_number is to be applied.
pyretis.inout.report.markup.latexify_number(str_float)[source]

Change exponential notation into something nicer for latex.

This will change exponential notation, e.g 1.2e-03, into 1.2 \times 10^{-3} for latex output which should be rendered like .

Parameters: str_float (string) – This is the string representation of a float. out – A formatted string for latex. string
pyretis.inout.report.markup.mathexify_number(str_float)[source]

Change exponential notation into something nicer for reStructuredText.

This will just call latexify_number() and put it into a math directive for reStructuredText.

Parameters: str_float (string) – This is the string representation of a float. out – A math directive for reStructuredText. string

## pyretis.inout.report.report module¶

General functions for generating reports.

This module contains some general functions for report generation. These functions are used by the specific report generators to format the reports.

### Important methods defined here¶

get_template (get_template())
Returns the template for a specific output format and report type.
render_report (render_report())
Render a report using a template and jinja2.
generate_report (generate_report())
Generate a specific report from analysis output.
pyretis.inout.report.report.get_template(output, report_type, template=None)[source]

Return the template to use for a specified output format.

The output is one of the defined output types, for instance ‘rst’ for restrucutred text or ‘latex’ for latex. Different report types will have different templates and the report types must also be specified here.

Parameters: output (string) – This string selects the output format for the template, i.e., rst, html, latex, tex. template (string, optional) – The full path to the template to use. If not given/found, the defaults in _TEMPLATES will be used. report_type (string) – This is the type of report we are doing, e.g. TIS or MD. out[1] (string) – File name of template to use. out[2] (string) – Path to the template to use.
pyretis.inout.report.report.render_report(report, output, template, path)[source]

Render a report using a template and jinja2.

The report is given as a dictionary which is used to fill in a template with jinja2. The template is given as string (a file name) with a path to the template. The output can also be specified here and this is only use to convert to HTML if that is the desired output.

Parameters: report (dict) – This dict contains the data to be reported. It is assumed that this dict matches the specified template. output (string) – This is the desired output format. Here it’s used only for generating HTML as this is done via rst. template (string) – This is the template to use (the file name). path (string) – This is the template file to use (it’s path). out[0] (string) – The generated report in the desired format. out[1] (string) – The file extension (i.e. file type) for the generated report.

Note

The parameters template and path are typically obtained by a call to get_template().

pyretis.inout.report.report.generate_report(report_type, analysis_results, output, template=None)[source]

Generate a report of a given type with the given analysis results.

Parameters: report_type (string) – Selects the kind of report we want. analysis_results (dict) – The results from running the analysis. output (string) – Output format for the report. template (string, optional) – The full path to the template to use. If not given/found, the defaults in :py:const._TEMPLATES will be used. This is handled by get_template(). out[0] (string) – This is the generated report in the desired format out[1] (string) – This is an extension which can be used when writing the report to a file.

## pyretis.inout.report.report_md module¶

Functions for generating reports.

The reports are useful for displaying results from the analysis.

### Important methods defined here¶

generate_report_mdflux (generate_report_mdflux())
Generate a report for a MD flux simulation.
pyretis.inout.report.report_md.generate_report_mdflux(analysis, output='rst')[source]

Generate a report for a MD flux simulation.

Parameters: analysis (dict) – This is the output from the analysis. output (string, optional) – This is the desired output format. It must match one of the formats defined in pyretis.inout.report.report.__TEMPLATES. Default is ‘rst’ (reStructuredText). out – The generated report as a string. dictionary

## pyretis.inout.report.report_path module¶

Method for generating reports from path sampling simulations.

The reports are useful for displaying results from the analysis.

### Important methods defined here¶

generate_report_tis (generate_report_tis())
Generate a report for the over-all results from a TIS simulation.
generate_report_tis_path (generate_report_tis_path())
Generate a report for a single TIS simulation.
generate_report_retis (generate_report_retis())
Generate a report for the over-all results from a RETIS simulation.
pyretis.inout.report.report_path.generate_report_tis(analysis, output='rst')[source]

Generate a report for the over-all results from a TIS simulation.

Parameters: analysis (dict) – This is the output from the analysis. output (string, optional) – This is the desired output format. It must match one of the formats defined in pyretis.inout.report.report._TEMPLATES. Default is ‘rst’ (reStructuredText). out[0] (string) – The generated report in the desired format. out[1] (string) – The file extension (i.e. file type) for the generated report.
pyretis.inout.report.report_path.generate_report_tis_path(analysis, output='rst')[source]

Generate a report for a single TIS simulation.

Parameters: analysis (dict) – This is the output from the analysis. output (string, optional) – This is the desired output format. It must match one of the formats defined in pyretis.inout.report.report._TEMPLATES. Default is ‘rst’ (reStructuredText). out[0] (string) – The generated report in the desired format. out[1] (string) – The file extension (i.e. file type) for the generated report.
pyretis.inout.report.report_path.generate_report_retis(analysis, output='rst')[source]

Generate a report for the over-all results from a RETIS simulation.

Parameters: analysis (dict) – This is the output from the analysis. output (string, optional) – This is the desired output format. It must match one of the formats defined in pyretis.inout.report.report._TEMPLATES. Default is ‘rst’ (reStructuredText). out[0] (string) – The generated report in the desired format. out[1] (string) – The file extension (i.e. file type) for the generated report.