coco_pipe.descriptors.naming#

Descriptor column-name contract.

The descriptor extractors emit column names of the form {family}_{feature}_{ch|chgrp}-{sensor} (see DescriptorPipeline). Parsing that contract is descriptor-domain knowledge, so it lives here next to the family QC that consumes it (coco_pipe.descriptors.qc) and shares the single DESCRIPTOR_SCOPE_RE.

Functions#

split_family_token(text, known_families)

Split text into (family, remainder) on the first known family token.

parse_descriptor_feature_column(column, known_families)

Strictly parse one descriptor column into its constituent parts.

Module Contents#

coco_pipe.descriptors.naming.split_family_token(text, known_families)#

Split text into (family, remainder) on the first known family token.

The family token may appear as a leading prefix ("band_...") or embedded ("mean_band_..."). Returns (None, text) when no known family token is present. Shared by parse_descriptor_feature_column() and the family classifier so the token-matching rule lives in one place.

Parameters:
Return type:

tuple[str | None, str]

coco_pipe.descriptors.naming.parse_descriptor_feature_column(column, known_families)#

Strictly parse one descriptor column into its constituent parts.

Parameters:
  • column (str) – Descriptor column name, e.g. "band_abs_alpha_ch-Fz".

  • known_families (tuple[str, Ellipsis]) – Recognised family prefix tokens (e.g. KNOWN_FAMILY_TOKENS).

Returns:

Keys column, family, feature, scope ("sensor" / "sensor_group"), and sensor.

Return type:

dict[str, str]

Raises:

ValueError – If the column does not match the scope contract or contains no known family token.