Pipeline Presets#

Pipeline presets are named, opinionated processing recipes. They are useful when you want a tested starting point without writing a full step list by hand. A preset is not a hidden mode: internally it is just an ordered list of (label, Step) tuples, so it can be inspected, exported to a config file, customized, and reviewed like any other pipeline.

Use presets when you want to:

  • run a first-pass QC workflow quickly;

  • compare a few standard processing strategies;

  • scaffold a reproducible YAML, JSON, or Python config;

  • teach new users a safe default order for common MT/AMT processing tasks;

  • keep command-line workflows concise while preserving a saved pipeline.yaml in the output directory.

Preset Model#

Each built-in preset is represented by a Preset object with three fields:

name

Stable identifier used by the CLI and Python API, for example basic_qc.

description

Short explanation shown in preset catalogues.

steps

Ordered list of (label, Step) tuples. The labels become report names and output subdirectory names; the Step objects hold registry codes and parameter defaults.

The preset API is intentionally small:

 1from pycsamt.pipeline import get_preset, list_presets, preset_catalogue
 2
 3print(preset_catalogue())
 4
 5preset = get_preset("basic_qc")
 6for label, step in preset.steps:
 7    print(label, step.spec.code, step.spec.name, step.params)
 8
 9for preset in list_presets():
10    print(preset.name, len(preset.steps))

Run A Preset#

From the command line:

1pycsamt pipe run data/edis \
2    --preset basic_qc \
3    --out results/basic_qc \
4    -v

From Python:

1from pycsamt.pipeline import Pipeline
2
3pipe = Pipeline.from_preset("basic_qc")
4result = pipe.run(sites, outdir="results/basic_qc")

Inspect Presets Before Running#

List all presets:

1pycsamt pipe presets

Expand one preset into its step sequence:

1pycsamt pipe presets --expand full_processing
2pycsamt pipe show --preset full_processing

Use JSON or CSV when another tool needs the preset list:

1pycsamt pipe presets --format json
2pycsamt pipe presets --expand basic_qc --format json
3pycsamt pipe presets --format csv

Built-In Preset Summary#

The normal pipeline registry currently provides seven presets.

Preset

Steps

Best for

Sequence

basic_qc

5

First-pass inspection and quick survey sanity checks.

NR001, FREQ002, FREQ001, FREQ004, QC001

noise_reduction

6

High-EMI data where denoising is the main question.

NR001, NR004, NR005, NR003, NR010, QC001

full_processing

8

Standard end-to-end processing before interpretation.

NR001, FREQ002, FREQ001, FREQ004, SK001, TZ001, SS001, QC001

tensor_analysis

5

Tensor-focused cleanup after data already have an acceptable frequency grid.

TZ001, TZ002, TZ003, TZ004, QC001

dimensionality_filter

4

Classifying dimensionality and keeping/projecting 2-D-compatible intervals.

DIM001, DIM002, DIM003, QC001

publication_ready

9

Longer reviewed workflow for polished reports and figures.

NR001, FREQ002, FREQ001, FREQ004, SS001, TZ001, TZ002, SK001, QC001

stratagem_mt

7

Stratagem AMT data already loaded as a Sites object.

SS001, FREQ001, FREQ002, NR001, NR004, NR010, QC001

Choosing A Preset#

Start with the narrowest preset that answers your current question.

Situation

Start with

Why

You just received a survey and need a quick check.

basic_qc

It does only basic notch, frequency cleanup, alignment, and QC.

Harmonic and spatial noise dominate the data.

noise_reduction

It stacks targeted noise-removal steps before a QC snapshot.

You want a general processing run before inversion preparation.

full_processing

It combines denoising, frequency cleanup, skew gating, rotation, static-shift correction, and QC.

You already trust the frequency grid and want tensor diagnostics.

tensor_analysis

It avoids frequency and noise steps and focuses on tensor operations.

You are deciding which intervals are compatible with 2-D assumptions.

dimensionality_filter

It classifies dimensionality, masks by class, projects to 2-D, and generates QC.

You need a polished, repeatable processing chain.

