pycsamt.pipeline._output#

Output-directory management for the pyCSAMT pipeline.

OutputDir creates and manages the canonical directory tree produced by a pipeline run:

<root>/
├── processed/          ← final EDI files (config: processed_subdir)
├── plots/              ← QC figures, one sub-folder per step
│   ├── 01_notch/
│   │   ├── harmonic_waterfall.png
│   │   └── snr_gain_profile.png
│   └── 02_select_band/
│       └── band_microstrips.png
├── pipeline.yaml       ← reproduced config for reproducibility
├── report.html
└── summary.txt

The directory is created lazily when OutputDir.setup() is called. Nothing is written until that point so that a pipeline that only runs in memory (outdir=None) produces no filesystem side-effects.

Classes

OutputDir(root, *[, api])

Manages the output directory tree for a single pipeline run.

class pycsamt.pipeline._output.OutputDir(root, *, api=None)[source]#

Bases: object

Manages the output directory tree for a single pipeline run.

Parameters:
setup()[source]#

Create the directory tree. Safe to call multiple times.

Return type:

None

step_plot_dir(idx, step_name)[source]#

Return (and create) the plot sub-directory for step idx.

Parameters:
Return type:

Path

save_figure(fig, fn_name, step_idx, step_name, *, api=None)[source]#

Save fig into the step’s plot sub-directory.

Parameters:
  • fig (matplotlib.figure.Figure) – Matplotlib figure to save.

  • fn_name (str) – Name used as the filename stem (derived from the QC function name).

  • step_idx (int) – 1-based step position.

  • step_name (str) – Step label (used for the sub-folder name).

  • api (Any) – Config override.

Returns:

The path where the figure was saved, or None on failure.

Return type:

Path or None

write_edis(sites)[source]#

Write processed EDI files to the processed/ sub-directory.

Uses pycsamt.site.export.write_sites().

Returns:

Paths of written EDI files.

Return type:

list[Path]

Parameters:

sites (Any)

save_pipeline_config(yaml_str)[source]#

Write yaml_str as pipeline.yaml in the root directory.

Parameters:

yaml_str (str)

Return type:

Path | None

save_text(text, filename)[source]#

Write text to filename in the root directory.

Parameters:
Return type:

Path | None