phenotypic.sdk_.read_embedded_measurement_descriptor#

phenotypic.sdk_.read_embedded_measurement_descriptor(store_path: Path) dict[str, object][source]#

Return one store’s tables.measurements descriptor.

The descriptor is the store’s own account of its embedded table: the payload path, the measurement_columns list, and the target naming the join column and the label image it indexes. Reading it costs one small JSON parse and never opens the Parquet payload, so a caller that only needs the column list – a column picker, say – pays nothing for the ~130 columns it does not want.

Parameters:

store_path (Path) – Path to a *.ome.zarr directory.

Returns:

The descriptor mapping, exactly as build_measurement_table_descriptor() wrote it.

Raises:
  • OSError – If the store’s root zarr.json does not exist.

  • KeyError – If the root carries no phenotypic block, or the block declares no tables.measurements descriptor. An absent descriptor is a normal state, not a fault: a --mode     process run never measures, and a store written before embedded tables has none.

  • ValueError – If the store’s store_schema_version is not this build’s – the same refusal every other content reader makes.

Return type:

dict[str, object]

Examples

>>> import tempfile
>>> from pathlib import Path
>>> from phenotypic import GridImage
>>> from phenotypic.data import load_synth_yeast_plate
>>> img = GridImage(load_synth_yeast_plate())
>>> with tempfile.TemporaryDirectory() as tmp:
...     store = img.save2zarr(Path(tmp) / 'plate.ome.zarr')
...     try:
...         read_embedded_measurement_descriptor(store)
...     except KeyError:
...         print('no embedded table')
no embedded table