Source code for gemseo.post.base_post_settings
# Copyright 2021 IRT Saint Exupéry, https://www.irt-saintexupery.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 3 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""Settings for post-processing."""
from __future__ import annotations
from pathlib import Path
from typing import ClassVar
from pydantic import BaseModel
from pydantic import Field
from pydantic import PositiveFloat
[docs]
class BasePostSettings(BaseModel):
"""The settings common to all the post-processing classes."""
_TARGET_CLASS_NAME: ClassVar[str]
"""The class name of the post-processor."""
save: bool = Field(
True,
description="Whether to save the figure.",
)
show: bool = Field(
False,
description="Whether to display the figure.",
)
file_path: Path | str = Field(
default="",
description="The path of the file to save the figures. If the extension is "
"missing, use ``file_extension``. "
"If empty, create a file path from ``directory_path``, ``file_name`` and "
"``file_extension``.",
)
directory_path: Path | str = Field(
default="",
description="The path of the directory to save the figures. "
"If empty, use the current working directory.",
)
file_name: str = Field(
default="",
description="The name of the file to save the figures. "
"If empty, use a default one generated by the post-processing.",
)
file_extension: str = Field(
default="",
description="A file extension, e.g. 'png', 'pdf', 'svg', ... "
"If empty, use a default file extension.",
)
fig_size: tuple[PositiveFloat, PositiveFloat] = Field(
default=(11.0, 11.0),
description="The width and height of the figure in inches, e.g. `(w, h)`.",
)