f4enix.output.plotter.Atlas#
- class f4enix.output.plotter.Atlas(name: str = 'atlas', landscape: str = True)#
Bases:
objectClass to handle the generation of the Atlas.
- Parameters:
name (str, optional) – atlas name, by default ‘atlas’
landscape (str, optional) – if true the atlas will be produced in landscape orientation, by default True
- Variables:
name (str) – atlas name, by default ‘atlas’
doc (docx.Document) – word document used for the creation of the atlas
default_width (float) – width used to rescale images that are added to the atlas. by default this is set to 0.9*text_length in the document. to change it, it is recommended to use either the docx.shared.Inches or docx.shared.Inches.Mm conversion method.
Examples
Build an atlas adding sections manually (recommended, since images do not need to be saved to the disk). The images can be produced using py:method:f4enix.output.plotter.MeshPlotter.plot_slices. Both a Word and PDF version are saved.
>>> from f4enix.output.plotter import Atlas ... atlas = Atlas('Some title for the atlas') ... # reduce for instance the default width for the images ... atlas.default_width = atlas.default_width*0.9 ... # add a section to the atlas containing images produced with ... # plot_slices ... atlas.add_section('new section', images) ... atlas.save('path/to/outfolder')
Methods
__init__([name, landscape])Class to handle the generation of the Atlas.
add_section(section_name, images[, level, ...])Add a section of plots to the Atlas.
build_from_root(root_path)Given a root folder, build an atlas with all the pictures found in the subfolders.
save(outpath)Save word atlas and possibly export PDF
- add_section(section_name: str, images: list[tuple[str, Image]], level: int = 1, include_section_name: bool = True, disclaimer: str | None = None) None#
Add a section of plots to the Atlas.
add a chapter to atlas, the level can be decided.
- Parameters:
section_name (str) – Name of the section
images (list[tuple[str, Image.Image]]) – list of images produced by the plot_slices() method to be added to the atlas.
level (int, optional) – nested level where the section has to be added, by default 1
include_section_name (bool) – If True, the section name is added to the image name, by default True
disclaimer (str) – add a disclaimer equal for all plots to their titles, by default is None
- build_from_root(root_path: PathLike) None#
Given a root folder, build an atlas with all the pictures found in the subfolders. Only one level of subfolders is supported at the moment.
- Parameters:
root_path (os.PathLike) – path to the root folder.
- save(outpath: PathLike) None#
Save word atlas and possibly export PDF
- Parameters:
outpath (os.PathLike) – path to the folder where to save the atlas(es)
- Return type:
None.