publication_ready

It is longer and more opinionated, with static-shift correction, tensor cleanup, skew gating, and final QC.

You are working with Stratagem AMT data already represented as Sites.

stratagem_mt

It applies Stratagem-oriented AMT band selection, static shift, denoising, and QC at the emtools pipeline level.

Preset Details#

basic_qc#

basic_qc is the safest first preset for most surveys. It does not try to solve every processing problem; it prepares a clean enough view to understand what the data need next.

Sequence:

1notch            NR001   notch_powerline
2drop_duplicates  FREQ002 drop_duplicates
3select_band      FREQ001 select_band
4align_grid       FREQ004 align_grid
5qc_snapshot      QC001   qc_snapshot

Run:

1pycsamt pipe run data/edis \
2    --preset basic_qc \
3    --out results/basic_qc \
4    --on-error warn

Use basic_qc when:

  • you need quick figures before committing to a processing plan;

  • you want to verify that EDI loading and output generation work;

  • you are comparing surveys and want the same minimal cleanup everywhere.

Move beyond basic_qc when:

  • static shift is obvious;

  • skew or dimensionality gates are needed;

  • power-line removal is not enough for the noise environment;

  • you need a processing chain suitable for inversion preparation.

noise_reduction#

noise_reduction concentrates on denoising. It is useful when the first inspection shows power-line harmonics, local spikes, spatially coherent outliers, or incoherent frequency bins.

Sequence:

1notch         NR001 notch_powerline
2hampel        NR004 hampel_filter
3spatial_med   NR005 spatial_median
4shrink_trend  NR003 shrink_group_trend
5mask_incoher  NR010 mask_incoherent
6qc_snapshot   QC001 qc_snapshot

Run:

1pycsamt pipe run data/edis \
2    --preset noise_reduction \
3    --out results/noise_reduction

Use this preset to compare denoising impact against basic_qc:

1pycsamt pipe run data/edis --preset basic_qc \
2    --out results/compare/basic_qc
3pycsamt pipe run data/edis --preset noise_reduction \
4    --out results/compare/noise_reduction

full_processing#

full_processing is the standard end-to-end workflow. It starts with noise and frequency cleanup, then applies a skew gate, strike rotation, static-shift correction, and QC.

Sequence:

1notch          NR001   notch_powerline
2drop_dup       FREQ002 drop_duplicates
3select_band    FREQ001 select_band
4align_grid     FREQ004 align_grid
5mask_skew      SK001   mask_by_skew
6rotate_strike  TZ001   rotate_strike
7correct_ss     SS001   correct_ss_ama
8qc_snapshot    QC001   qc_snapshot

Run:

1pycsamt pipe run data/edis \
2    --preset full_processing \
3    --out results/full_processing \
4    -v

Use this preset when:

  • the survey needs a broad processing pass;

  • you want an auditable default before building an inversion-specific config;

  • you need one chain that exercises the main processing families.

tensor_analysis#

tensor_analysis assumes the data are already in reasonable condition and focuses on tensor operations.

Sequence:

1rotate_strike  TZ001 rotate_strike
2antisymm       TZ002 antisymmetrize
3sigma_clip     TZ003 sigma_clip
4balance        TZ004 balance_offdiag
5qc_snapshot    QC001 qc_snapshot

Use it when you want to inspect tensor behavior without changing the frequency selection or applying the broader denoising chain.

dimensionality_filter#

dimensionality_filter is for 1-D / 2-D / 3-D screening and 2-D projection workflows.

Sequence:

1classify_dim  DIM001 classify_dim
2mask_dim      DIM002 mask_by_dim
3project_2d    DIM003 project_2d
4qc_snapshot   QC001  qc_snapshot

Run:

1pycsamt pipe run data/edis \
2    --preset dimensionality_filter \
3    --out results/dimensionality

Use it after basic cleanup when the main question is whether the remaining intervals are compatible with a 2-D interpretation or inversion assumption.

publication_ready#

publication_ready is the longest built-in general-purpose preset. It is designed for polished processing output rather than quick exploration.

