Pipeline Outputs#
Pipeline outputs are the files and programmatic objects produced by a
pycsamt.pipeline.Pipeline run. A normal run writes a reproducible
output directory containing processed EDI files, QC figures, reports, and the
exact pipeline configuration used for that run. The same run also returns a
pycsamt.pipeline.PipelineResult object for Python workflows.
Use this page when you need to know:
where processed EDI files are written;
how plot directories are named;
what
summary.txtandreport.htmlcontain;how
pipeline.yamlsupports reproducibility;how to disable selected output families;
how to run completely in memory;
how to inspect output paths from Python.
Output Philosophy#
The pipeline output system is built around three rules.
- Outputs are explicit
A run writes files only when an output directory is resolved. Passing
outdir=Nonetopycsamt.pipeline.Pipeline.run()is an explicit in-memory run and produces no filesystem side effects.- Outputs are reproducible
When output is enabled, pyCSAMT writes
pipeline.yamlbefore processing starts. This file captures the resolved step list and parameters.- Outputs are organized by responsibility
Final processed data go under
processed/. Per-step QC figures go underplots/. Human-readable summaries live at the output root.
Canonical Directory Tree#
A typical run writes this directory tree:
1results/basic_qc/
2|-- processed/
3| |-- station001.edi
4| |-- station002.edi
5| `-- station003.edi
6|-- plots/
7| |-- 01_notch/
8| | |-- nr_qc_harmonic_waterfall.png
9| | `-- nr_qc_snr_gain_profile.png
10| |-- 02_drop_duplicates/
11| | `-- plot_coverage_quality_heatmap.png
12| |-- 03_select_band/
13| | |-- plot_band_microstrips.png
14| | `-- plot_coverage_quality_heatmap.png
15| `-- 05_qc_snapshot/
16| |-- plot_qc_quicklook.png
17| |-- plot_station_confidence_dashboard.png
18| `-- plot_coverage_psection.png
19|-- pipeline.yaml
20|-- report.html
21`-- summary.txt
The exact plot names depend on the QC functions attached to each registered step. A step may produce zero, one, or several figures.
Output Directory Resolution#
When using Python, the output root is resolved in this order:
explicit
outdirpassed toPipeline.run;output_dirstored on a pipeline loaded from a config file;global
PYCSAMT_PIPE.output_rootdefault, which ispipe_results.
Examples:
1from pycsamt.pipeline import Pipeline
2
3pipe = Pipeline.from_preset("basic_qc")
4
5# Explicit output directory.
6result = pipe.run(sites, outdir="results/basic_qc")
7
8# Use the pipeline or global default.
9result = pipe.run(sites)
10
11# Run in memory and write nothing.
12result = pipe.run(sites, outdir=None)
From the CLI, --out controls the output root:
1pycsamt pipe run data/edis \
2 --preset basic_qc \
3 --out results/basic_qc
If --out is omitted, the CLI uses the pipeline config value when
available, otherwise the global default pipe_results.
OutputDir#
The on-disk tree is managed internally by OutputDir. It creates the root,
processed/, and plots/ directories when a run starts.
The default subdirectory names come from
pycsamt.api.pipe.PipelineAPIConfig:
Config field |
Default |
Meaning |
|---|---|---|
|
|
Default output root when no explicit |
|
|
Subdirectory for final processed EDI files. |
|
|
Subdirectory for per-step QC figures. |
|
|
DPI used when saving Matplotlib figures. |
|
|
Plot format. CLI choices are |
|
|
Report files to write when reports are enabled. |
|
|
When true, save EDI snapshots after successful intermediate steps. |
Configure global defaults:
1from pycsamt.api.pipe import configure_pipe
2
3configure_pipe(
4 output_root="results/default_pipe",
5 processed_subdir="edis_processed",
6 plots_subdir="figures",
7 plot_dpi=300,
8 plot_fmt="pdf",
9)
Or override them temporarily:
1from pycsamt.api.pipe import PYCSAMT_PIPE
2
3with PYCSAMT_PIPE.context(plot_dpi=300, plot_fmt="svg"):
4 result = pipe.run(sites, outdir="results/svg_qc")
Processed EDI Files#
Final processed EDI files are written under <outdir>/processed/ when
save_edis=True. The pipeline writes the site collection produced after
the last step.
CLI:
1# Write processed EDIs.
2pycsamt pipe run data/edis \
3 --preset basic_qc \
4 --out results/basic_qc
5
6# Skip processed EDI export.
7pycsamt pipe run data/edis \
8 --preset basic_qc \
9 --out results/no_edi \
10 --no-edi
Python:
1result = pipe.run(
2 sites,
3 outdir="results/basic_qc",
4 save_edis=True,
5)
6
7print(result.processed_paths)
If EDI export fails, pyCSAMT warns and returns an empty or partial
processed_paths list. The run may still contain valid step results and
QC plots, so inspect summary.txt and report.html before discarding the
whole run.
QC Figures#
Each registered step may declare one or more QC plot functions. When
save_plots=True and the step succeeds, pyCSAMT calls those functions and
saves the resulting Matplotlib figures under:
1<outdir>/plots/<step_index>_<step_label>/<qc_function_name>.<plot_fmt>
Example:
1results/basic_qc/plots/01_notch/nr_qc_harmonic_waterfall.png
2results/basic_qc/plots/01_notch/nr_qc_snr_gain_profile.png
3results/basic_qc/plots/05_qc_snapshot/plot_qc_quicklook.png
Control plotting from the CLI:
1pycsamt pipe run data/edis \
2 --preset publication_ready \
3 --out results/publication_ready_pdf \
4 --dpi 300 \
5 --plot-fmt pdf
6
7pycsamt pipe run data/edis \
8 --preset basic_qc \
9 --out results/no_plots \
10 --no-plots
Control plotting from Python:
1result = pipe.run(
2 sites,
3 outdir="results/no_plots",
4 save_plots=False,
5)
6
7print(result.plots)
QC plot failures are skipped so that a successful transform does not become a failed processing step only because a diagnostic figure could not be drawn. If an expected figure is missing, check whether the step succeeded, whether plots were disabled, and whether the current data contain the quantities required by that QC function.
Reports#
When save_report=True, the pipeline writes reports according to
PYCSAMT_PIPE.report_formats. By default it writes both:
summary.txtPlain-text report for terminals, CI logs, quick review, and diffable processing notes.
report.htmlSelf-contained HTML report with summary metadata, per-step cards, linked plot thumbnails, errors, parameters, and the pipeline configuration.
The text report contains:
pipeline name;
run timestamp;
input and output site counts;
total runtime;
one row per step;
status, step code, elapsed time, site counts, and plot count;
error messages for failed steps;
output directory pointers.
The HTML report contains the same run summary plus richer per-step cards:
step label and registry code;
step status;
human-readable registry label;
input and output site counts;
elapsed time;
parameter values;
linked plot thumbnails when figures were saved;
embedded pipeline YAML.
Disable report writing:
1pycsamt pipe run data/edis \
2 --preset basic_qc \
3 --out results/no_report \
4 --no-report
Python equivalent:
1result = pipe.run(
2 sites,
3 outdir="results/no_report",
4 save_report=False,
5)
Write only one report format:
1from pycsamt.api.pipe import PYCSAMT_PIPE
2
3with PYCSAMT_PIPE.context(report_formats=("txt",)):
4 result = pipe.run(sites, outdir="results/text_only")
Pipeline Snapshot#
Every output-enabled run saves:
1<outdir>/pipeline.yaml
This file is written before the main processing loop starts. It is the resolved pipeline configuration for the run and should be treated as the source of truth for reproducing the processing sequence.
Reload a saved pipeline:
1from pycsamt.pipeline import Pipeline
2
3pipe = Pipeline.from_yaml("results/basic_qc/pipeline.yaml")
4rerun = pipe.run(sites, outdir="results/basic_qc_rerun")
Use pipeline.yaml to:
rerun a workflow after changing data loading code;
review exactly which step parameters were active;
compare two output directories;
archive a processing recipe with reports and figures;
debug a CLI run from Python.
In-Memory Runs#
Pass outdir=None when you want a pure Python result without writing files.
1result = pipe.run(
2 sites,
3 outdir=None,
4 save_plots=False,
5 save_edis=False,
6 save_report=False,
7)
8
9assert result.outdir is None
10assert result.processed_paths == []
This is useful in tests, notebooks, and exploratory workflows where the
processed Sites object is enough.
Intermediate EDI Snapshots#
The global save_intermediate option can save EDI snapshots after
successful intermediate steps. These snapshots are written inside the step’s
plot directory:
1<outdir>/plots/03_select_band/edi_snapshot/
Enable snapshots temporarily:
1from pycsamt.api.pipe import PYCSAMT_PIPE
2
3with PYCSAMT_PIPE.context(save_intermediate=True):
4 result = pipe.run(sites, outdir="results/debug_snapshots")
Use this option for debugging only. It can create many files, especially for large surveys or long pipelines.
PipelineResult#
The return value of pycsamt.pipeline.Pipeline.run() is a
PipelineResult. It is the programmatic companion to the files written on
disk.
Important fields:
Field |
Meaning |
|---|---|
|
Original input site collection. |
|
Site collection after the final step. |
|
One |
|
Output root path, or |
|
Total wall-clock runtime. |
|
Paths returned by final EDI export. |
|
Pipeline label. |
|
Derived list of all saved plot paths. |
|
|
|
Number of failed steps. |
Example:
1result = pipe.run(sites, outdir="results/basic_qc")
2
3print(result.summary())
4print(result.ok)
5print(result.outdir)
6print(result.processed_paths)
7
8for step_result in result.step_results:
9 print(
10 step_result.step_idx,
11 step_result.step_name,
12 step_result.step_code,
13 step_result.ok,
14 step_result.n_sites_in,
15 step_result.n_sites_out,
16 len(step_result.plots),
17 )
Output Control Matrix#
The output flags are independent, but they only have an effect when an output directory exists.
Control |
Applies to |
Result |
|---|---|---|
|
Python API |
No output directory and no files. |
|
CLI |
Sets the output root for the run. |
|
Python API |
Do not generate or save QC figures. |
|
CLI |
Do not generate or save QC figures. |
|
Python API |
Do not write final processed EDI files. |
|
CLI |
Do not write final processed EDI files. |
|
Python API |
Do not write |
|
CLI |
Do not write |
|
Figures |
Controls saved figure resolution. |
|
Figures |
Controls saved figure extension and Matplotlib output format. |
|
Reports |
Selects |
Recommended Output Layout#
Keep raw data, configs, and outputs separate:
1project/
2|-- data/
3| `-- raw_edis/
4|-- config/
5| |-- basic_qc.yaml
6| `-- publication_ready.yaml
7`-- results/
8 |-- basic_qc/
9 |-- noise_reduction/
10 `-- publication_ready/
Run:
1pycsamt pipe run data/raw_edis \
2 --config config/basic_qc.yaml \
3 --out results/basic_qc
This layout prevents accidental overwrites of raw files and makes it easy to compare multiple processing strategies.
Comparing Two Runs#
When comparing output directories, inspect the same files in each run:
1results/basic_qc/summary.txt
2results/noise_reduction/summary.txt
3results/basic_qc/report.html
4results/noise_reduction/report.html
5results/basic_qc/pipeline.yaml
6results/noise_reduction/pipeline.yaml
Useful comparisons:
step status and error count in
summary.txt;site counts before and after each step;
plot counts per step;
parameter differences in
pipeline.yaml;visual differences in matching
plots/<step>/folders;EDI differences under
processed/.
Stratagem Output Note#
pycsamt.pipeline.stratagem.StratagemPipeline follows the normal
pipeline output tree. When rename_basename is configured, it can also
copy or rename processed EDI files from processed/ into a renamed/
directory, or into a custom rename_dir.
For raw Stratagem convenience workflows using run_stratagem_preset, the
function writes a Stratagem-oriented output layout, including corrected
and renamed directories under the requested output root.
Troubleshooting#
- No output directory was created
In Python, check whether
outdir=Nonewas passed. That is an explicit no-files run. If using the CLI, check that the command reached the run phase and was not a--dry-run.pipeline.yamlexists but reports are missingThe pipeline writes
pipeline.yamlbefore the main step loop. Reports are written after the run only whensave_report=Trueand the selectedreport_formatsincludehtmlortxt.- Plots are missing
Check that
--no-plotsorsave_plots=Falsewas not used. Also confirm that the step succeeded and that the step has registered QC plot functions.- Processed EDIs are missing
Check that
--no-ediorsave_edis=Falsewas not used. If export failed, pyCSAMT warns andresult.processed_pathsmay be empty.- Only some plots are present
QC plot functions are skipped individually when they cannot produce a figure for the current site collection. Inspect the report and run with verbose CLI output if needed.
- The CLI dry-run output directory looks generic
--dry-runreports the explicit--outvalue when supplied. For a real run, output resolution still follows CLI--out, configoutput_dir, then the global default.- Output files were overwritten
The output manager creates directories with
exist_ok=Trueand writes standard filenames such aspipeline.yaml,summary.txt, andreport.html. Use a new output root for each experimental run.