phenotypic.sdk_.PreparedImageTables#

class phenotypic.sdk_.PreparedImageTables(measurements: pd.DataFrame, metadata: pd.DataFrame | None, measurement_columns: tuple[str, ...], join_status: JoinStatus, join_keys: tuple[str, ...], metadata_snapshot_sha256: str)[source]#

Bases: object

One image’s measurement rows and, separately, its user metadata rows.

Spec §7.1-7.2’s inversion. measurements is the pre-join baseline – intrinsic identity (Metadata_ImageFile, Metadata_Dataset, the object label) plus the measured columns, and nothing that came from --metadata. metadata is the projection of the run’s metadata snapshot onto the join keys this image actually carries, or None when there is no such projection to make.

The join provenance below describes the metadata table, not the measurements table. After the inversion the measurements table carries no join at all, so its own recorded triple is not_requested / [] / "" – which is what measurements_payload() builds, and the one place that rule lives.

Parameters:
  • measurements (pd.DataFrame)

  • metadata (pd.DataFrame | None)

  • measurement_columns (tuple[str, ...])

  • join_status (JoinStatus)

  • join_keys (tuple[str, ...])

  • metadata_snapshot_sha256 (str)

measurements#

The unjoined baseline, exactly the projection measurement_columns already named.

Type:

pandas.core.frame.DataFrame

metadata#

User metadata rows for this image’s keys, or None when join_status is not_requested or no_common_keys.

Type:

pandas.core.frame.DataFrame | None

measurement_columns#

Baseline column names, in writer order.

Type:

tuple[str, …]

join_status#

Whether a metadata join was requested, possible, or done.

Type:

Literal[‘not_requested’, ‘joined’, ‘no_common_keys’]

join_keys#

The common columns the metadata table is keyed on.

Type:

tuple[str, …]

metadata_snapshot_sha256#

Digest of the metadata.csv snapshot this image was prepared against; "" when none was supplied.

Type:

str

Methods

__init__

measurements_payload

Return the measurements table's own payload, carrying no join.

metadata_parquet_metadata

Return the metadata table's own join provenance as Arrow metadata.

Attributes

measurements: DataFrame#
metadata: DataFrame | None#
measurement_columns: tuple[str, ...]#
join_status: Literal['not_requested', 'joined', 'no_common_keys']#
join_keys: tuple[str, ...]#
metadata_snapshot_sha256: str#
measurements_payload() PreparedEmbeddedMeasurementTable[source]#

Return the measurements table’s own payload, carrying no join.

The triple is not_requested / () / "" unconditionally, because after the inversion the statement “this file is the result of a join” is false of tables/measurements/table.parquet on every store. That is also exactly the shape _valid_embedded_measurement_contract() already accepts, so the contract needs no change for this file.

Return type:

PreparedEmbeddedMeasurementTable

metadata_parquet_metadata() dict[bytes, bytes][source]#

Return the metadata table’s own join provenance as Arrow metadata.

The same key spellings the measurement table uses – one home for the names – minus measurement_columns, which says nothing about this file. This is what makes pht-metadata.parquet self-describing to a reader who has only the Parquet: it names the keys it is joined on, the direction of the join, and the snapshot it came from.

Return type:

dict[bytes, bytes]