Sequence:

1notch          NR001   notch_powerline
2drop_dup       FREQ002 drop_duplicates
3select_band    FREQ001 select_band
4align_grid     FREQ004 align_grid
5correct_ss     SS001   correct_ss_ama
6rotate_strike  TZ001   rotate_strike
7antisymm       TZ002   antisymmetrize
8mask_skew      SK001   mask_by_skew
9qc_snapshot    QC001   qc_snapshot

Run:

1pycsamt pipe run data/edis \
2    --preset publication_ready \
3    --out results/publication_ready \
4    --dpi 300 \
5    --plot-fmt pdf \
6    -v

Use this preset when:

  • you already inspected the data with a lighter preset;

  • the default step order is scientifically acceptable for your survey;

  • you need high-quality saved figures and a complete run report.

stratagem_mt#

stratagem_mt is a normal emtools pipeline preset specialized for Stratagem AMT data that are already loaded as a Sites object. It does not perform raw-coordinate injection, raw hardware-file parsing, or station renaming by itself.

Sequence:

1correct_ss    SS001   correct_ss_ama
2select_band   FREQ001 select_band   band_hz=(10.0, 100000.0)
3drop_dup      FREQ002 drop_duplicates
4notch         NR001   notch_powerline
5hampel        NR004   hampel_filter
6mask_incoher  NR010   mask_incoherent
7qc_snapshot   QC001   qc_snapshot

Use this preset with the normal pipeline API when your input is already a site collection:

1from pycsamt.pipeline import Pipeline
2
3pipe = Pipeline.from_preset("stratagem_mt")
4result = pipe.run(sites, outdir="results/stratagem_mt")

Use pycsamt.pipeline.stratagem.StratagemPipeline or run_stratagem_preset when you also need the full raw EDI plus GPS CSV workflow.

Export A Preset To A Config#

For serious work, use a preset to generate a config and then commit the expanded recipe to your project. This makes the workflow auditable and easy to rerun.

Generate YAML:

1pycsamt pipe init \
2    --preset publication_ready \
3    --name line22_publication_ready \
4    --outdir results/line22_publication_ready \
5    --output config/line22_publication_ready.yaml

Generate Python:

1pycsamt pipe init \
2    --preset basic_qc \
3    --format py \
4    --output config/basic_qc.py

Preview before running:

1pycsamt pipe show config/line22_publication_ready.yaml
2pycsamt pipe run data/edis \
3    --config config/line22_publication_ready.yaml \
4    --dry-run

Customizing Presets Safely#

There are three ways to customize a preset.

Use the preset directly, then edit the pipeline in Python:

1from pycsamt.pipeline import Pipeline, Step
2
3pipe = Pipeline.from_preset("basic_qc")
4pipe.replace("notch", Step("NR001", mains_hz=60, n_harm=25))
5pipe.append("static_shift", Step("SS001"))

Use pycsamt pipe init to expand a preset into an explicit config, then edit the generated step parameters:

 1name: basic_qc_60hz
 2output_dir: results/basic_qc_60hz
 3
 4steps:
 5  - name: notch
 6    code: NR001
 7    params:
 8      mains_hz: 60
 9      n_harm: 25
10      tol_hz: 0.08
11  - name: drop_duplicates
12    code: FREQ002
13  - name: select_band
14    code: FREQ001
15  - name: align_grid
16    code: FREQ004
17  - name: qc_snapshot
18    code: QC001

Append extra steps after a preset in a config:

1name: basic_qc_plus_static_shift
2output_dir: results/basic_qc_plus_static_shift
3preset: basic_qc
4
5steps:
6  - name: static_shift
7    code: SS001
8  - name: final_qc
9    code: QC001

Important: in a config file, preset: basic_qc loads all preset steps first, then appends the explicit steps list. It does not modify an existing preset step. If you need to change NR001 from 50 Hz to 60 Hz, use an explicit expanded step list instead of preset: basic_qc plus a second NR001 step.

CLI Priority#

