playnano.analysis.base module

Module holding the AnalysisModule base class.

class playnano.analysis.base.AnalysisModule[source]

Bases: ABC

Abstract base class for analysis steps.

Subclasses must implement:

  • a name property returning a unique string identifier

  • a run(stack, previous_results=None, **params) -> dict method

Inherits from abc.ABC.

abstract property name: str

Unique name for this analysis module, e.g. “particle_detect”.

Used by pipeline to identify and refer to the module.

abstract run(stack: AFMImageStack, previous_results: dict[str, Any] | None = None, **params) dict[str, Any][source]

Perform the analysis on the given AFMImageStack.

Parameters:
  • stack (AFMImageStack) – The AFMImageStack instance, containing .data and metadata.

  • previous_results (dict[str, Any] or None, optional) – Outputs from earlier modules in the pipeline, if any.

  • **params (dict) – Module-specific parameters, e.g., threshold, min_size, etc.

Returns:

Dictionary mapping output names (strings) to results. Example:

{
    "coords": numpy.ndarray of shape (N, 3),
    "masks": numpy.ndarray of shape (n_frames, H, W)
}

Return type:

AnalysisOutputs

Notes

Subclasses must implement this method. The returned dictionary can contain any data the analysis module produces, but must be keyed by unique output names.