Welcome to Leopard’s documentation!¶
Indices and tables¶
Module documentation¶
Module for laboratory reporting.
Containers data and interpretations together and then streamlines it to different output formats.
-
class
leopard.
Report
(title, intro='', conclusion='', outname='', outfile=None, author=None, addTime=True, makeDir=False)[source]¶ Contains as main attribute a list of sections. Defines methods of outputting the sections. outfile should not include a final extension, as that is determined by the different output methods.
-
static
getReportTable
(reportzipfile, tablefilename, inReportsDir=True, verbose=False)[source]¶ Get a pandas table from a previous report
Parameters: - reportzipfile (str) – Zip folder location, ‘.zip’ extension is optional.
- tablefilename (str or list int) – Table location within the zip folder. Can be provided as the filename within the zip folder, or a list of integers indicating its exact position (1-indexed). If you provide an empty string or list, all available table filenames in the zip folder will be printed.
- inReportsDir (bool) – Search reportzipfile relative to reportsDir.
Returns: pd.DataFrame
-
static
-
class
leopard.
Section
(title, text, figures=None, tables=None, subsections=None, code=None, tablehead=None, tablecolumns=None, clearpage=False)[source]¶ Report sections. Defines methods dealing with the structure of sections, and section specific output.
tablehead => set to integer to only show DataFrame.head(tablehead) rows in this section
For adding subsections, a method is provided.
-
append
(*args, toSection=None, **kwargs)[source]¶ Append a new section If toSection is None, section is appended to the main section/subs list. Else if toSection is int or (int,int,…), it gets added to the subs (subsection) list of the specified section.
args and kwargs are processed by Section class initiation
-
static
sectionFromFunction
(function, *args, **kwargs)[source]¶ This staticmethod executes the function that is passed with the provided args and kwargs. The first line of the function docstring is used as the section title, the comments within the function body are parsed and added as the section text. The function should return an ordered dict of figures and tables, that are then attached to the section.
Parameters: function (function) – The function that generates the section content. Returns: Section >>> # Section title of example function ... def exampleFunction(a,b=None): ... 'Mock figures and tables included' ... figures = (('fig1',Mock()),('fig2',Mock())) ... tables = (('tab1',Mock()),('tab2',Mock())) ... return figures, tables >>> Section.sectionFromFunction(exampleFunction,Mock(),b=Mock()) <Section @ Section title of example function>
-
Leopard utility functions and classes
-
class
leopard.utils.
FigureDict
(*args, section=None, **kwds)[source]¶ Connects the report section to the dict Currently not used!
-
class
leopard.utils.
LeopardDict
[source]¶ Leopard Dictionary
Ordered dictionary that only allows string keys. Integers can be used to query the dict instead of the string key.