spacr.qt.widgets.annotation_strategy_panel¶
Annotation-strategy controls and reports for the Cells montage.
The panel selects from the object rows, guide wells, and score column shown in
the montage. Strategy execution runs in a worker thread, while selection,
hold-out construction, model fitting, and reporting are implemented by
spacr.regression_annotation.
Classes¶
Configure and run cell-annotation strategies from a montage. |
Functions¶
|
Return unique guide wells referenced by montage plans. |
Module Contents¶
- class spacr.qt.widgets.annotation_strategy_panel.AnnotationStrategyPanel(objects_provider: Callable[[], Any] | None = None, wells_provider: Callable[[], Sequence[str]] | None = None, score_provider: Callable[[], str] | None = None, folder_provider: Callable[[], str] | None = None, parent: PySide6.QtWidgets.QWidget | None = None, *, threaded: bool = True)[source]¶
Bases:
PySide6.QtWidgets.QWidgetConfigure and run cell-annotation strategies from a montage.
- Parameters:
objects_provider – Callable returning candidate object rows, or
Nonebefore montage data are available.wells_provider – Callable returning selected guide wells.
score_provider – Callable returning the per-object score column.
folder_provider – Callable returning the default output directory.
parent – Parent widget.
threaded – Run computation in a worker thread. Inline execution is intended for deterministic testing only.
- Variables:
finished – Emitted with the strategy key after a successful run.
Build the panel that proposes which objects to annotate next.
Every input arrives through a provider rather than being passed in: the panel is built before the run it describes exists, and asking at use time is what lets it follow a screen whose table has since changed.
- Parameters:
objects_provider – called for the object table.
wells_provider – called for the wells in play.
score_provider – called for the score column to rank on.
folder_provider – called for the run folder to write into.
parent – parent widget, or
None.threaded – propose on a worker thread. Set
Falsein tests so a proposal finishes before it returns.
- closeEvent(event)[source]¶
Stop active work when the panel closes.
- Parameters:
event – the close event, passed on to the base class after the strategy worker is shut down.
- reason() str[source]¶
Return the reason the selected strategy cannot run, or
''.The check uses the loaded rows and current controls, so unsupported data are identified when the strategy is selected rather than after a model fit has started.
- run() bool[source]¶
Run the selected strategy in the configured job runner.
- Returns:
Trueif execution was submitted; otherwiseFalse.
- save(folder: str | None = None) Dict[str, str][source]¶
Write selected cells, hold-out data, predictions, and the report.
- Parameters:
folder – Output directory. If omitted, a directory chooser is displayed.
- Returns:
Mapping from output type to path, or an empty mapping if no files were written.
Nested helpers¶
- AnnotationStrategyPanel.run.work()¶
Run the annotation strategy. Off the GUI thread.
spacr/qt/widgets/annotation_strategy_panel.py:608