pyGenClean.LaTeX package

Submodules

pyGenClean.LaTeX.auto_report module

pyGenClean.LaTeX.auto_report.create_report(outdirname, report_filename, **kwargs)[source]

Creates a LaTeX report.

Parameters:
  • report_filename (str) – the name of the file.
  • outdirname (str) – the name of the output directory.

pyGenClean.LaTeX.merge_reports module

exception pyGenClean.LaTeX.merge_reports.ProgramError(msg)[source]

Bases: exceptions.Exception

An Exception raised in case of a problem.

Parameters:msg (str) – the message to print to the user before exiting.
pyGenClean.LaTeX.merge_reports.add_custom_options(parser)[source]

Adds custom options to a parser.

Parameters:parser (argparse.ArgumentParser) – the parser to which to add options.
pyGenClean.LaTeX.merge_reports.checkArgs(args)[source]

Checks the arguments and options.

Parameters:args (argparse.Namespace) – an object containing the options of the program.
Returns:True if everything was OK.

If there is a problem with an option, an exception is raised using the ProgramError class, a message is printed to the sys.stderr and the program exists with code 1.

pyGenClean.LaTeX.merge_reports.copy_initial_files(filename, out_dir)[source]

Copy the initial_files file to the final directory.

Parameters:
  • filename – the name of the file.
  • out_dir (str) – the name of the output directory
pyGenClean.LaTeX.merge_reports.generate_report(out_dir, latex_summaries, nb_markers, nb_samples, options)[source]

Generates the report.

Parameters:
  • out_dir (str) – the output directory.
  • latex_summaries (list) – the list of LaTeX summaries.
  • nb_markers (str) – the final number of markers.
  • nb_samples (str) – the final number of samples.
  • options (argparse.Namespace) – the list of options.
pyGenClean.LaTeX.merge_reports.get_final_numbers(filename, out_dir)[source]

Copy the final_files file and get the number of markers and samples.

Parameters:
  • filename (str) – the name of the file.
  • out_dir (str) – the output directory.
Returns:

the final number of markers and samples

Return type:

tuple

pyGenClean.LaTeX.merge_reports.get_summary_files(dirnames)[source]

Gets the TeX summary files for each test.

Parameters:dirnames (list) – the list of directories to merge data from.
Returns:a list of summary file names.
Return type:list
pyGenClean.LaTeX.merge_reports.main(argString=None)[source]

The main function of this module.

Parameters:argString (list of strings) – the options.
pyGenClean.LaTeX.merge_reports.merge_required_files(dirnames, out_dir)[source]

Merges the required files from each of the directories.

Parameters:
  • dirnames (list) – the list of directories to merge data from.
  • out_dir (str) – the name of the output directory.
pyGenClean.LaTeX.merge_reports.order_qc_dir(dirnames)[source]

Order the QC directory names according to their date.

Parameters:dirnames (list) – the list of directories to merge data from.
Returns:the sorted list of directories
Return type:list
pyGenClean.LaTeX.merge_reports.parseArgs(argString=None)[source]

Parses the command line options and arguments.

Parameters:argString (list of strings) – the options.
Returns:A argparse.Namespace object created by the argparse module. It contains the values of the different options.
Options Type Description
--report-author String The current project number.
--report-number String The current project author.
--report-background String Text of file containing the background section of the report.

Note

No option check is done here (except for the one automatically done by argparse). Those need to be done elsewhere (see checkArgs()).

pyGenClean.LaTeX.merge_reports.safe_main()[source]

A safe version of the main function (that catches ProgramError).

pyGenClean.LaTeX.utils module

pyGenClean.LaTeX.utils.bib_entry(**kwargs)[source]

Creates a bibliography entry.

Parameters:
  • name (str) – the name of the entry.
  • authors (str) – the authors.
  • title (str) – the title.
  • journal (str) – the journal.
  • year (str) – the year.
  • volume (str) – the volume.
  • number (str) – the number.
  • pages (str) – the pages.
Returns:

a bib entry.

pyGenClean.LaTeX.utils.format_numbers(number, prefix='')[source]

Formats number in the scientific notation for LaTeX.

Parameters:
  • number (str) – the number to format.
  • prefix (str) – a prefix to add before the number (e.g. “p < ”).
Returns:

a string containing the scientific notation of the number.

Return type:

str

pyGenClean.LaTeX.utils.inline_math(text)[source]

Creates an inline mathematical formula.

pyGenClean.LaTeX.utils.item(text)[source]

Returns an LaTeX item (for enumerate or itemize).

Parameters:text (str) – the text.
Returns:a LaTeX item.
pyGenClean.LaTeX.utils.sanitize_fig_name(name)[source]

Sanitizes the name of a file (for including graphics in LaTeX).

Parameters:name (str) – the name of the file to sanitize.
Returns:the sanitized name.

For example, if the name of the graphic file is test.1.png, the sanitized version of it for LaTeX is {test.1}.png.

pyGenClean.LaTeX.utils.sanitize_tex(original_text)[source]

Sanitize TeX text.

Parameters:original_text (str) – the text to sanitize for LaTeX.
Returns:the sanitize text.

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$).
pyGenClean.LaTeX.utils.section(name)[source]

Creates a new section in LaTeX.

Parameters:name (str) – the name of the new section.
Returns:a LaTeX string containing a new section.
Return type:str
pyGenClean.LaTeX.utils.subsection(name)[source]

Creates a new section in LaTeX.

Parameters:name (str) – the name of the new section.
Returns:a LaTeX string containing a new section.
Return type:str
pyGenClean.LaTeX.utils.textbf(text)[source]

Returns bold font.

Parameters:text (str) – the text.
Returns:an bold font.
pyGenClean.LaTeX.utils.textit(text)[source]

Returns italic font.

Parameters:text (str) – the text.
Returns:an italic font.
pyGenClean.LaTeX.utils.texttt(text)[source]

Returns type writer font.

Parameters:text (str) – the text.
Returns:a type writer font.
pyGenClean.LaTeX.utils.wrap_lines(content, length=80)[source]

Wraps long lines to a maximum length of 80.

Parameters:
  • content (str) – the content to wrap.
  • legnth – the maximum length to wrap the content.
Returns:

a string containing the wrapped content.

Return type:

str

Module contents