wolfhece.report.common ====================== .. py:module:: wolfhece.report.common Module Contents --------------- .. py:data:: wolfgpu_version :value: 'not installed' .. py:function:: pts2cm(pts) Convert points to centimeters for PyMuPDF. One point equals 1/72 inches. .. py:function:: pt2inches(pts) Convert points to inches for PyMuPDF. One point equals 1/72 inches. .. py:function:: inches2cm(inches) Convert inches to centimeters. One inch equals 2.54 centimeters. .. py:function:: cm2pts(cm) Convert centimeters to points for PyMuPDF. One point equals 1/72 inches. .. py:function:: cm2inches(cm) Convert centimeters to inches. One inch equals 2.54 centimeters. .. py:function:: A4_rect() Return the A4 rectangle in PyMuPDF units. (0, 0) is the top-left corner in PyMuPDF coordinates. .. py:function:: rect_cm(x, y, width, height) Create a rectangle in PyMuPDF units from centimeters. (0, 0) is the top-left corner in PyMuPDF coordinates. .. py:function:: get_rect_from_text(text, width, fontsize=10, padding=5) Get a rectangle that fits the text in PyMuPDF units. :param text: The text to fit in the rectangle. :param width: The width of the rectangle in centimeters. :param fontsize: The font size in points. :param padding: Padding around the text in points. :return: A PyMuPDF rectangle that fits the text. .. py:function:: list_to_html(list_items, font_size='10pt', font_family='Helvetica') .. py:function:: list_to_html_aligned(list_items, font_size='10pt', font_family='Helvetica') .. py:data:: PAGE_WIDTH :value: 21 .. py:data:: PAGE_HEIGHT :value: 29.7 .. py:data:: SLIDE_HEIGHT :value: 19.05 .. py:data:: SLIDE_WIDTH :value: 33.866582 .. py:class:: 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) Bases: :py:obj:`wolfhece.PyVertexvectors.Zones` .. autoapi-inheritance-diagram:: wolfhece.report.common.DefaultLayoutA4 :parts: 1 :private-bases: Enum for default layout options. .. py:attribute:: title .. py:attribute:: left_right_margin :value: 1 .. py:attribute:: top_bottom_margin :value: 0.5 .. py:attribute:: padding :value: 0.5 .. py:attribute:: _layout .. py:attribute:: _doc :value: None .. py:attribute:: _pdf_path :value: None .. py:method:: add_element(name: str, width: float, height: float, x: float = 0, y: float = 0) -> wolfhece.PyVertexvectors.vector Add an element to the layout. .. py:method:: 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 .. py:method:: check_if_overlap(vec: wolfhece.PyVertexvectors.vector) -> bool Check if the vector overlaps with any existing vector in the layout. .. py:property:: useful_part :type: wolfhece.PyVertexvectors.vector Get the useful part of the page, excluding margins. .. py:property:: page_dimension :type: tuple[float, float] Get the dimensions of the page in centimeters. .. py:property:: keys :type: list[str] Get the keys of the layout. .. py:method:: to_dict() Convert the layout Zones to a dictionary. .. py:method:: plot(scale=1.0) Plot the layout using matplotlib. :param scale: Scale factor for the plot. .. py:method:: _create_layout_pdf() -> dict Create the layout dictionary for the report. :return: A dictionary with layout information. .. py:method:: _summary_versions() Find the versions of the simulation, wolfhece and the wolfgpu package .. py:method:: _insert_to_page(page: pymupdf.Page) .. py:method:: create_report() -> pymupdf.Document Create the PDF report for the default LayoutA4. .. py:method:: save_report(output_path: pathlib.Path | str) Save the report to a PDF file .. py:property:: pdf_path Return the PDF document