pycsamt pipe run resolves the pipeline definition in this order:

  1. --config FILE;

  2. --preset NAME;

  3. --steps CODE,CODE,....

If --config is supplied, --preset and --steps are ignored because the config file is the source of truth.

Examples:

 1# Uses the config.  The preset argument is ignored.
 2pycsamt pipe run data/edis \
 3    --config config/basic_qc.yaml \
 4    --preset publication_ready
 5
 6# Uses the preset.
 7pycsamt pipe run data/edis \
 8    --preset publication_ready
 9
10# Uses the ad-hoc steps.
11pycsamt pipe run data/edis \
12    --steps FREQ002,FREQ001,FREQ004,NR001,QC001

Compare Presets#

A useful way to choose a recipe is to run several presets into separate output directories and compare the reports:

 1pycsamt pipe run data/edis \
 2    --preset basic_qc \
 3    --out results/compare/basic_qc
 4
 5pycsamt pipe run data/edis \
 6    --preset noise_reduction \
 7    --out results/compare/noise_reduction
 8
 9pycsamt pipe run data/edis \
10    --preset full_processing \
11    --out results/compare/full_processing

Compare:

  • summary.txt for step failures, runtime, and site counts;

  • report.html for per-step status and embedded pipeline YAML;

  • plots/ for visual differences between cleanup strategies;

  • processed/ for exported EDI differences.

Stratagem Presets#

There are two related but different Stratagem preset systems.

stratagem_mt

A normal pycsamt.pipeline.Pipeline preset. It expects data that can already be processed as Sites and runs normal registered pipeline steps.

StratagemPreset

A convenience workflow in pycsamt.pipeline.stratagem for raw Stratagem EDI directories plus coordinate CSV files. It calls StratagemSurvey methods such as remove_static_shift, drop_frequencies, remove_noises, export, and rename.

The Stratagem convenience presets are:

Preset

Main workflow

Best for

basic

coordinate injection, AMA static shift, frequency trim, noise removal, export, rename

Direct replacement for the legacy Stratagem processing script.

full_processing

QC, AMA static shift, hardware-aware frequency filtering, smoothed noise removal, export, rename

Raw Stratagem workflows with hardware files and a full QC pass.

publication_ready

stricter QC, hardware SNR masking, AMT band trimming, stronger smoothing, export, rename

Polished Stratagem outputs after the basic workflow has been reviewed.

Run a raw Stratagem convenience preset:

 1from pycsamt.pipeline.stratagem import run_stratagem_preset
 2
 3survey = run_stratagem_preset(
 4    "full_processing",
 5    edi_dir="2/2EDI",
 6    coord_file="2.csv",
 7    raw_dir="raw/2HX",
 8    outdir="results/stratagem",
 9    epsg=32649,
10    utm_zone="49N",
11    rename_basename="T2.",
12    overwrite=True,
13    verbose=1,
14)

Build a Stratagem pipeline object from a normal emtools preset:

 1from pycsamt.pipeline.stratagem import StratagemPipeline
 2
 3pipe = StratagemPipeline.from_preset(
 4    "stratagem_mt",
 5    coord_file="2.csv",
 6    raw_dir="raw/2HX",
 7    epsg=32649,
 8    utm_zone="49N",
 9    rename_basename="T2.",
10)
11
12result = pipe.run("2/2EDI", outdir="results/stratagem_mt")

Troubleshooting#

Unknown preset

Run pycsamt pipe presets. Preset names are exact and lowercase, for example basic_qc or publication_ready.

I changed preset: basic_qc but the notch is still 50 Hz

A config preset expands the preset first. Explicit steps are appended; they do not edit existing preset steps. Generate an expanded config with pycsamt pipe init --preset basic_qc and edit the NR001 parameters directly.

The preset is too aggressive

Move to a narrower preset such as basic_qc or export the preset to a config and remove the steps that are not justified by the data.

The preset does not include a step I need

Append the step in Python, or add it to an explicit config after generating the preset scaffold.

I need raw Stratagem coordinate injection and renaming

Use pycsamt.pipeline.stratagem rather than the normal stratagem_mt preset alone.