tcutility.report package#
Subpackages#
Submodules#
tcutility.report.character module#
- get_pixel_width(character, font='calibri', font_size=11)[source]#
Get the pixel width of a character for a given font and font-size. For this we need to interpolate the pixel width between two reference values. In the _char_widths.txt file you will find for each font a set of character pixel widths for font-size 1. We then simply multiply the 1-width value by the desired value to get the correct pixel width. See
- Parameters:
character (
str
) – the character to get the pixel width for.font (
str
) – the font family that is used.font_size (
float
) – the font-size to get the pixel width at.
- Return type:
float
- text_width(text, font='calibri', font_size=11, mode='pixels')[source]#
Get the width of a string for a given font and font size.
- Parameters:
text (
str
) – the object to determine the length for. Will be cast to a string before calculating width.font (
str
) – the font family that is used.font_size (
float
) – the font-size to get the pixel width at.mode (
str
) – the width-mode. Can be ‘excel’ or ‘pixels’.
- Return type:
float
- Returns:
The width of the text for a certain font and font size. If mode is ‘excel’ we pad it with 8 pixels and then divide by 7.6 (i.e. standard excel char width).
tcutility.report.figure_resizer module#
This module is used for resizing pictures containing molecules.
- resize(img_paths, circle_numbers=None, padding=0)[source]#
The main function for this module. Takes a directory d and selected circles and resizes and moves images in order to produce new aligned images.
- Parameters:
d – the directory to take images from.
circle_numbers (
Optional
[Dict
]) – a dictionary containing the image names as keys and circle indices as the values. The new images will be aligned based on these selected circles.padding (
Union
[str
,int
,float
]) – the amount of padding to add to the new images. If given an integer, it adds padding number of pixels. Alternatively a string consisting of a number and a % sign can be given to add relative padding. E.g. padding=’10%’ will add a 10% padding to the images.
tcutility.report.report module#
- class DocxTable(file='test.docx')[source]#
Bases:
object
- property shape#
- class SI(path, overwrite=False, font='Arial')[source]#
Bases:
object
- add_xyz(obj, title=None, formatter=<tcutility.report.formatters.xyz.StandardXYZFormatter object>)[source]#
Adds XYZ formatted content to the document.
This method is responsible for adding the coordinates and information about a calculation to the supporting information document. It includes details such as the electronic bond energy, Gibb’s free energy, enthalpy, imaginary mode, and the coordinates of the molecule.
- Parameters:
obj (
Union
[str
,Result
,Path
]) – A string specifying a calculation directory or a TCutility.results.Result object from a calculation.title (
Optional
[str
]) – The title to be written before the coordinates and information. If None, no title is added.formatter (
WordFormatter
) – The formatter to be used for formatting the content. Defaults to StandardXYZFormatter.
- Return type:
None
- Returns:
None
- add_heading(text, level=1)[source]#
Adds a heading to the document.
This method allows for the addition of a heading to the Word document, with customizable text and level.
- Parameters:
text (str) – The text of the heading.
level (int, optional) – The level of the heading (determines the size and style). Defaults to 1.
- Return type:
None
- get_subdirs(root_folder)[source]#
Iteratively searches through a folder and returns all the most nested subdirs.
- Return type:
List
[Path
]