2.27. pycsamt.pipeline#
Declarative processing pipelines, step registries, presets, output handling, and report generation.
pyCSAMT processing pipeline.
A declarative, automated MT processing engine that chains emtools operations from raw Sites to publication-ready output.
This package is the single entry point for all pipeline-related symbols.
The processing engine lives in the private sub-modules of this package
(_registry, _steps, _pipeline, …). Runtime configuration is
provided by pycsamt.api.pipe and re-exported here so users only need
one import location.
2.27.1. Typical usage#
Build and run from code:
from pycsamt.pipeline import Pipeline, Step
pipe = Pipeline(
[
("notch", Step("NR001", mains_hz=50)),
("band", Step("FREQ001")),
("align", Step("FREQ004")),
("correct_ss", Step("SS001")),
("rotate", Step("TZ001")),
]
)
print(pipe)
result = pipe.run(sites, outdir="willy_results/")
# shortest path — Pipeline and Step are also on pycsamt directly
from pycsamt import Pipeline, Step
Load from a config file:
pipe = Pipeline.from_yaml("config/workflow.yaml")
pipe = Pipeline.from_preset("publication_ready")
Discover available steps and presets:
from pycsamt.pipeline import list_steps, preset_catalogue
list_steps() # all built-in StepSpec objects
list_steps("noise_removal") # by category
print(preset_catalogue()) # named presets
Configure pipeline output globally:
from pycsamt.pipeline import configure_pipe
configure_pipe(plot_dpi=300, plot_fmt="pdf", output_root="results/")
# or temporarily with a context manager
from pycsamt.pipeline import PYCSAMT_PIPE
with PYCSAMT_PIPE.context(show_progress=False):
result = pipe.run(sites)
Cache step outputs so an interrupted run resumes instead of recomputing:
result = pipe.run(sites, outdir="results/", cache=True)
Observe a run live, or log it for later comparison:
result = pipe.run(sites, on_step=lambda sr: print(sr.summary_line()))
result = pipe.run(sites, history=True) # -> load_history() later
A finished PipelineResult renders inline in Jupyter (_repr_html_),
and configure_pipe(progress_style="rich") (or CLI --live) renders a
live-updating status table in the terminal while a run is in progress.
- class pycsamt.pipeline.PipelineBase#
Bases:
objectBase class for pyCSAMT pipeline objects.
Inherit from this to gain registry introspection,
to_pyexport, andscaffoldtemplate generation.Pipelineinherits this.- static available_steps(category=None)#
Return all registered
StepSpecobjects.- Parameters:
category (str | None) – When supplied, restrict to steps in that category (e.g.
"noise_removal","frequency").- Return type:
Examples
>>> Pipeline.available_steps() >>> Pipeline.available_steps("static_shift")
- static available_categories()#
Return a sorted list of step category names.
Examples
>>> Pipeline.available_categories() ['dimensionality', 'frequency', 'noise_removal', ...]
- static step_info(code_or_name)#
Return a formatted info block for a single step.
- Parameters:
code_or_name (str) – Registry code (
"NR001") or snake-case name ("notch_powerline").- Return type:
Examples
>>> print(Pipeline.step_info("NR001")) >>> print(Pipeline.step_info("correct_ss_ama"))
- classmethod catalogue(category=None)#
Return a full formatted catalogue of all available steps.
- Parameters:
category (str | None) – Restrict output to one category, or
Nonefor all.- Return type:
Examples
>>> print(Pipeline.catalogue()) >>> print(Pipeline.catalogue("tensor"))
- to_py(path=None)#
Serialize this pipeline to a Python config script.
Produces a
pipeline_configdict in a clean, readable.pyfile that can be edited and reloaded withfrom_py(). Steps are grouped by category and commented with their human-readable labels.- Parameters:
path (str | Path | None) – If given, write the output to this file path.
- Returns:
The generated Python source as a string (always returned, whether or not path is provided).
- Return type:
Examples
>>> src = pipe.to_py() >>> print(src) >>> pipe.to_py("config/my_workflow.py")
- classmethod scaffold(path=None, *, fmt='yaml', preset=None, name='my_workflow', outdir='pipe_results')#
Generate a ready-to-edit starter pipeline config.
The scaffold contains: - Active steps from preset (or a sensible default set) - All other available steps commented out with descriptions
- Parameters:
path (str | Path | None) – Write the output to this file. Extension is inferred from fmt if the path has none.
fmt (str) – Output format:
"yaml"(default),"json", or"py".preset (str | None) – Name of a built-in preset to use as the active step set (e.g.
"basic_qc","full_processing"). WhenNonea minimalbasic_qc-style set is used.name (str) – Pipeline name written into the config.
outdir (str) – Default output directory written into the config.
- Returns:
The generated config content as a string.
- Return type:
Examples
>>> print(Pipeline.scaffold()) >>> Pipeline.scaffold("config/starter.yaml", preset="full_processing") >>> Pipeline.scaffold("config/starter.py", fmt="py")
- class pycsamt.pipeline.Pipeline(steps, *, name='pipeline', _output_dir=None)#
Bases:
PipelineBaseAn ordered, configurable MT processing pipeline.
- Parameters:
Examples
>>> from pycsamt.emtools.pipe import Pipeline, Step >>> pipe = Pipeline( ... [ ... ("notch", Step("NR001")), ... ("band", Step("FREQ001", band_hz=(0.001, 10000))), ... ("align", Step("FREQ004")), ... ] ... ) >>> print(pipe)
- append(label, step)#
Add step to the end of the pipeline.
Returns self so calls can be chained.
- insert(idx, label, step)#
Insert step at position idx (0-based).
Returns self.
- remove(label)#
Remove the first step whose label matches label.
Returns self.
- replace(label, step)#
Replace the step labelled label with step.
Returns self.
- run(sites, *, outdir=<object object>, save_plots=True, save_edis=True, save_report=True, api=None, cache=False, on_step=None, history=False)#
Run all steps in order and return a
PipelineResult.- Parameters:
outdir (Any) – Root output directory. Falls back first to the pipeline’s own
_output_dir(set byfrom_yaml), then tooutput_root.save_plots (bool) – Generate and save QC figures for each step.
save_edis (bool) – Write processed EDI files after the final step.
save_report (bool) – Write HTML and/or text reports to outdir.
api (Any) – Optional
PipelineAPIConfigoverride. WhenNonethe global singleton is used.cache (bool | str | Path) –
False(default) — no caching, identical behavior to every prior release.True— cache each step’s output undercache_root. A path — cache under that directory instead. A rerun of the identical call replays every already-completed step from cache instead of recomputing it — this is also how an interrupted run “resumes.” See Caching And Resume for what is and isn’t safe to cache.on_step (Callable[[StepResult], None] | None) – Optional callable invoked once per step, immediately after that step’s
StepResultis built — for a fresh computation, a cache hit, or a warn/skip error alike (a step that raises underon_step_error="raise"never gets aStepResultand so never fires this either, same as today). An exception raised by on_step itself is caught and warned, never allowed to corrupt or abort the run. This is the hook a notebook, a script, or a future GUI integration would use to observe a run in progress — see Live Observability.history (bool | str | Path) –
False(default) — no history logged.True— append a compact one-line JSON summary of this run tohistory_path(default~/.pycsamt/pipeline_history.jsonl). A path — log to that file instead. Read back withload_history().
- Return type:
- classmethod from_yaml(path)#
Load a pipeline from a YAML config file.
- classmethod from_json(path)#
Load a pipeline from a JSON config file.
- classmethod from_py(path)#
Load a pipeline from a Python config file.
The file must expose a
pipeline_configdict.
- classmethod from_preset(name, pipeline_name=None)#
Build a pipeline from a named preset.
- Parameters:
- Return type:
See also
pycsamt.emtools.pipe.preset_catalogue
- to_yaml(path)#
Write this pipeline config to path as YAML.
- to_json(path)#
Write this pipeline config to path as JSON.
- describe()#
Return a
pandas.DataFramedescribing the pipeline steps.- Return type:
- class pycsamt.pipeline.PipelineResult(sites_in, sites_out, step_results, outdir, elapsed_sec, processed_paths=<factory>, pipeline_name='pipeline')#
Bases:
objectReturn value of
Pipeline.run().- Variables:
sites_in (Any) – Original Sites passed to
Pipeline.run().sites_out (Any) – Fully processed Sites after all steps.
step_results (list[pycsamt.pipeline._steps.StepResult]) – One
StepResultper pipeline step, in order.outdir (pathlib.Path | None) – Root output directory (
Nonewhen no output was requested).elapsed_sec (float) – Total wall-clock time for the run.
processed_paths (list[pathlib.Path]) – Paths of EDI files written to
<outdir>/processed/.pipeline_name (str) – Name label of the pipeline.
- Parameters:
- step_results: list[StepResult]#
- class pycsamt.pipeline.Step(code_or_name, **params)#
Bases:
objectA configured pipeline step.
- Parameters:
Examples
>>> from pycsamt.emtools.pipe import Step >>> Step("NR001", mains_hz=50) Step [NR001] Power-line Harmonic Notch (mains_hz=50, n_harm=30, tol_hz=0.08) >>> Step("notch_powerline") Step [NR001] Power-line Harmonic Notch (mains_hz=50, n_harm=30, tol_hz=0.08)
- transform(sites)#
Apply the step’s transform function to sites.
If the step has
returns_sites=False(diagnostic-only), the input sites is returned unchanged.
- generate_qc_plots(sites)#
Call QC plot functions on sites and return
(name, Figure)pairs.Return values are normalised to
matplotlib.figure.Figureso the pipeline can callsavefigregardless of whether the underlying emtools function returned aFigureor anAxesobject. Failures are silently skipped so that a broken QC plot never kills a successful processing run.
- class pycsamt.pipeline.StepResult(step_idx, step_name, step_code, step_label, params, elapsed_sec, plots=<factory>, n_sites_in=0, n_sites_out=0, error=None, cached=False)#
Bases:
objectImmutable record produced after one pipeline step runs.
- Variables:
step_idx (int) – 1-based position in the pipeline.
step_name (str) – User-supplied label for this step in the pipeline.
step_code (str) – Registry code (e.g.
"NR001").step_label (str) – Human-readable label from the registry.
params (dict) – Parameters that were passed to the transform function.
elapsed_sec (float) – Wall-clock time in seconds for this step (transform + QC plots).
plots (list[pathlib.Path]) – Paths of figures saved to disk during this step.
n_sites_in (int) – Number of sites fed into this step.
n_sites_out (int) – Number of sites coming out of this step.
error (Exception | None) – If the step raised an exception and execution continued (
on_step_error != "raise"), the exception is stored here.Nonemeans the step completed without error.cached (bool) –
Truewhen this step’s result was replayed from the pipeline’s step cache (Pipeline.run(..., cache=...)) instead of actually being recomputed. Only everTruewhen caching was enabled for this run.
- Parameters:
- class pycsamt.pipeline.StepSpec(code, name, label, category, defaults=<factory>, returns_sites=True, mod=None, fn_name=None, qc_defs=<factory>, override_fn=None, origin='builtin')#
Bases:
objectImmutable descriptor for one pipeline step.
- Parameters:
code (str) – Short uppercase identifier, e.g.
"NR001".name (str) – Snake-case name, e.g.
"notch_powerline".label (str) – Human-readable label shown in pipeline
__repr__.category (str) – Logical group (
"frequency","noise_removal","static_shift","tensor","dimensionality","skew","source_effects","qc").defaults (dict) – Keyword arguments passed to the transform function when not overridden by the user.
returns_sites (bool) –
True– step transforms the Sites object (default).False– diagnostic-only step; the Sites pass through unchanged.mod (str | None) – Dotted module path for the primary transform function.
Nonewhen override_fn is provided.fn_name (str | None) – Name of the transform function inside mod.
Nonewhen override_fn is provided.qc_defs (list[tuple[str, str]]) – List of
(module_path, function_name)pairs. The pipeline calls these after each step to generate QC figures.override_fn (Callable | None) – Direct callable override. When set, mod / fn_name are ignored.
origin (str) –
"builtin"for the 47 steps shipped with pyCSAMT (default), or"plugin"for anything added viaregister_step(). Stamped automatically byregister_step()— callers never need to set it.
- pycsamt.pipeline.list_steps(category=None)#
Return all registered
StepSpecobjects, optionally filtered.
- pycsamt.pipeline.categories()#
Return a sorted list of distinct step categories.
- pycsamt.pipeline.register_step(spec, *, replace_existing=False, validate=True)#
Register a third-party
StepSpecinto the pipeline registry.This is the extension point for anything outside the 47 steps shipped with pyCSAMT — a plugin package (see
pycsamt.pipeline.discover_plugins()) or a one-off custom step defined in a user script. Once registered, the step is usable everywhere a built-in step is:Step(code), the CLI (pycsamt pipe steps,pipe run --steps ...), presets, etc.- Parameters:
spec (StepSpec) – The step to register. Its
originis always overwritten to"plugin"regardless of what the caller passed.replace_existing (bool) – If
False(default), raisesValueErrorwhen spec.code or spec.name already exists in the registry. SetTrueto overwrite an existing entry (built-in or previously-registered plugin) — e.g. to patch a built-in step’s implementation.validate (bool) – If
True(default), resolvesspec.get_fn()once before inserting, so a typo’dmod/fn_nameor a brokenoverride_fnis caught at registration time rather than at the first pipeline run. On failure the registry is left untouched.
- Returns:
The registered spec (with
origin="plugin"stamped on it).- Return type:
- Raises:
ValueError – spec.code or spec.name collides with an existing entry and
replace_existingisFalse.ModuleNotFoundError, AttributeError, RuntimeError –
validate=Trueandspec.get_fn()could not resolve a callable (badmod, missingfn_name, or neithermod/fn_namenoroverride_fnset) — whateverStepSpec.get_fn()itself raises propagates unchanged.
- pycsamt.pipeline.unregister_step(code_or_name, *, missing_ok=False)#
Remove a previously-registered step from the pipeline registry.
- Parameters:
code_or_name (str) – The step’s code or name (see
lookup_step()).missing_ok (bool) – If
False(default), raisesKeyErrorwhen no such step is registered. SetTrueto no-op instead.
- Return type:
None
- pycsamt.pipeline.discover_plugins(*, group='pycsamt.pipeline.steps', on_error='warn')#
Load every
pycsamt.pipeline.stepsentry point and run it.Each entry point must resolve to a zero-argument callable; it is expected to call
pycsamt.pipeline.register_step()itself for whatever steps it contributes. Never called automatically — see the module docstring.- Parameters:
group (str) – Entry-point group to scan. Defaults to
ENTRY_POINT_GROUP.on_error (str) –
"warn"(default): a plugin that fails to load or raises is reported as a failedPluginLoadResultand aUserWarning; discovery continues with the remaining plugins."raise": the first failure propagates immediately.
- Returns:
One entry per discovered entry point, in discovery order.
- Return type:
- class pycsamt.pipeline.PluginLoadResult(name, ok, error=None)#
Bases:
objectOutcome of loading one
pycsamt.pipeline.stepsentry point.- Variables:
- Parameters:
- pycsamt.pipeline.register_ai_steps(*, replace_existing=False)#
Register the opt-in AI step(s) into the pipeline step registry.
Currently just
AI001/audit_survey. Never called automatically — see the module docstring for why.- Parameters:
replace_existing (bool) – Forwarded to
register_step().- Returns:
The registered spec(s), each stamped
origin="plugin"byregister_step.- Return type:
- class pycsamt.pipeline.StepCache(root=None)#
Bases:
objectSharded, content-addressed disk cache for pipeline step outputs.
Layout:
root/<key[:2]>/<key>.joblib. Writes are atomic (temp file in the same directory, thenos.replace), so a killed process never leaves a half-written entry visible. A corrupt or unreadable entry is treated as a miss — warns, never crashes the run — the same “one bad entry must not break everything else” principlepycsamt.pipeline.discover_plugins()already established.- Parameters:
root (str | Path | None)
- get(key)#
Return the cached value for key, or the
_MISSsentinel.
- put(key, value)#
Atomically store value under key.
- clear()#
Remove every entry (and the root directory itself) from disk.
- Return type:
None
- pycsamt.pipeline.fingerprint_sites(sites)#
Deterministic content hash of a Sites-like collection.
Tries the real
Sitesshape first — iterates stations, hashing each one’s name plus itsfreq/zarrays, in iteration order. Order is part of the fingerprint on purpose: under-caching on a harmless reorder is a safer failure mode than treating two differently-ordered (and potentially differently-behaving) inputs as identical.Falls back to hashing the pickled object for anything that doesn’t match that shape (plain test doubles, custom plugin-defined sites-like objects) — this keeps the cache usable without special-casing every possible “sites” representation.
- pycsamt.pipeline.load_history(path=None, *, last=None)#
Read back previously logged run summaries, oldest first.
- Parameters:
- Return type:
:param crash” posture
StepCachealready uses.:
- class pycsamt.pipeline.Preset(name, description, steps=<factory>)#
Bases:
objectA named, ordered collection of pipeline steps.
- Variables:
- Parameters:
- pycsamt.pipeline.get_preset_for_method(method, level='qc')#
Return the method-aware
Presetfor an explicit EM method.- Parameters:
method (str) – An EM method string – either one recognised by
SurveyMeta("MT","AMT","CSAMT","CSEM","TEM","BBMT","LAMT","LMT") or"CSUMT"(recognised here even thoughSurveyMeta’s vocabulary predates it)."MT","BBMT","LAMT","LMT","AMT","CSAMT", and"CSUMT"are mapped to a preset today;"CSEM"/"TEM"are recognised but have no method-aware preset yet. Case-insensitive.level (str) – Preset tier. Only
"qc"exists today.be (This performs no data inspection or auto-detection -- method must)
a (supplied explicitly (e.g. from)
- Return type:
:param
methodthe caller already: :param has): :param the same wayget_preset()requires an explicit preset name.:- Raises:
ValueError – When method is not a recognised EM method, or has no method-aware preset yet.
- Parameters:
- Return type:
Examples
>>> from pycsamt.pipeline import get_preset_for_method >>> get_preset_for_method("CSAMT").name 'csamt_qc'
- pycsamt.pipeline.load_yaml(path)#
Parse a YAML pipeline config file and return the raw dict.
- pycsamt.pipeline.load_json(path)#
Parse a JSON pipeline config file and return the raw dict.
- pycsamt.pipeline.load_py(path)#
Import a Python config file and return its
pipeline_configdict.
- pycsamt.pipeline.plot_pipeline_dashboard(result, *, figsize=(12.0, 8.0))#
Create a compact dashboard for a completed pipeline run.
The dashboard combines run-level cards, per-step status, timing, station-count flow, and generated-figure counts. It is the most useful single figure to place in a processing report or notebook.
- Returns:
Figure containing the dashboard.
- Return type:
- Parameters:
result (PipelineResult)
- pycsamt.pipeline.plot_pipeline_status(result, *, ax=None, ok_color='#2f9e44', error_color='#c92a2a', annotate_errors=True)#
Plot per-step success status for a pipeline run.
Failed steps are coloured red and, when available, the exception message is written below the corresponding bar. Empty results draw a neutral placeholder instead of failing.
- pycsamt.pipeline.plot_pipeline_timing(result, *, ax=None, color='#2f6f8f', slow_color='#f08c00', slow_quantile=0.8, annotate=True)#
Plot elapsed time per pipeline step.
Steps above slow_quantile are highlighted, helping users quickly spot expensive processing or plotting stages.
- pycsamt.pipeline.plot_site_count_flow(result, *, ax=None, color_in='#687582', color_out='#7c4d79', drop_color='#c92a2a', annotate=True)#
Plot station counts entering and leaving each pipeline step.
A faint red band marks steps where the output site count is lower than the input site count, which is useful for QC workflows that reject stations.
- class pycsamt.pipeline.StratagemPreset(name, description, survey_defaults=<factory>, steps=<factory>)#
Bases:
objectNamed configuration bundle for
StratagemSurvey.Used by
run_stratagem_preset(). Each preset describes an ordered sequence ofStratagemSurveymethod calls with default keyword arguments.- Variables:
- Parameters:
- class pycsamt.pipeline.StratagemPipeline(steps, *, coord_file=None, raw_dir=None, epsg=32649, utm_zone='49N', order='auto', rename_basename=None, rename_dir=None, name='stratagem_pipeline')#
Bases:
PipelineA
Pipelineextended with Stratagem pre/post-processing.Follows exactly the same
run(sites, *, outdir=...)interface as the standard pipeline. The sites argument is normalised viaensure_sites(), so it accepts:str/pathlib.Pathpointing to a directory of EDIsstr/pathlib.Pathpointing to a single EDI fileA single
EDIFileobjectA list of
EDIFileobjects
2.27. Optional pre-processing (applied before emtools steps)#
Coordinate injection — when coord_file is given, GPS coordinates from a CSV / XLS / XLSX table are written into each EDI
>HEADsection viaCoordinateInjector.Hardware SNR mask — when raw_dir is given, zero-stack frequency rows in the Stratagem raw files are masked in the impedance tensor via
FrequencyFilter.
2.27. Optional post-processing (applied after emtools steps)#
Rename — when rename_basename is given, the output EDI files in
<outdir>/processed/are copied to<outdir>/renamed/with a standardised naming convention usingEDIRenamer.
- param steps:
emtools processing steps (same format as
Pipeline).- type steps:
list of (str, Step) or list of Step
- param coord_file:
GPS coordinate table (CSV / XLS / XLSX).
- type coord_file:
path-like, optional
- param raw_dir:
Directory of raw Stratagem hardware files for hardware SNR masking.
- type raw_dir:
path-like, optional
- param epsg:
EPSG code of the projected CRS in coord_file.
- type epsg:
int, default 32649
- param utm_zone:
- type utm_zone:
str, default
'49N'- param order:
Station ordering for
StationLocator.- type order:
str, default
'auto'- param rename_basename:
When given, output EDIs are renamed
{basename}000.edi, …- type rename_basename:
str, optional
- param rename_dir:
Destination for renamed files. Defaults to
<outdir>/renamed/.- type rename_dir:
path-like, optional
- param name:
- type name:
str, default
'stratagem_pipeline'
Examples
Load a directory and inject coordinates:
from pycsamt.pipeline.stratagem import StratagemPipeline pipe = StratagemPipeline.from_preset( "stratagem_mt", coord_file="2.csv", epsg=32649, rename_basename="T2.", ) result = pipe.run("2/2EDI", outdir="2/processed") print(result.summary())
Single EDI file:
result = pipe.run("2/2EDI/Z2HX002.edi", outdir="tmp/single/")
Already-loaded Sites:
from pycsamt.emtools._core import ensure_sites S = ensure_sites("2/2EDI") result = pipe.run(S, outdir="2/processed")
Custom steps with hardware mask:
from pycsamt.pipeline import Step pipe = StratagemPipeline( [ ("ss", Step("SS001")), ("band", Step("FREQ001", band_hz=(10, 1e5))), ], coord_file="2.csv", raw_dir="原始数据/2HX", epsg=32649, ) result = pipe.run("2/2EDI", outdir="out/")
- run(sites, *, outdir=None, save_plots=True, save_edis=True, save_report=True, api=None, rename_basename=None, rename_dir=None, overwrite=False)#
Run the pipeline on sites.
- Parameters:
sites (Sites | str | Path | EDIFile | list[EDIFile]) – Input data. Any form accepted by
ensure_sites().outdir (path-like, optional) – Root output directory (same as
Pipeline.run()).save_plots (bool, default True)
save_edis (bool, default True)
save_report (bool, default True)
api (PipelineAPIConfig, optional)
rename_basename (str, optional) – Override the rename_basename set in
__init__.rename_dir (path-like, optional) – Override the rename_dir set in
__init__.overwrite (bool, default False) – Overwrite existing renamed files.
- Return type:
- classmethod from_preset(name='stratagem_mt', *, coord_file=None, raw_dir=None, epsg=32649, utm_zone='49N', order='auto', rename_basename=None, rename_dir=None, pipeline_name=None)#
Build a
StratagemPipelinefrom a named emtools preset.- Parameters:
name (str, default
'stratagem_mt') – Any preset inPRESETS(e.g.'stratagem_mt','full_processing','publication_ready').coord_file (str | Path | None) – Forwarded to the constructor.
epsg (int) – Forwarded to the constructor.
utm_zone (str) – Forwarded to the constructor.
order (str) – Forwarded to the constructor.
rename_basename (str | None) – Forwarded to the constructor.
rename_dir (str | Path | None) – Forwarded to the constructor.
pipeline_name (str, optional) – Override the pipeline label.
- Return type:
Examples
>>> pipe = StratagemPipeline.from_preset( ... "stratagem_mt", ... coord_file="2.csv", ... epsg=32649, ... rename_basename="T2.", ... ) >>> result = pipe.run("2/2EDI", outdir="2/processed")
- pycsamt.pipeline.get_stratagem_preset(name)#
Return the
StratagemPresetfor name.- Parameters:
name (str)
- Return type:
- pycsamt.pipeline.list_stratagem_presets()#
Return all
StratagemPresetobjects.- Return type:
- pycsamt.pipeline.run_stratagem_preset(preset, edi_dir, coord_file, outdir, *, raw_dir=None, epsg=32649, utm_zone='49N', rename_basename='S', rename_dir=None, step_overrides=None, overwrite=False, verbose=0)#
Execute a named Stratagem preset in one call (convenience wrapper).
Uses
StratagemSurveyinternally for the full EDI-directory + GPS-CSV workflow. For the pipeline-style API (run(sites, outdir=...)) useStratagemPipelinedirectly.- Parameters:
preset ({'basic', 'full_processing', 'publication_ready'})
edi_dir (path-like)
coord_file (path-like)
outdir (path-like)
raw_dir (path-like, optional)
epsg (int, default 32649)
utm_zone (str, default
'49N')rename_basename (str, default
'S')rename_dir (path-like, optional)
step_overrides (dict, optional) – Per-step parameter overrides (see
StratagemPipeline).overwrite (bool, default False)
verbose (int, default 0)
- Returns:
The completed survey object.
- Return type:
Examples
Replicate the legacy script:
sv = run_stratagem_preset( "basic", edi_dir="2/2EDI", coord_file="2.csv", outdir="2/processed", epsg=32649, rename_basename="T2.", )
With hardware files:
sv = run_stratagem_preset( "full_processing", edi_dir="2/2EDI", coord_file="2.csv", outdir="2/processed", raw_dir="原始数据/2HX", epsg=32649, rename_basename="T2.", )
- pycsamt.pipeline.stratagem_preset_catalogue()#
Return a formatted catalogue of all Stratagem presets.
- Return type:
- pycsamt.pipeline.configure_pipe(**kw)#
Configure the global
PYCSAMT_PIPEsingleton.- Parameters:
kw (Any)
- Return type:
None
- pycsamt.pipeline.reset_pipe()#
Reset
PYCSAMT_PIPEto package defaults.- Return type:
None
2.27.2. Pipeline Modules#
|
Core Pipeline class for the pyCSAMT processing engine. |
|
Step and StepResult — user-facing wrappers around StepSpec entries. |
|
Step registry for the pyCSAMT processing pipeline. |
|
Entry-point discovery for third-party pipeline steps. |
|
Content-addressed disk cache for pipeline step outputs. |
|
Append-only run history log for |
|
Live rich.table.Table rendering for |
|
Named pipeline presets for common MT processing workflows. |
|
Data-driven ("smart") QC plot gating for method-aware presets. |
|
Random-station raw-vs-processed preview for method-aware presets. |
|
Config-file loaders for the pyCSAMT pipeline. |
|
Output-directory management for the pyCSAMT pipeline. |
|
Pipeline report generators. |
|
The "dashboard" report tier — a branded, chart-carrying HTML report. |
|
Base class for pyCSAMT pipeline objects. |
|
Opt-in AI-backed pipeline step: the domain-gap survey audit. |
|
pipeline.stratagem |
|
Plot helpers for |