phenotypic.gui.sweep package#

Napari-based viewer for browsing sweep output directories.

Launch from the command line:

uv run python -m phenotypic.gui.sweep [path/to/sweep_output]

Or use programmatically:

from phenotypic.gui.sweep import NapariSweepViewer, launch_sweep_viewer
launch_sweep_viewer(Path("./sweep_output"))
class phenotypic.gui.sweep.IntermediateStep(index: int, operation_name: str, h5_path: Path, layers: tuple[str, ...] = (), is_base: bool = False)[source]#

Bases: object

An intermediate HDF5 file saved after a single pipeline operation.

Parameters:
h5_path: Path#
index: int#
is_base: bool = False#
layers: tuple[str, ...] = ()#
operation_name: str#
class phenotypic.gui.sweep.PipelineConfig(name: str, config_group: str, operations: List[Dict], measurements: List[Dict], raw_json: dict)[source]#

Bases: object

Parsed configuration for one pipeline from the sweep manifest.

Parameters:
config_group: str#
measurements: List[Dict]#
name: str#
operations: List[Dict]#
raw_json: dict#
class phenotypic.gui.sweep.ResolvedLayerSources(rgb: Path | None = None, gray: Path | None = None, detect_mat: Path | None = None, objmap: Path | None = None)[source]#

Bases: object

For a given step, maps each layer name to its source HDF5 path.

Parameters:
  • rgb (Path | None)

  • gray (Path | None)

  • detect_mat (Path | None)

  • objmap (Path | None)

detect_mat: Path | None = None#
gray: Path | None = None#
objmap: Path | None = None#
rgb: Path | None = None#
class phenotypic.gui.sweep.SweepHDF5File(path: Path, image_stem: str, pipeline_name: str)[source]#

Bases: object

A single HDF5 result file in the sweep output.

Parameters:
  • path (Path)

  • image_stem (str)

  • pipeline_name (str)

image_stem: str#
path: Path#
pipeline_name: str#
class phenotypic.gui.sweep.SweepOutputData(root_dir: ~pathlib.Path, manifest_raw: dict, pipeline_configs: ~typing.Dict[str, ~phenotypic.gui.sweep._sweep_data_model.PipelineConfig], hdf5_files: ~typing.List[~phenotypic.gui.sweep._sweep_data_model.SweepHDF5File], pipeline_names: ~typing.List[str], image_stems: ~typing.List[str], by_pipeline: ~typing.Dict[str, ~typing.Dict[str, ~phenotypic.gui.sweep._sweep_data_model.SweepHDF5File]] = <factory>, by_image: ~typing.Dict[str, ~typing.Dict[str, ~phenotypic.gui.sweep._sweep_data_model.SweepHDF5File]] = <factory>, intermediates: ~typing.Dict[str, ~typing.Dict[str, ~typing.List[~phenotypic.gui.sweep._sweep_data_model.IntermediateStep]]] = <factory>)[source]#

Bases: object

Fully indexed sweep output ready for the viewer widgets.

Parameters:
by_image: Dict[str, Dict[str, SweepHDF5File]]#
by_pipeline: Dict[str, Dict[str, SweepHDF5File]]#
hdf5_files: List[SweepHDF5File]#
image_stems: List[str]#
intermediates: Dict[str, Dict[str, List[IntermediateStep]]]#
manifest_raw: dict#
pipeline_configs: Dict[str, PipelineConfig]#
pipeline_names: List[str]#
root_dir: Path#
class phenotypic.gui.sweep.SweepOutputScanner[source]#

Bases: object

Scan and index a sweep output directory.

static detect_sweep_dir(path: Path | None = None) Path[source]#

Find the sweep output directory.

Parameters:

path (Path | None) – Explicit directory, or None to use the current working directory.

Returns:

Resolved path that contains sweep_manifest.json.

Raises:

FileNotFoundError – If no manifest is found in path.

Return type:

Path

static scan(sweep_dir: Path) SweepOutputData[source]#

Scan a sweep output directory and build lookup indexes.

Parameters:

sweep_dir (Path) – Root of the sweep output (contains sweep_manifest.json and results/).

Returns:

Fully populated SweepOutputData.

Raises:

FileNotFoundError – If sweep_dir or its manifest is missing.

Return type:

SweepOutputData

phenotypic.gui.sweep.__getattr__(name: str)[source]#

Lazy-import napari-dependent classes.

Parameters:

name (str)

phenotypic.gui.sweep.build_layer_resolution_index(steps: list[IntermediateStep]) dict[int, ResolvedLayerSources][source]#

Build a mapping from step index to resolved layer sources.

For each step, determines which HDF5 file contains the most recent version of each layer by scanning forward through the step list.

Parameters:

steps (list[IntermediateStep]) – Sorted list of intermediate steps.

Returns:

Dict mapping step index to ResolvedLayerSources.

Return type:

dict[int, ResolvedLayerSources]