file.py¶
create_dir
¶
Try to create an output directory if one doesn't exist.
Throws an exception if the directory cannot be created. Returns quietly if the directory already exists.
Parameters¶
dir: str Name of directory.
Returns¶
str: Path to directory.
Source code in erosionfront/misc/file.py
create_directories
¶
create_directories(
results_path: tuple[str, str] = ("..", "Results"), results_dir: str = "Demo"
) -> str
Create results parent and target directory.
Parameters¶
results_path: tuple[str, str] = ("..", "Results",) Path to parent results directory (to be created if necessary) results_dir: str = "Demo" Target results directory (to be created)
Returns¶
str: Path to target results directory
Source code in erosionfront/misc/file.py
export_plot
¶
export_plot(
fig_name: str,
fig: Any,
results_dir: str,
file_type: str = "pdf",
suffix: str = "",
dpi: int | None = None,
) -> None
Export plot to PDF or other format file.
Parameters¶
fig_name: str Name to be used for file (extension auto-appended). fig: Any Figure object. results_dir: str Name of output directory. file_type: str = "pdf" File format. suffix: str = "" Filename suffix. dpi: int | None = None DPI of output image.
Source code in erosionfront/misc/file.py
export_plots
¶
export_plots(
fig_dict: dict,
results_dir: str,
file_types: list[str] | tuple[str] | str = "pdf",
suffix: str = "",
dpi: int | None = None,
) -> None
Export plots to PDF or other format files.
Parameters¶
fig_dict: dict Dictionary of figures results_dir: str Name of output directory file_types: list[str] | tuple[str] | str = "pdf" File format (or list of file formats) suffix: str = "" Filename suffix dpi: int | None = None DPI of output image.