2.27.2.3. pycsamt.pipeline._registry#
Step registry for the pyCSAMT processing pipeline.
Every processing operation exposed by pycsamt.emtools is described by a
StepSpec entry in STEP_REGISTRY. Each entry carries:
A short code (e.g.
"NR001") and a human name (e.g."notch_powerline") so users can look up steps either way.The module path and function name needed to import the transform lazily (avoiding circular imports at startup).
An optional override_fn for two-phase steps (SS002/SS003) and wrapper steps (NR007) that cannot be described by a single function reference.
A list of (module, fn_name) pairs for QC / diagnostic plot functions that the pipeline calls automatically after each step.
Default parameters merged with any user-supplied overrides.
A
returns_sitesflag:Falsefor diagnostic-only (plot) steps that do not transform the Sites object.
Functions
|
Return a sorted list of distinct step categories. |
|
Return all registered |
|
Return the |
|
Register a third-party |
|
Return a sorted list of all step codes. |
|
Return a sorted list of all step names. |
|
Remove a previously-registered step from the pipeline registry. |
Classes
|
Immutable descriptor for one pipeline step. |
- class pycsamt.pipeline._registry.StepSpec(code, name, label, category, defaults=<factory>, returns_sites=True, mod=None, fn_name=None, qc_defs=<factory>, override_fn=None, origin='builtin')[source]
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.
- code: str
- name: str
- label: str
- category: str
- defaults: dict
- returns_sites: bool = True
- origin: str = 'builtin'
- pycsamt.pipeline._registry.list_steps(category=None)[source]
Return all registered
StepSpecobjects, optionally filtered.
- pycsamt.pipeline._registry.step_codes()[source]
Return a sorted list of all step codes.
- pycsamt.pipeline._registry.step_names()[source]
Return a sorted list of all step names.
- pycsamt.pipeline._registry.categories()[source]
Return a sorted list of distinct step categories.
- pycsamt.pipeline._registry.register_step(spec, *, replace_existing=False, validate=True)[source]
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._registry.unregister_step(code_or_name, *, missing_ok=False)[source]
Remove a previously-registered step from the pipeline registry.