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:
objectAn intermediate HDF5 file saved after a single pipeline operation.
- class phenotypic.gui.sweep.PipelineConfig(name: str, config_group: str, operations: List[Dict], measurements: List[Dict], raw_json: dict)[source]#
Bases:
objectParsed configuration for one pipeline from the sweep manifest.
- Parameters:
- class phenotypic.gui.sweep.ResolvedLayerSources(rgb: Path | None = None, gray: Path | None = None, detect_mat: Path | None = None, objmap: Path | None = None)[source]#
Bases:
objectFor a given step, maps each layer name to its source HDF5 path.
- class phenotypic.gui.sweep.SweepHDF5File(path: Path, image_stem: str, pipeline_name: str)[source]#
Bases:
objectA single HDF5 result file in the sweep output.
- 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:
objectFully indexed sweep output ready for the viewer widgets.
- Parameters:
root_dir (Path)
manifest_raw (dict)
pipeline_configs (Dict[str, PipelineConfig])
hdf5_files (List[SweepHDF5File])
by_pipeline (Dict[str, Dict[str, SweepHDF5File]])
by_image (Dict[str, Dict[str, SweepHDF5File]])
intermediates (Dict[str, Dict[str, List[IntermediateStep]]])
- hdf5_files: List[SweepHDF5File]#
- pipeline_configs: Dict[str, PipelineConfig]#
- class phenotypic.gui.sweep.SweepOutputScanner[source]#
Bases:
objectScan 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
Noneto use the current working directory.- Returns:
Resolved path that contains
sweep_manifest.json.- Raises:
FileNotFoundError – If no manifest is found in path.
- Return type:
- 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.jsonandresults/).- Returns:
Fully populated
SweepOutputData.- Raises:
FileNotFoundError – If sweep_dir or its manifest is missing.
- Return type:
- 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: