spacr.qt.assay_examples

Test data for the assay modules: a measured plate, one button away.

Replication, Invasion, Recruitment and Host–Pathogen offer published datasets through Load test data. Host–Pathogen contains two real THP-1 RNF213 fields, prepared host/nucleus/vacuole masks and fresh measurements of those fields. Replication and Recruitment contain slices of measured screens. Invasion’s images are synthetic and explicitly labelled before downloading. Its masks are Cellpose-SAM segmentations from Mask, and its ground truth describes the objects originally drawn into those images.

All four read <src>/measurements/measurements.db and apply the settings shipped in their archive. spacr.example_archives.EXAMPLE_SETS describes the same datasets for the GUI and spacr-download.

ITS OWN FOLDER PER SET. Both ship measurements/measurements.db, as the Annotate example in the shared plate does, so each unpacks beside that plate (spacr.example_archives.example_set_folder()) rather than into it.

THE SAME PATTERN AS THE OTHER EXAMPLES. One uncompressed .tar streamed to a .part file on a worker thread behind the shared progress dialog, unpacked through the tar data filter, <dataset> in the settings replaced with where it landed, and cached: a second press uses the copy on disk.

Functions

download_assay_example(→ None)

Fetch app_key's test data behind the shared progress dialog.

install_assay_example_button(...)

Put the "Load test data…" button at the top of section.

load_the_assay_example(→ Dict)

Fill the module in with its test data, downloading it first if needed.

put_the_assay_example_in_place(→ Dict)

Apply the settings that shipped with the data and point src at it.

Module Contents

spacr.qt.assay_examples.download_assay_example(parent, app_key: str, dest, on_done: Callable[[spacr.qt.hf_download.DownloadResult | None, str], None]) → None[source]

Fetch app_key’s test data behind the shared progress dialog.

Parameters:
  • parent – the widget the progress dialog belongs to.

  • app_key – replication, recruitment, invasion or host_pathogen.

  • dest – the folder the archive unpacks into.

  • on_done – called on the GUI thread as on_done(result, error); result is None on failure or cancellation.

spacr.qt.assay_examples.install_assay_example_button(screen, section) → PySide6.QtWidgets.QPushButton[source]

Put the “Load test data…” button at the top of section.

Parameters:
  • screen – the module screen; its app_key picks the set. The button is kept on it as _assay_example_button.

  • section – the settings section the button goes in.

Returns:

the button.

spacr.qt.assay_examples.load_the_assay_example(screen, *, ask=None, folder=None) → Dict[source]

Fill the module in with its test data, downloading it first if needed.

A complete cached copy is used at once. Otherwise the button is disabled while the download runs on a worker thread, and the settings are applied when it finishes.

Parameters:
  • screen – the module screen.

  • ask – replaces download_assay_example(), for tests; called as ask(screen, folder, on_done).

  • folder – replaces the set’s cache folder, for tests.

Returns:

{"src": folder} once the data is in place; empty while a download is still running, and after a failure.

spacr.qt.assay_examples.put_the_assay_example_in_place(screen, folder) → Dict[source]

Apply the settings that shipped with the data and point src at it.

Parameters:
  • screen – the module screen.

  • folder – where the set was unpacked.

Returns:

{"src": ...}, the value the field ends up holding.

Nested helpers

download_assay_example._factory(where)

Build the worker for this set’s repository.

spacr/qt/assay_examples.py:122

load_the_assay_example._done(result, error)

Put the button back, then fill the settings in or say why not.

spacr/qt/assay_examples.py:175

load_the_assay_example.ask(parent, dest, on_done)

Start this module’s download.

spacr/qt/assay_examples.py:189