Pipeline Commands#
pycsamt pipe runs, inspects, and scaffolds pyCSAMT processing
pipelines. A pipeline is an ordered list of processing steps applied to a
Sites collection loaded from EDI data.
Use this command group when you want a reproducible survey workflow: noise removal, frequency filtering, static-shift correction, tensor analysis, QC plots, processed EDI outputs, and reports.
The CLI uses the same pycsamt.pipeline engine as the Python API. A
workflow can therefore move between the terminal, a notebook, and a saved
YAML/JSON/Python config file without changing meaning.
Command map#
Command |
Purpose |
|---|---|
|
Browse available processing step codes. |
|
List or expand named workflow presets. |
|
Generate a ready-to-edit pipeline config. |
|
Pretty-print a config file or preset. |
|
Execute a config, preset, or ad-hoc step list. |
Core model#
The pipeline command group revolves around four public concepts:
PipelineThe ordered workflow. It may be built from a preset, a config file, or a short ad-hoc step list.
StepA configured processing operation. Registry codes such as
NR001and registry names such asnotch_powerlineidentify the operation.PresetA named baseline workflow for common processing intentions.
PipelineResultThe run record. It stores per-step status, timing, input/output site counts, plot paths, processed EDI paths, output directory, and errors.
During pipe run, pyCSAMT loads EDI data into Sites, applies each
configured step in order, writes optional outputs, and prints a terminal
summary.
Input resolution#
Pipeline runs resolve the EDI source in this priority order:
Positional
EDI_DIR.--survey DIR.Active survey context set by
pycsamt survey set.
Examples:
pycsamt pipe run ./edis/ --preset basic_qc
pycsamt pipe run --survey ./edis/ --preset basic_qc
pycsamt survey set ./edis/
pycsamt pipe run --preset basic_qc
Use --fresh to bypass cached survey context when resolving sites.
Explore steps#
pycsamt pipe steps
pycsamt pipe steps --category noise_removal
pycsamt pipe steps --category static_shift --codes-only
pycsamt pipe steps --info NR001
pycsamt pipe steps --info notch_powerline
pycsamt pipe steps --format json
The step catalogue is grouped by categories such as frequency,
noise_removal, static_shift, tensor, dimensionality,
skew, source_effects, and qc.
Useful details:
--info CODE_OR_NAMEShows the step code, registry name, display label, category, transform function, default parameters, attached QC plot functions, and whether the step returns a modified
Sitescollection.--codes-onlyPrints one code per line. With
--format jsonit prints a JSON list of codes.--format csvFor the catalogue, emits
code,name,label,category,returns_sites.
Step codes are best for config files and reports. Registry names are useful
while exploring interactively, and are also accepted by --info and
--steps.
Explore presets#
pycsamt pipe presets
pycsamt pipe presets --expand full_processing
pycsamt pipe presets --expand basic_qc --format json
Presets are named, opinionated workflows. Common names include
basic_qc, noise_reduction, full_processing,
tensor_analysis, dimensionality_filter, and
publication_ready. stratagem_mt is also available for Stratagem AMT
data that is already loaded as Sites. Use --expand to see the exact
step sequence.
Machine-readable output:
pycsamt pipe presets --format jsonEmits a list of preset objects with
name,description,n_steps, andcodes.pycsamt pipe presets --expand NAME --format jsonEmits one preset object with the ordered
stepslist. Each step entry includes the label, code, registry name, category, and parameters.pycsamt pipe presets --format csvEmits
name,description,n_steps,codes.
Create a config#
pycsamt pipe init
pycsamt pipe init --preset full_processing --name willy_survey
pycsamt pipe init --format py --preset basic_qc -o config/willy.py
pycsamt pipe init --format json --print
pycsamt pipe init --name l22_profile --outdir results/ -o config/
Supported config formats are yaml, json, and py. A generated
config contains active steps from the selected preset plus comments or
structure for other available steps.
Path and naming rules:
--name TEXTSets the pipeline name written into the config. The default is
my_workflow.--outdir DIRWrites the default pipeline output directory into the config. A later
pycsamt pipe run --out DIRoverrides this value.-o, --output FILE_OR_DIRWrites the generated config to a path. If the path is a directory, the filename is derived from
--nameand--format. If omitted, the file is written as<name>.<format>in the current directory.--printPrints the generated config to stdout and writes nothing.
Config schema#
YAML and JSON configs use the same schema:
name: line22_basic_qc
output_dir: results/line22_basic_qc
steps:
- name: notch
code: NR001
params:
mains_hz: 50
n_harm: 30
- name: select_band
code: FREQ001
params:
band_hz: [0.001, 10000.0]
- name: qc_snapshot
code: QC001
name and output_dir are optional. Each step entry must provide a
code or registry name. The pipeline label is taken from the entry
name when present; otherwise pyCSAMT uses the registry name.
A config may also include preset: basic_qc. In that case, preset steps are
loaded first and the explicit steps entries are appended.
Python configs expose the same structure as a module-level dictionary:
pipeline_config = dict(
name="line22_basic_qc",
output_dir="results/line22_basic_qc",
steps=[
dict(name="notch", code="NR001", params=dict(mains_hz=50)),
dict(
name="select_band",
code="FREQ001",
params=dict(band_hz=[0.001, 10000.0]),
),
dict(name="qc_snapshot", code="QC001"),
],
)
Show a config or preset#
pycsamt pipe show workflow.yaml
pycsamt pipe show --preset publication_ready
pycsamt pipe show workflow.yaml --n-steps 3
pycsamt pipe show --preset full_processing --format json
show is the safest way to verify step order and parameters before a
run. It accepts the same slicing controls as run:
--from-step, --until-step, and --n-steps.
show requires either a CONFIG_FILE argument or --preset NAME.
Slicing matches pipeline labels, registry codes, or registry names. For
--format json, the output includes the pipeline name, n_steps, and
an ordered steps list with labels, codes, registry names, categories, long
labels, and parameters. For --format csv, the header is
idx,label,code,name,category,params.
Run a pipeline#
A pipeline definition is resolved in this priority order:
--config FILE.--preset NAME.--steps CODE,CODE,....
--config accepts .yaml, .yml, .json, and .py files.
If --config is present, the config file is the source of truth.
--preset and --steps are ignored by resolution.
Examples:
pycsamt pipe run --preset full_processing
pycsamt pipe run --config workflow.yaml --survey ./data/AMT/ --out results/
pycsamt pipe run --steps NR001,FREQ002,FREQ001,FREQ004,SS001 --survey ./edis/
pycsamt pipe run --config workflow.yaml --dry-run
pycsamt pipe run --config workflow.yaml --n-steps 3 --dry-run
pycsamt pipe run --config workflow.yaml --from-step align --until-step correct_ss
Execution controls:
--dry-runResolve the sites and pipeline but do not process or write files.
--from-step LABEL_OR_CODEStart at a step label, step code, or step name.
--until-step LABEL_OR_CODEStop after a step label, code, or name.
--n-steps INTKeep only the first
INTsteps after other slicing.--on-error raise|warn|skipChoose how step failures are handled.
--jobs INTAccepted as a shared CLI option. Pipeline steps run in order; treat this as forward-compatible unless a specific step documents parallel behavior.
Error policy:
raiseStop immediately and report the exception.
warnWarn, store the error in the step result, continue with the previous site collection, and exit nonzero at the end if any step failed.
skipStore the error and continue silently with the previous site collection. The final command still exits nonzero when the result is not OK.
Output controls:
--out DIRRoot directory for processed EDIs, plots, and reports.
--no-plotsSkip QC figure generation.
--no-ediSkip processed EDI output.
--no-reportSkip HTML/text run reports.
--dpi INTand--plot-fmt png|pdf|svgControl saved QC figure resolution and format.
If --out is omitted, output directory resolution follows this order:
the config file
output_dirvalue, when available;the global pipeline default,
pipe_results.
--dry-run prints the resolved pipeline and site count but writes nothing.
Pass --out explicitly when the dry-run display should show the intended
target directory.
Output directory#
A normal run with output enabled writes a directory like this:
results/basic_qc/
|-- processed/
| |-- station001.edi
| `-- station002.edi
|-- plots/
| |-- 01_notch/
| |-- 02_drop_duplicates/
| `-- ...
|-- pipeline.yaml
|-- report.html
`-- summary.txt
pipeline.yamlCanonical snapshot of the exact resolved pipeline used for the run.
processed/Final processed EDI files, unless
--no-ediwas used.plots/Per-step QC figures, unless
--no-plotswas used. Exact figure names depend on the QC functions attached to each step.report.htmlandsummary.txtHuman-readable run reports, unless
--no-reportwas used.
Output formats#
Most pipeline commands support --format text|json|csv. Use text for
interactive runs, JSON for automation, and CSV for quick spreadsheet or
shell pipelines.
For pipe run --format json, the terminal summary includes pipeline,
ok, n_errors, elapsed_sec, input/output site counts, number of
plots, outdir, and a steps list.
For pipe run --format csv, the header is:
idx,label,code,ok,elapsed_sec,n_sites_in,n_sites_out,n_plots,error
The --format option controls terminal output only. It does not change
saved report.html or summary.txt files.
Exit status and troubleshooting#
pipe run exits with status 0 only when PipelineResult.ok is true.
If one or more steps failed and the command continued under --on-error
warn or --on-error skip, pyCSAMT prints the summary and exits nonzero.
Common failures:
- No pipeline specified
Provide one of
--config,--preset, or--steps.- Unknown preset
Run
pycsamt pipe presetsand use an exact preset name.- Unknown step
Run
pycsamt pipe stepsorpycsamt pipe steps --info CODE. Step identifiers can be codes such asNR001or registry names such asnotch_powerline.- Unsupported config format
Use
.yaml,.yml,.json, or.py.- Step not found during slicing
--from-stepand--until-stepmatch pipeline labels, registry codes, or registry names. Usepipe showto inspect the exact labels.
Recommended workflow#
pycsamt survey set data/AMT/WILLY_DATA/L18PLT
pycsamt pipe presets
pycsamt pipe presets --expand basic_qc
pycsamt pipe init --preset basic_qc --name l18_qc -o l18_qc.yaml
pycsamt pipe show l18_qc.yaml
pycsamt pipe run --config l18_qc.yaml --dry-run
pycsamt pipe run --config l18_qc.yaml --out results/l18_qc/
Python equivalent#
from pycsamt.emtools._core import ensure_sites
from pycsamt.pipeline import Pipeline
sites = ensure_sites("data/AMT/WILLY_DATA/L18PLT", recursive=True, verbose=0)
pipe = Pipeline.from_yaml("l18_qc.yaml")
result = pipe.run(sites, outdir="results/l18_qc")