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_sites flag: False for diagnostic-only (plot) steps that do not transform the Sites object.

Functions

categories()

Return a sorted list of distinct step categories.

list_steps([category])

Return all registered StepSpec objects, optionally filtered.

lookup_step(code_or_name)

Return the StepSpec for code_or_name.

step_codes()

Return a sorted list of all step codes.

step_names()

Return a sorted list of all step names.

Classes

StepSpec(code, name, label, category[, ...])

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)[source]#

Bases: object

Immutable 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. None when override_fn is provided.

  • fn_name (str | None) – Name of the transform function inside mod. None when 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.

code: str#
name: str#
label: str#
category: str#
defaults: dict#
returns_sites: bool = True#
mod: str | None = None#
fn_name: str | None = None#
qc_defs: list[tuple[str, str]]#
override_fn: Callable | None = None#
get_fn()[source]#

Return (lazily imported) transform function.

Return type:

Callable

get_qc_fns()[source]#

Return list of (fn_name, callable) QC plot functions.

Return type:

list[tuple[str, Callable]]

pycsamt.pipeline._registry.lookup_step(code_or_name)[source]#

Return the StepSpec for code_or_name.

Parameters:

code_or_name (str) – Either the uppercase code ("NR001") or the snake-case name ("notch_powerline").

Raises:

KeyError – When neither a code nor a name matches.

Return type:

StepSpec

pycsamt.pipeline._registry.list_steps(category=None)[source]#

Return all registered StepSpec objects, optionally filtered.

Parameters:

category (str | None) – When supplied, only steps whose category matches this string are returned.

Return type:

list[StepSpec]

pycsamt.pipeline._registry.step_codes()[source]#

Return a sorted list of all step codes.

Return type:

list[str]

pycsamt.pipeline._registry.step_names()[source]#

Return a sorted list of all step names.

Return type:

list[str]

pycsamt.pipeline._registry.categories()[source]#

Return a sorted list of distinct step categories.

Return type:

list[str]