wolfhece.report.common

Module Contents

wolfhece.report.common.wolfgpu_version = 'not installed'[source]
wolfhece.report.common.pts2cm(pts)[source]

Convert points to centimeters for PyMuPDF.

One point equals 1/72 inches.

wolfhece.report.common.pt2inches(pts)[source]

Convert points to inches for PyMuPDF.

One point equals 1/72 inches.

wolfhece.report.common.inches2cm(inches)[source]

Convert inches to centimeters.

One inch equals 2.54 centimeters.

wolfhece.report.common.cm2pts(cm)[source]

Convert centimeters to points for PyMuPDF.

One point equals 1/72 inches.

wolfhece.report.common.cm2inches(cm)[source]

Convert centimeters to inches.

One inch equals 2.54 centimeters.

wolfhece.report.common.A4_rect()[source]

Return the A4 rectangle in PyMuPDF units.

(0, 0) is the top-left corner in PyMuPDF coordinates.

wolfhece.report.common.rect_cm(x, y, width, height)[source]

Create a rectangle in PyMuPDF units from centimeters.

(0, 0) is the top-left corner in PyMuPDF coordinates.

wolfhece.report.common.get_rect_from_text(text, width, fontsize=10, padding=5)[source]

Get a rectangle that fits the text in PyMuPDF units.

Parameters:
  • text – The text to fit in the rectangle.

  • width – The width of the rectangle in centimeters.

  • fontsize – The font size in points.

  • padding – Padding around the text in points.

Returns:

A PyMuPDF rectangle that fits the text.

wolfhece.report.common.list_to_html(list_items, font_size='10pt', font_family='Helvetica')[source]
wolfhece.report.common.list_to_html_aligned(list_items, font_size='10pt', font_family='Helvetica')[source]
wolfhece.report.common.PAGE_WIDTH = 21[source]
wolfhece.report.common.PAGE_HEIGHT = 29.7[source]
wolfhece.report.common.SLIDE_HEIGHT = 19.05[source]
wolfhece.report.common.SLIDE_WIDTH = 33.866582[source]
class wolfhece.report.common.DefaultLayoutA4(title: str, filename='', ox=0, oy=0, tx=0, ty=0, parent=None, is2D=True, idx='', plotted=True, mapviewer=None, need_for_wx=False, bbox=None, find_minmax=True, shared=False, colors=None)[source]

Bases: wolfhece.PyVertexvectors.Zones

Inheritance diagram of wolfhece.report.common.DefaultLayoutA4

Enum for default layout options.

title[source]
left_right_margin = 1[source]
top_bottom_margin = 0.5[source]
padding = 0.5[source]
_layout[source]
_doc = None[source]
_pdf_path = None[source]
add_element(name: str, width: float, height: float, x: float = 0, y: float = 0) wolfhece.PyVertexvectors.vector[source]

Add an element to the layout.

add_element_repeated(name: str, width: float, height: float, first_x: float = 0, first_y: float = 0, count_x: int = 1, count_y: int = 1, padding: float = None) wolfhece.PyVertexvectors.zone[source]
check_if_overlap(vec: wolfhece.PyVertexvectors.vector) bool[source]

Check if the vector overlaps with any existing vector in the layout.

property useful_part: wolfhece.PyVertexvectors.vector[source]

Get the useful part of the page, excluding margins.

property page_dimension: tuple[float, float][source]

Get the dimensions of the page in centimeters.

property keys: list[str][source]

Get the keys of the layout.

to_dict()[source]

Convert the layout Zones to a dictionary.

plot(scale=1.0)[source]

Plot the layout using matplotlib. :param scale: Scale factor for the plot.

_create_layout_pdf() dict[source]

Create the layout dictionary for the report. :return: A dictionary with layout information.

_summary_versions()[source]

Find the versions of the simulation, wolfhece and the wolfgpu package

_insert_to_page(page: pymupdf.Page)[source]
create_report() pymupdf.Document[source]

Create the PDF report for the default LayoutA4.

save_report(output_path: pathlib.Path | str)[source]

Save the report to a PDF file

property pdf_path[source]

Return the PDF document