Report Module

This module can be used to generate a test results report (in pdf format) using LaTeX.

report

class emva1288.report.report.Report1288(outdir, setup=None, basic=None, marketing=None, cover_page=False)[source]

Bases: object

Class that has the purpose of creating a pdf report of one or more optical tests. This class only creates the report TeX files using the templates. TeX files must be compiled afterwards to generate the pdf files.

__init__(outdir, setup=None, basic=None, marketing=None, cover_page=False)[source]

Report generator init method.

Informations stored in the report can be specified by the kwargs passed to the object. It can be useful to use the info_marketing(), info_setup() and info_basic() functions to generate the corresponding dictionaries. The report generator uses jinja2 to render the templates. Upon init, it calls the template_renderer() method to get the jinja2 object that will interact with the templates. Then it creates the output directories and files that will contain the output files. To create the report for different operating point/tests, one must call the add() method to add each test he wants to publish in the report. Then, to conclude the report, he must call the latex() method to generate the TeX files.

Parameters:
  • outdir (str) – The path to the directory that will contain the report files.

  • setup (dict, optional) – A dictionary containing the setup informations. If None, the report uses the dictionary of the info_setup() function.

  • basic (dict, optional) – A dictionary containing basic informations about the test. If None, the report generator takes the dictionary from the info_basic() function.

  • marketing (dict, optional) – A dictionary containing

  • cover_page (str, optional) – The path to the cover page for the report. If False, no cover page will be included in the report.

add(op, data, results=None)[source]

Method that adds an operation point to the report.

The data supplied are passed through a Results1288 object to be processed for the report. Also creates the plots which will appears in the report.

Parameters:
  • op (dict) – The dictionary containing the operation point informations. This dictionary must absolutely contain a ‘name’ key. See the info_op() function to get an idea to what keys to give.

  • data (dict) – The corresponding operation point data. It must be able to be processed by an instance of the Results1288 class.

latex()[source]

Generate report latex files.

static template_renderer(dirname=None)[source]

Method that creates the renderer for the TeX report file.

Uses the jinja2:jinja2.Environment object to create the renderer. Also defines some filters for the environment for the missing numbers and general missings.

Parameters:

dirname (str, optional) – The path to the template directory containing the TeX templates. If None, it will get the templates from the ./templates/ directory.

Return type:

The renderer.

emva1288.report.report.info_basic(**kwargs)[source]

Container for basic information.

All kwargs are used to update the basic information dictionary for the report.

Returns:

  • dict (A dictionary containing basic informations for the report.)

  • The keys are

    • ‘vendor’ : The vendor name that manufactures the camera.

    • ’model’ : The model of the tested camera.

    • ’data_type’ : The label given to the data used for the test.

    • ’sensor_type’: The type of the tested sensor within the camera.

    • ’sensor_diagonal’ : The number of pixel in the sensor diagonal.

    • ’lens_category’ : The lens category used for the test.

    • ’resolution’ : The camera’s resolution.

    • ’pixel_size’ : The sensor’s pixel size.

    • ’readout_type’ : The readout type of the sensor (for CCD sensors).

    • ’transfer_type’ : The transfer type of the sensor (for CCDs).

    • ’shutter_type’ : The shutter type of the sensor (for CMOS sensors).

    • ’overlap_capabilities’ : The overlap capabilities of the sensor (for CMOS sensors).

    • ’maximum_readout_rate’ : The camera’s maximal readout rate.

    • ’dark_current_compensation’ : If the camera support dark current compensation, specify it in this entry.

    • ’interface_type’ : The camera’s interface type.

    • ’qe_plot’ : The sensor’s quantum efficency plots.

emva1288.report.report.info_marketing(**kwargs)[source]

Container for marketing informations.

All kwargs are used to update the returned dictionary containing the marketing informations.

Returns:

  • dict (A dictionary containing the marketing informations.)

  • The keys are

    • ‘logo’ : The path to the logo icon.

    • ’watermark’ : A text that will be printed on every page of the report in the background in transparent red.

    • ’missingplot’ : The path to a missing plot icon.

    • ’cover_page’ : The path to a custom cover page for the report.

emva1288.report.report.info_op()[source]

Container for operation points informations.

The returned dictionary must be filled after calling this function.

Returns:

dict

  • ‘name’ : The test name.

  • ’id’ : The test id.

  • ’summary_only’ : True or False, tells if, for a specific OP, the report should do a summary of the test instead of a full description.

  • ’results’ : The results of the test.

  • ’camera_settings’ : (OrderedDict) the dictionary of the camera’s settings for the test.

  • ’test_parameters’ : (OrderedDict) the dictionary of the other test parameters.

Return type:

An empty dictionary with the following keys:

emva1288.report.report.info_setup(**kwargs)[source]

Container for setup information.

All kwargs are used to update the setup information dictionary.

Returns:

  • dict (A dictionary containing setup informations.)

  • The keys are

    • ‘Light source’ : The light source type (e.g. integrating sphere).

    • ’Light source non uniformity’ : The light source introducing non uniformity.

    • ’Irradiation calibration accuracy’ : The irradiation calibration incertainty.

    • ’Irradiation measurement error’ : The irradiation measurement incertainty.

    • ’Standard version’ : The EMVA1288 standard version number used.