phenotypic.schema#

Public measurement schema for the PhenoTypic library.

This subpackage is the canonical, public home for PhenoTypic’s measurement naming conventions: the MeasurementInfo base class plus every MeasurementInfo subclass that names a column in an output DataFrame. Each enum lives in its own module (_<name>.py) and is re-exported here, so the public import surface stays stable:

from phenotypic.schema import MeasurementInfo, BBOX, GRID, SHAPE

It also hosts the metadata vocabulary: IMAGE (framework-populated image bookkeeping) and eight semantic owners (GENETIC, SAMPLE, PLATE, CONDITION, CULTURE, ACQUISITION, EXPERIMENT, and STUDY) that standardize Metadata_* columns for the --metadata join and post/ operations.

Functions

parse_qualified_header

Inverse of qualified_header() for one enum.

qualified_header

Runtime output header {Family}_{token}_{label}.

header_to_module

Map every known column header to its REMBI module.

Classes

Entry

Declarative value for a MeasurementInfo member.

CATEGORIES

Repo-defined measurement categories.

CategoryEntry

Declarative value for a CATEGORIES member.

MeasurementInfo

Base class for creating standardized measurement information enumerations.

MetadataInfo

Identity information owned by a concrete metadata vocabulary.

REMBI_MODULE

REMBI metadata modules.

METADATA_MATCH

Metadata-join provenance flags attached to the post-applied mirror.

IMAGE

Framework-populated image metadata keys.

GENETIC

Recommended metadata tags describing the organism and its genetics.

SAMPLE

Recommended metadata tags identifying a sample and its provenance.

PLATE

Recommended metadata tags describing the assay plate and its array.

CONDITION

Recommended metadata tags describing media and experimental conditions.

CULTURE

Recommended metadata tags describing culture and time course.

EXPERIMENT

Recommended metadata tags for experiment-level bookkeeping.

STUDY

Recommended metadata tags for the REMBI Study component.

ACQUISITION

Recommended metadata tags describing image acquisition.

BBOX

Extract bounding box coordinates and centroids of detected colonies.

ColorComposition

Classify colony pixels into 11 perceptual color categories and measure composition.

ColorHSV

Robust HSV summary for a colony.

ColorLab

Robust CIE L*a*b* colorimetric summary for a colony.

Colorxy

Measure colony color statistics across multiple perceptual color spaces.

ColorXYZ

Measure colony color statistics across multiple perceptual color spaces.

CURATION

Curation-state columns attached to derived measurement frames.

LINEAR_CAP_AND_LAG_MODEL

Fitted parameters of the double-softplus growth model (with saturation).

EDGE_CORRECTION

Measurement info container for edge correction analysis results.

ErrorCategory

Closed taxonomy of detection-error categories for object triage.

GRID

Constants for grid structure in the PhenoTypic module.

GRID_LINREG_STATS

Evaluate grid alignment quality using row-wise and column-wise linear regression.

NEIGHBOR_DIST

Measure distances from each colony to its grid neighbours and its nearest object.

GRID_SPREAD

Quantify within-well colony dispersion using pairwise centroid distances.

INTENSITY

Measure grayscale intensity statistics of detected colonies.

LINEAR_LAG_MODEL

Fitted parameters of the linear-softplus lag model (no saturation).

LOG_GROWTH_MODEL

Fitted parameters and bounds of the logistic growth model.

MODEL_METRICS

Generic fit-quality metrics and diagnostics shared by all ModelFitter subclasses.

OBJECT

Per-object identifier shared by every measurement table.

QUALITY_CHECK

Generic QC output columns emitted by every QualityCheck subclass.

QUALITY_COUNT

Measurement info for the expected-vs-detected colony count QC check.

QUALITY_ICC

Measurement info for the replicate-agreement ICC QC check.

QUALITY_MAD

Measurement info for the replicate-agreement MAD QC check.

QUALITY_OCCUPANCY

Measurement info for the grid-occupancy QC check.

QUALITY_SE

Measurement info for the replicate-agreement standard-error QC check.

QUALITY_TUKEY

Measurement info for the replicate-agreement Tukey-fence QC check.

QUALITY_ZMAX

Measurement info for the replicate-agreement modified Z-score QC check.

RADIAL_EXPANSION

Radial expansion measurements for filamentous fungal colonies.

SHAPE

Measure the form of each detected colony.

SIZE

Measure the key size magnitudes of each detected colony.

ORIENTATION_ZONES

alias of ORIENTATION_ZONE_DIAGNOSTIC

ORIENTATION_ZONE_DIAGNOSTIC

Opt-in validation, comparator, and legacy orientation-zone columns.

ORIENTATION_ZONE_PRIMARY

Primary outward-rotation traits over resolved branch zones.

SYMMETRIC_ZONES

Radial expansion, symmetry, and branch-orientation zone geometry.

TEXTURE

Second-order texture features derived from the gray-level co-occurrence matrix (GLCM).

class phenotypic.schema.ACQUISITION(*values)[source]

Bases: MetadataInfo

Recommended metadata tags describing image acquisition.

These record how and by whom an image was captured (acquisition date, instrument, operator, resolution, exposure). Members render in the shared Metadata_<Label> namespace with the other experimental-tag enums. Recommended vocabulary, not a validator.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

EXPERIMENTER = 'Metadata_Experimenter'
EXPOSURE_TIME = 'Metadata_ExposureTime'
IMAGING_DATE = 'Metadata_ImagingDate'
INSTRUMENT = 'Metadata_Instrument'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

RESOLUTION = 'Metadata_Resolution'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.BBOX(*values)[source]

Bases: IdentityInfo

Extract bounding box coordinates and centroids of detected colonies.

Compute the axis-aligned bounding box and centroid (geometric and intensity-weighted) for each detected colony. These spatial measurements form the foundation for region-of-interest extraction, grid alignment assessment, and neighbor-distance calculations.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

CENTER_CC = 'Bbox_CenterCC'
CENTER_RR = 'Bbox_CenterRR'
DIST_WEIGHTED_CENTER_CC = 'Bbox_DistWeightedCenterCC'
DIST_WEIGHTED_CENTER_RR = 'Bbox_DistWeightedCenterRR'
INTENSITY_WEIGHTED_CENTER_CC = 'Bbox_IntensityWeightedCenterCC'
INTENSITY_WEIGHTED_CENTER_RR = 'Bbox_IntensityWeightedCenterRR'
MAX_CC = 'Bbox_MaxCC'
MAX_RR = 'Bbox_MaxRR'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

MIN_CC = 'Bbox_MinCC'
MIN_RR = 'Bbox_MinRR'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.CATEGORIES(*values)[source]

Bases: str, Enum

Repo-defined measurement categories.

Each member’s value is its label (no metric-family prefix). Members expose label, desc, display_name and anchor.

classmethod in_order(categories: Iterable[CATEGORIES]) → tuple[CATEGORIES, ...][source]

Return categories sorted by declaration order.

Parameters:

categories (Iterable[CATEGORIES])

Return type:

tuple[CATEGORIES, …]

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

members() → tuple[MeasurementInfo, ...][source]

Every public schema member carrying this category.

Ordered by phenotypic.schema.__all__ export order, then member order; compatibility aliases are deduplicated to their class. Deliberately not cached: it walks ~40 classes and is called only by docs and tests, and caching would hide classes registered later.

Return type:

tuple[MeasurementInfo, …]

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

STARTING_METRICS = 'StartingMetrics'
property anchor: str

Stable Sphinx label of this category’s section on the Categories page.

desc: str
property display_name: str

the label split on CamelCase boundaries.

Type:

Human-readable name

label: str
class phenotypic.schema.CONDITION(*values)[source]

Bases: MetadataInfo

Recommended metadata tags describing media and experimental conditions.

These name the chemical environment and perturbations applied to the colonies (medium, carbon/nitrogen source, supplements, treatments, compounds, stress). Members render in the shared Metadata_<Label> namespace with the other experimental-tag enums. Recommended vocabulary, not a validator.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ANTIBIOTIC = 'Metadata_Antibiotic'
CARBON_SOURCE = 'Metadata_CarbonSource'
COMPOUND = 'Metadata_Compound'
CONCENTRATION = 'Metadata_Concentration'
DOSE = 'Metadata_Dose'
INDUCER = 'Metadata_Inducer'
MEDIA = 'Metadata_Media'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NITROGEN_SOURCE = 'Metadata_NitrogenSource'
PH = 'Metadata_pH'
SALINITY = 'Metadata_Salinity'
STRESS = 'Metadata_Stress'
SUPPLEMENT = 'Metadata_Supplement'
TREATMENT = 'Metadata_Treatment'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.CULTURE(*values)[source]

Bases: MetadataInfo

Recommended metadata tags describing culture and time course.

These capture the temporal and environmental culture parameters of an experiment (temperature, elapsed time, timepoint, generation, atmosphere). Time/Timepoint align with the QC time-series axis. Members render in the shared Metadata_<Label> namespace with the other experimental-tag enums. Recommended vocabulary, not a validator.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ATMOSPHERE = 'Metadata_Atmosphere'
DAY = 'Metadata_Day'
FRAME_INDEX = 'Metadata_FrameIndex'
GENERATION = 'Metadata_Generation'
HUMIDITY = 'Metadata_Humidity'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

TEMPERATURE = 'Metadata_Temperature'
TIME = 'Metadata_Time'
TIMEPOINT = 'Metadata_Timepoint'
TIME_UNIT = 'Metadata_TimeUnit'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.CURATION(*values)[source]

Bases: QualityInfo

Curation-state columns attached to derived measurement frames.

Curation_Category carries the ErrorCategory bare label (or a custom category token) for each removed object in the per-category error parquets.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ERROR_CATEGORY = 'Curation_Category'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.CategoryEntry(label: str, desc: str)[source]

Bases: object

Declarative value for a CATEGORIES member.

Parameters:
  • label (str) – CamelCase token used as the output file stem and anchor slug (e.g. "StartingMetrics").

  • desc (str) – Technical description of what the category groups and why.

desc: str
label: str
class phenotypic.schema.ColorComposition(*values)[source]

Bases: DiscriminativeFeature

Classify colony pixels into 11 perceptual color categories and measure composition.

Applies a priority-based color model (neutrals → special colors → hues) to classify each colony pixel into one of 11 categories: Black, White, Gray, Pink, Brown, Red, Orange, Yellow, Green, Cyan, Blue, Purple. Returns per-colony percentage breakdowns as DataFrame columns.

classmethod all_headers()[source]

Return all color composition measurement headers.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

BLACK_PCT = 'ColorComposition_BlackPct'
BLUE_PCT = 'ColorComposition_BluePct'
BROWN_PCT = 'ColorComposition_BrownPct'
CYAN_PCT = 'ColorComposition_CyanPct'
GRAY_PCT = 'ColorComposition_GrayPct'
GREEN_PCT = 'ColorComposition_GreenPct'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

ORANGE_PCT = 'ColorComposition_OrangePct'
PINK_PCT = 'ColorComposition_PinkPct'
PURPLE_PCT = 'ColorComposition_PurplePct'
RED_PCT = 'ColorComposition_RedPct'
WHITE_PCT = 'ColorComposition_WhitePct'
YELLOW_PCT = 'ColorComposition_YellowPct'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.ColorHSV(*values)[source]

Bases: DescriptiveTrait

Robust HSV summary for a colony.

HSV hue is circular and HSV is not perceptually uniform, so the robust center is computed as the geometric median of cone-Cartesian coordinates (S*V*cosθ, S*V*sinθ, V) and converted back to H,S,V. HSVConeVariance is the trace of the cone-Cartesian covariance.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod robust_headers()[source]
classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

HSV_CONE_VARIANCE = 'ColorHSV_HSVConeVariance'
HUE_ROBUST_MEAN = 'ColorHSV_HueRobustMean'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

SATURATION_ROBUST_MEAN = 'ColorHSV_SaturationRobustMean'
VALUE_ROBUST_MEAN = 'ColorHSV_ValueRobustMean'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.ColorLab(*values)[source]

Bases: DescriptiveTrait

Robust CIE L*a*b* colorimetric summary for a colony.

Reports two robust center colors – the ΔE76 (Euclidean) geometric median and the ΔE2000 medoid – plus ΔE2000 within-colony consistency scalars, the total Euclidean color variance, and an sRGB hex swatch (plot-only) derived from the medoid.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod robust_headers()[source]
classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

A_STAR_GEOMEDIAN = 'ColorLab_a*GeoMedian'
A_STAR_MEDOID = 'ColorLab_a*Medoid'
B_STAR_GEOMEDIAN = 'ColorLab_b*GeoMedian'
B_STAR_MEDOID = 'ColorLab_b*Medoid'
DELTA_E2000_MEAN = 'ColorLab_DeltaE2000MeanFromMedoid'
DELTA_E2000_MEDIAN = 'ColorLab_DeltaE2000MedianFromMedoid'
DELTA_E2000_P95 = 'ColorLab_DeltaE2000P95FromMedoid'
LAB_TOTAL_VARIANCE = 'ColorLab_LabTotalVariance'
L_STAR_GEOMEDIAN = 'ColorLab_L*GeoMedian'
L_STAR_MEDOID = 'ColorLab_L*Medoid'
MEDOID_COLOR_HEX = 'ColorLab_MedoidColorHex'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.ColorXYZ(*values)[source]

Bases: DiscriminativeFeature

Measure colony color statistics across multiple perceptual color spaces.

Extract per-colony color features from CIE XYZ, chromaticity (xy), CIE Lab (perceptually uniform), and HSV color spaces. For each channel the standard statistical suite is computed (min, Q1, mean, median, Q3, max, std dev, coefficient of variation), plus Lab chroma estimates.

Covers CIE XYZ tristimulus values (X, Y, Z).

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod cieX_headers()[source]
classmethod cieY_headers()[source]
classmethod cieZ_headers()[source]
classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

X_COEFF_VARIANCE = 'ColorXYZ_CieXCoeffVar'
X_MAXIMUM = 'ColorXYZ_CieXMax'
X_MEAN = 'ColorXYZ_CieXMean'
X_MEDIAN = 'ColorXYZ_CieXMedian'
X_MINIMUM = 'ColorXYZ_CieXMin'
X_Q1 = 'ColorXYZ_CieXQ1'
X_Q3 = 'ColorXYZ_CieXQ3'
X_STDDEV = 'ColorXYZ_CieXStdDev'
Y_COEFF_VARIANCE = 'ColorXYZ_CieYCoeffVar'
Y_MAXIMUM = 'ColorXYZ_CieYMax'
Y_MEAN = 'ColorXYZ_CieYMean'
Y_MEDIAN = 'ColorXYZ_CieYMedian'
Y_MINIMUM = 'ColorXYZ_CieYMin'
Y_Q1 = 'ColorXYZ_CieYQ1'
Y_Q3 = 'ColorXYZ_CieYQ3'
Y_STDDEV = 'ColorXYZ_CieYStdDev'
Z_COEFF_VARIANCE = 'ColorXYZ_CieZCoeffVar'
Z_MAXIMUM = 'ColorXYZ_CieZMax'
Z_MEAN = 'ColorXYZ_CieZMean'
Z_MEDIAN = 'ColorXYZ_CieZMedian'
Z_MINIMUM = 'ColorXYZ_CieZMin'
Z_Q1 = 'ColorXYZ_CieZQ1'
Z_Q3 = 'ColorXYZ_CieZQ3'
Z_STDDEV = 'ColorXYZ_CieZStdDev'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.Colorxy(*values)[source]

Bases: DiscriminativeFeature

Measure colony color statistics across multiple perceptual color spaces.

Extract per-colony color features from CIE XYZ, chromaticity (xy), CIE Lab (perceptually uniform), and HSV color spaces. For each channel the standard statistical suite is computed (min, Q1, mean, median, Q3, max, std dev, coefficient of variation), plus Lab chroma estimates.

Covers the (x, y) chromaticity channels.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

classmethod x_headers()[source]
classmethod y_headers()[source]
static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

x_COEFF_VARIANCE = 'Colorxy_xCoeffVar'
x_MAXIMUM = 'Colorxy_xMax'
x_MEAN = 'Colorxy_xMean'
x_MEDIAN = 'Colorxy_xMedian'
x_MINIMUM = 'Colorxy_xMin'
x_Q1 = 'Colorxy_xQ1'
x_Q3 = 'Colorxy_xQ3'
x_STDDEV = 'Colorxy_xStdDev'
y_COEFF_VARIANCE = 'Colorxy_yCoeffVar'
y_MAXIMUM = 'Colorxy_yMax'
y_MEAN = 'Colorxy_yMean'
y_MEDIAN = 'Colorxy_yMedian'
y_MINIMUM = 'Colorxy_yMin'
y_Q1 = 'Colorxy_yQ1'
y_Q3 = 'Colorxy_yQ3'
y_STDDEV = 'Colorxy_yStdDev'
class phenotypic.schema.EDGE_CORRECTION(*values)[source]

Bases: DerivedMeasure

Measurement info container for edge correction analysis results.

Provides metadata for measurement values produced by the EdgeCorrector, organizing corrected colony measurements under the “EdgeCorrection” metric family.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

CORRECTED_CAP = 'EdgeCorrection_Cap'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NEW_VAL = 'EdgeCorrection_NewVal'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.EXPERIMENT(*values)[source]

Bases: MetadataInfo

Recommended metadata tags for experiment-level bookkeeping.

These group results by experiment/project and carry free-form provenance (experiment id, project, dataset, protocol, notes). Members render in the shared Metadata_<Label> namespace with the other experimental-tag enums. Recommended vocabulary, not a validator.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

DATASET = 'Metadata_Dataset'
EXPERIMENT_ID = 'Metadata_ExperimentID'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NOTES = 'Metadata_Notes'
PROJECT = 'Metadata_Project'
PROTOCOL = 'Metadata_Protocol'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.Entry(label: str, desc: str = '', *, bio_desc: str = '', image: str | None = None, tier: int | None = None, derivation_type: str | None = None, derives_from: str | None = None, rembi_module: REMBI_MODULE | None = None, categories: CATEGORIES | Iterable[CATEGORIES] = frozenset({}))[source]

Bases: object

Declarative value for a MeasurementInfo member.

label and desc are positional (matching the old (label, desc) tuple ergonomics). The new fields are keyword-only, so bio_desc/image can never be positionally swapped with desc.

Parameters:
  • label (str) – Short, unprefixed measurement name (e.g. "Area").

  • desc (str) – Technical/algorithm description of what is computed.

  • bio_desc (str) – Biological relevance / use-case. Human-authored only.

  • image (str | None) – Path, relative to _assets/measurements/, of an illustrative figure (e.g. "shape/area.png"); None for no figure.

  • categories (CATEGORIES | Iterable[CATEGORIES]) – Curated categories (CATEGORIES members) this measurement belongs to. A bare member or an iterable of members (a mapping is refused); normalized to a frozenset.

  • tier (int | None)

  • derivation_type (str | None)

  • derives_from (str | None)

  • rembi_module (REMBI_MODULE | None)

bio_desc: str
categories: CATEGORIES | Iterable[CATEGORIES]
derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
rembi_module: REMBI_MODULE | None
tier: int | None
class phenotypic.schema.ErrorCategory(*values)[source]

Bases: QualityInfo

Closed taxonomy of detection-error categories for object triage.

The enum value is the family-prefixed header (ErrorCategory_<label>) per the MeasurementInfo convention, but callers persist and compare on the bare label (e.g. "debris"). Use from_label() to resolve a stored token back to a member.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod from_label(label: str) → ErrorCategory | None[source]

Resolve a bare category token to its member, or None.

Parameters:

label (str) – A bare category token (e.g. "merged").

Returns:

The matching member, or None if label is not a core category (e.g. a custom category or a typo).

Return type:

ErrorCategory | None

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod labels() → list[str][source]

Return the bare category tokens in declaration order.

Returns:

The .label of every member, e.g. ["oversegmented", ..., "other"].

Return type:

list[str]

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

BACKGROUND_NOISE = 'ErrorCategory_background_noise'
DEBRIS = 'ErrorCategory_debris'
MERGED = 'ErrorCategory_merged'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

OTHER = 'ErrorCategory_other'
OVERSEGMENTED = 'ErrorCategory_oversegmented'
UNDERSEGMENTED = 'ErrorCategory_undersegmented'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.GENETIC(*values)[source]

Bases: MetadataInfo

Recommended metadata tags describing the organism and its genetics.

These name the genetic identity of the colonies on a plate (species, strain, genotype, markers). Like all experimental-tag enums they belong to the shared Metadata_<Label> namespace and slot directly into the --metadata CSV join and the post/ metadata operations. This is a recommended vocabulary, not a validator: arbitrary metadata columns are still accepted.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ALLELE = 'Metadata_Allele'
BACKGROUND = 'Metadata_Background'
GENOTYPE = 'Metadata_Genotype'
MATING_TYPE = 'Metadata_MatingType'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

ORGANISM = 'Metadata_Organism'
PLASMID = 'Metadata_Plasmid'
PLOIDY = 'Metadata_Ploidy'
SELECTION_MARKER = 'Metadata_SelectionMarker'
STRAIN = 'Metadata_Strain'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.GRID(*values)[source]

Bases: IdentityInfo

Constants for grid structure in the PhenoTypic module.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

COL_INTERVAL_END = 'Grid_ColIntervalEnd'
COL_INTERVAL_START = 'Grid_ColIntervalStart'
COL_MAJOR_IDX = 'Grid_ColMajorIdx'
COL_NUM = 'Grid_ColNum'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

ROW_INTERVAL_END = 'Grid_RowIntervalEnd'
ROW_INTERVAL_START = 'Grid_RowIntervalStart'
ROW_MAJOR_IDX = 'Grid_RowMajorIdx'
ROW_NUM = 'Grid_RowNum'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.GRID_LINREG_STATS(*values)[source]

Bases: QualityInfo

Evaluate grid alignment quality using row-wise and column-wise linear regression.

Fit linear regressions to colony centroid positions along each row and column of the grid, then compute per-colony residual error (Euclidean distance between observed and predicted centroid). High residual errors flag off-grid growth, misdetections, or plate warping.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

COL_LINREG_B = 'GridLinReg_ColB'
COL_LINREG_M = 'GridLinReg_ColM'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

PRED_CC = 'GridLinReg_PredCC'
PRED_RR = 'GridLinReg_PredRR'
RESIDUAL_ERR = 'GridLinReg_ResidualError'
ROW_LINREG_B = 'GridLinReg_RowB'
ROW_LINREG_M = 'GridLinReg_RowM'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.GRID_SPREAD(*values)[source]

Bases: QualityInfo

Quantify within-well colony dispersion using pairwise centroid distances.

Compute the sum of squared pairwise Euclidean distances between all colony centroids in each grid section. High values indicate multiple dispersed objects within a single well – a sign of over-segmentation, fragmented growth, or invasive spreading.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

OBJECT_COUNT = 'GridSpread_ObjectCount'
OBJECT_SPREAD = 'GridSpread_ObjectSpread'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.IMAGE(*values)[source]

Bases: MetadataInfo

Framework-populated image metadata keys.

These labels are set automatically by the image pipeline (not by the user) and name the bookkeeping entries on the image.metadata accessor. Members render in the shared Metadata_<Label> namespace alongside the user-facing tags in phenotypic.schema (see SAMPLE and siblings).

For the standardized biological/experimental vocabulary users supply via the --metadata CSV, use the experimental-tag enums instead.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

BIT_DEPTH = 'Metadata_BitDepth'
IMAGE_NAME = 'Metadata_ImageName'
IMAGE_TYPE = 'Metadata_ImageType'
IMFORMAT = 'Metadata_ImageFormat'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

PARENT_IMAGE_NAME = 'Metadata_ParentImageName'
PARENT_UUID = 'Metadata_ParentUUID'
SUFFIX = 'Metadata_FileSuffix'
UUID = 'Metadata_UUID'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.INTENSITY(*values)[source]

Bases: DirectPhenotype

Measure grayscale intensity statistics of detected colonies.

Compute per-colony intensity metrics from the grayscale channel: integrated intensity, percentiles (min, Q1, median, Q3, max), standard deviation, coefficient of variation, and area-normalized density. These statistics reflect colony optical density, biomass accumulation, and internal heterogeneity.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

COEFFICIENT_VARIANCE_INTENSITY = 'Intensity_CoefficientVarianceIntensity'
CONVEX_DENSITY = 'Intensity_ConvexDensity'
DENSITY = 'Intensity_Density'
INTEGRATED_INTENSITY = 'Intensity_IntegratedIntensity'
IQR_INTENSITY = 'Intensity_InterquartileRangeIntensity'
MAXIMUM_INTENSITY = 'Intensity_MaximumIntensity'
MEAN_INTENSITY = 'Intensity_MeanIntensity'
MEDIAN_INTENSITY = 'Intensity_MedianIntensity'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

MINIMUM_INTENSITY = 'Intensity_MinimumIntensity'
Q1_INTENSITY = 'Intensity_LowerQuartileIntensity'
Q3_INTENSITY = 'Intensity_UpperQuartileIntensity'
STANDARD_DEVIATION_INTENSITY = 'Intensity_StandardDeviationIntensity'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.LINEAR_CAP_AND_LAG_MODEL(*values)[source]

Bases: DerivedMeasure

Fitted parameters of the double-softplus growth model (with saturation).

Output columns are metric-qualified: each header is LinearCapAndLagModel_<metric>_<parameter>, where <metric> records the measurement the model was fit on (self.on with its metric-family prefix stripped, e.g. Size_Area → Area). For example, fitting on Size_Area emits LinearCapAndLagModel_Area_v (post-lag growth rate) and LinearCapAndLagModel_Area_s0 (initial size). The labels below are the <parameter> segment; the <metric> infix is filled in at fit time.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str[source]

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

alpha = 'LinearCapAndLagModel_alpha'
beta = 'LinearCapAndLagModel_beta'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
lam = 'LinearCapAndLagModel_lambda'
mode = 'LinearCapAndLagModel_mode'
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

s0 = 'LinearCapAndLagModel_s0'
smax = 'LinearCapAndLagModel_smax'
tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

v = 'LinearCapAndLagModel_v'
class phenotypic.schema.LINEAR_LAG_MODEL(*values)[source]

Bases: DerivedMeasure

Fitted parameters of the linear-softplus lag model (no saturation).

Output columns are metric-qualified: each header is LinearLagModel_<metric>_<parameter>, where <metric> records the measurement the model was fit on (self.on with its metric-family prefix stripped, e.g. Size_Area → Area). For example, fitting on Size_Area emits LinearLagModel_Area_v (post-lag growth rate) and LinearLagModel_Area_s0 (initial size). The labels below are the <parameter> segment; the <metric> infix is filled in at fit time.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str[source]

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

alpha = 'LinearLagModel_alpha'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
lam = 'LinearLagModel_lambda'
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

s0 = 'LinearLagModel_s0'
tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

v = 'LinearLagModel_v'
class phenotypic.schema.LOG_GROWTH_MODEL(*values)[source]

Bases: DerivedMeasure

Fitted parameters and bounds of the logistic growth model.

Output columns are metric-qualified: each header is LogGrowthModel_<metric>_<parameter>, where <metric> records the measurement the model was fit on (self.on with its metric-family prefix stripped, e.g. Size_Area → Area). For example, fitting on Size_Area emits LogGrowthModel_Area_r (intrinsic growth rate) and LogGrowthModel_Area_µmax (maximum specific growth rate). The labels below are the <parameter> segment; the <metric> infix is filled in at fit time.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str[source]

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

BETA = 'LogGrowthModel_beta'
GROWTH_RATE = 'LogGrowthModel_µmax'
K_FIT = 'LogGrowthModel_K'
K_MAX = 'LogGrowthModel_Kmax'
LAM = 'LogGrowthModel_lambda'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

N0_FIT = 'LogGrowthModel_N0'
R_FIT = 'LogGrowthModel_r'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.METADATA_MATCH(*values)[source]

Bases: QualityInfo

Metadata-join provenance flags attached to the post-applied mirror.

Emitted only by the CLI’s --metadata left join (into deliverables/measurements.{csv,parquet} and everything derived from it). The clean master_measurements.* archive never carries these columns.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

METADATA_ONLY = 'QC_MetadataOnly'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.MODEL_METRICS(*values)[source]

Bases: QualityInfo

Generic fit-quality metrics and diagnostics shared by all ModelFitter subclasses.

These columns are produced by any model fitter that wraps scipy.optimize.least_squares(), independent of the specific mathematical model. Subclass-specific fitted parameters live in the subclass’s own MeasurementInfo class (e.g., LOG_GROWTH_MODEL).

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str[source]

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

LOSS = 'ModelMetrics_OptimizerLoss'
MAE = 'ModelMetrics_MAE'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

MSE = 'ModelMetrics_MSE'
NUM_SAMPLES = 'ModelMetrics_NumSamples'
R2 = 'ModelMetrics_R2'
RMSE = 'ModelMetrics_RMSE'
STATUS = 'ModelMetrics_OptimizerStatus'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.MeasurementInfo(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Base class for creating standardized measurement information enumerations.

This class provides a structured way to define measurement types with consistent naming conventions, descriptive metadata, and automatic documentation generation. By inheriting from both str and Enum, MeasurementInfo enables measurement definitions to behave as enumeration members while maintaining string representation. The class automatically prefixes measurement labels with a metric family name, ensuring consistent naming across code and outputs.

Key Purposes:

  • Standardize measurement naming conventions (family_label format) to reduce errors

  • Centralize measurement definitions with labels and descriptions in one place

  • Automatically generate RST documentation tables from measurement definitions

  • Provide easy access to headers, labels, and metric family information for analysis workflows

  • Enable type-safe column names in measurement DataFrames

Usage with MeasureFeatures Subclasses:

MeasurementInfo enums are used internally by measurement operations ([MeasureSize](src/phenotypic/measure/_measure_size.py), [MeasureShape](src/phenotypic/measure/_measure_shape.py), [MeasureColor](src/phenotypic/measure/_measure_color.py), etc.) to define column names in output DataFrames. Each measurement class defines its own enum and uses the enum values as DataFrame column headers.

label

The short label for the measurement (without metric family prefix). Set automatically by __new__ from the Entry.label field.

Type:

str

desc

The technical description of what the measurement represents. Set automatically by __new__ from the Entry.desc field. Defaults to empty string if not provided.

Type:

str

bio_desc

The human-authored biological relevance. Set automatically by __new__ from the Entry.bio_desc field. Defaults to empty string.

Type:

str

image

Path (relative to _assets/measurements/) of an illustrative figure, or None. Set automatically from Entry.image.

Type:

str | None

pair

A tuple of (label, description) for convenient access to both pieces of information together.

Type:

tuple[str, str]

METRIC_FAMILY

The metric family name returned by the metric_family() classmethod. Provides instance-level access to the measurement’s metric family.

Type:

property

Examples

Define a custom measurement enumeration:

>>> from phenotypic.schema import Entry, MeasurementInfo
>>> class SHAPE(MeasurementInfo):
...     @classmethod
...     def metric_family(cls):
...         return 'Shape'
...
...     AREA = Entry('Area', 'Total number of pixels in the detected object')
...     PERIMETER = Entry('Perimeter', 'Total length of object boundary in pixels')

Access measurement information and generate headers:

>>> SHAPE.AREA
<SHAPE.AREA: 'Shape_Area'>
>>> str(SHAPE.AREA)
'Shape_Area'
>>> SHAPE.AREA.label
'Area'
>>> SHAPE.AREA.desc
'Total number of pixels in the detected object'
>>> SHAPE.AREA.METRIC_FAMILY
'Shape'
>>> SHAPE.get_labels()
['Area', 'Perimeter']
>>> SHAPE.get_headers()
['Shape_Area', 'Shape_Perimeter']

Use in DataFrame column naming (as MeasureFeatures do internally):

>>> import pandas as pd
>>> measurements = pd.DataFrame({
...     str(SHAPE.AREA): [1024, 956, 1101],
...     str(SHAPE.PERIMETER): [128, 120, 135]
... })
>>> measurements.columns.tolist()
['Shape_Area', 'Shape_Perimeter']
>>> measurements[str(SHAPE.AREA)]
0    1024
1     956
2    1101
Name: Shape_Area, dtype: int64

Generate and append RST documentation:

>>> table = SHAPE.rst_table()
>>> class MeasureShape:
...     '''Measures object morphology.'''
...     pass
>>> MeasureShape.__doc__ = SHAPE.append_rst_to_doc(MeasureShape)
classmethod append_rst_to_doc(module: str | object) → str[source]

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str[source]

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str][source]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str][source]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str[source]

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str | None[source]

Coarse classification kind, or None until assigned by a base class.

Return type:

str | None

classmethod member_for_header(column: str) → MeasurementInfo | None[source]

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool[source]

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str[source]

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None[source]

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str[source]

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.MetadataInfo(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IdentityInfo

Identity information owned by a concrete metadata vocabulary.

Every concrete owner emits the shared Metadata_<Label> namespace. Class identity, rather than a metric-family string prefix, is the stable signal that an enum owns metadata.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str][source]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.NEIGHBOR_DIST(*values)[source]

Bases: QualityInfo

Measure distances from each colony to its grid neighbours and its nearest object.

Two families of columns. The directional columns report, for each colony, the nearest object in the left, right, above, and below grid cells and the minimum Euclidean distance between their pixel masks, computed via a per-section distance transform so round colonies are not over-estimated by their bounding boxes; edge and corner colonies report NaN beyond the plate boundary. The nearest-object columns report the single closest other object anywhere on the plate (same cell, diagonal, or further away) and its grid relation to the colony. On a plain Image only the nearest label and distance are populated.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ABOVE_DISTANCE = 'NeighborDist_AboveDistance'
ABOVE_NEIGHBOR_OBJ_LABEL = 'NeighborDist_AboveNeighborObjLabel'
LEFT_DISTANCE = 'NeighborDist_LeftDistance'
LEFT_NEIGHBOR_OBJ_LABEL = 'NeighborDist_LeftNeighborObjLabel'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NEAREST_DISTANCE = 'NeighborDist_NearestDistance'
NEAREST_OBJ_LABEL = 'NeighborDist_NearestObjLabel'
NEAREST_RELATION = 'NeighborDist_NearestRelation'
RIGHT_DISTANCE = 'NeighborDist_RightDistance'
RIGHT_NEIGHBOR_OBJ_LABEL = 'NeighborDist_RightNeighborObjLabel'
UNDER_DISTANCE = 'NeighborDist_UnderDistance'
UNDER_NEIGHBOR_OBJ_LABEL = 'NeighborDist_UnderNeighborObjLabel'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.OBJECT(*values)[source]

Bases: IdentityInfo

Per-object identifier shared by every measurement table.

Object_Label is written as the first column of every per-object measurement DataFrame and serves as the per-image primary key that the pipeline merges measurers on. Each detected colony in a plate image is assigned a unique integer label, so size, shape, intensity, and color measurements for the same colony line up row-for-row across operators when joined on this column.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

LABEL = 'Object_Label'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

phenotypic.schema.ORIENTATION_ZONES

alias of ORIENTATION_ZONE_DIAGNOSTIC

class phenotypic.schema.ORIENTATION_ZONE_DIAGNOSTIC(*values)[source]

Bases: QualityInfo

Opt-in validation, comparator, and legacy orientation-zone columns.

Canonical diagnostics use the shared CoreZone / DenseZone / SparseZone geometry. Radial variants use all tile pixels in the corresponding annulus; Mask variants use target-object pixels. Explicit legacy mode retains the historical symmetric-radius selectors. See MeasureOrientationZones for parameters and method.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

COHERENCE_MASK_DENSE = 'OrientZones_Coherence-Mask-Dense'
COHERENCE_MASK_OVERALL = 'OrientZones_Coherence-Mask-Overall'
COHERENCE_MASK_SPARSE = 'OrientZones_Coherence-Mask-Sparse'
COHERENCE_RADIAL_DENSE = 'OrientZones_Coherence-Radial-Dense'
COHERENCE_RADIAL_OVERALL = 'OrientZones_Coherence-Radial-Overall'
COHERENCE_RADIAL_SPARSE = 'OrientZones_Coherence-Radial-Sparse'
CONCENTRATION_MASK_DENSE = 'OrientZones_Concentration-Mask-Dense'
CONCENTRATION_MASK_OVERALL = 'OrientZones_Concentration-Mask-Overall'
CONCENTRATION_MASK_SPARSE = 'OrientZones_Concentration-Mask-Sparse'
CONCENTRATION_RADIAL_DENSE = 'OrientZones_Concentration-Radial-Dense'
CONCENTRATION_RADIAL_OVERALL = 'OrientZones_Concentration-Radial-Overall'
CONCENTRATION_RADIAL_SPARSE = 'OrientZones_Concentration-Radial-Sparse'
CORE_ZONE_END_RADIUS = 'OrientZones_CoreZoneEndRadius'
DENSE_RADIUS = 'OrientZones_DenseRadius'
FULL_EXTENT_RADIUS = 'OrientZones_FullExtentRadius'
LONG_RANGE_ROTATION_MASK_DENSE = 'OrientZones_LongRangeRotation-Mask-Dense'
LONG_RANGE_ROTATION_MASK_DENSE_TO_SPARSE = 'OrientZones_LongRangeRotation-Mask-DenseToSparse'
LONG_RANGE_ROTATION_MASK_OVERALL = 'OrientZones_LongRangeRotation-Mask-Overall'
LONG_RANGE_ROTATION_MASK_SPARSE = 'OrientZones_LongRangeRotation-Mask-Sparse'
LONG_RANGE_ROTATION_SUPPORT_MASK_DENSE = 'OrientZones_LongRangeRotationSupport-Mask-Dense'
LONG_RANGE_ROTATION_SUPPORT_MASK_DENSE_TO_SPARSE = 'OrientZones_LongRangeRotationSupport-Mask-DenseToSparse'
LONG_RANGE_ROTATION_SUPPORT_MASK_OVERALL = 'OrientZones_LongRangeRotationSupport-Mask-Overall'
LONG_RANGE_ROTATION_SUPPORT_MASK_SPARSE = 'OrientZones_LongRangeRotationSupport-Mask-Sparse'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

OUTER_RADIUS = 'OrientZones_OuterRadius'
OUTER_ZONE_PERCENTILE = 'OrientZones_OuterZonePercentile'
OUTER_ZONE_RETAINED_MASK_FRACTION = 'OrientZones_OuterZoneRetainedMaskFraction'
OUTWARD_ROTATION_ABSOLUTE_AREA_DENSE = 'OrientZones_OutwardRotationAbsoluteArea-Mask-Dense'
OUTWARD_ROTATION_ABSOLUTE_AREA_OVERALL = 'OrientZones_OutwardRotationAbsoluteArea-Mask-Overall'
OUTWARD_ROTATION_ABSOLUTE_AREA_SPARSE = 'OrientZones_OutwardRotationAbsoluteArea-Mask-Sparse'
OUTWARD_ROTATION_MEDIAN_MAGNITUDE_DENSE = 'OrientZones_OutwardRotationMedianMagnitude-Mask-Dense'
OUTWARD_ROTATION_MEDIAN_MAGNITUDE_OVERALL = 'OrientZones_OutwardRotationMedianMagnitude-Mask-Overall'
OUTWARD_ROTATION_MEDIAN_MAGNITUDE_SPARSE = 'OrientZones_OutwardRotationMedianMagnitude-Mask-Sparse'
OUTWARD_ROTATION_MEDIAN_RESULTANT_DENSE = 'OrientZones_OutwardRotationMedianResultant-Mask-Dense'
OUTWARD_ROTATION_MEDIAN_RESULTANT_OVERALL = 'OrientZones_OutwardRotationMedianResultant-Mask-Overall'
OUTWARD_ROTATION_MEDIAN_RESULTANT_SPARSE = 'OrientZones_OutwardRotationMedianResultant-Mask-Sparse'
OUTWARD_ROTATION_P90_DENSE = 'OrientZones_OutwardRotationP90-Mask-Dense'
OUTWARD_ROTATION_P90_OVERALL = 'OrientZones_OutwardRotationP90-Mask-Overall'
OUTWARD_ROTATION_P90_SPARSE = 'OrientZones_OutwardRotationP90-Mask-Sparse'
OUTWARD_ROTATION_P95_DENSE = 'OrientZones_OutwardRotationP95-Mask-Dense'
OUTWARD_ROTATION_P95_OVERALL = 'OrientZones_OutwardRotationP95-Mask-Overall'
OUTWARD_ROTATION_P95_SPARSE = 'OrientZones_OutwardRotationP95-Mask-Sparse'
OUTWARD_ROTATION_RATE_GRADIENT_DENSE = 'OrientZones_OutwardRotationRateGradient-Mask-Dense'
OUTWARD_ROTATION_RATE_GRADIENT_OVERALL = 'OrientZones_OutwardRotationRateGradient-Mask-Overall'
OUTWARD_ROTATION_RATE_GRADIENT_SPARSE = 'OrientZones_OutwardRotationRateGradient-Mask-Sparse'
OUTWARD_ROTATION_RAW_PEAK_DENSE = 'OrientZones_OutwardRotationRawPeak-Mask-Dense'
OUTWARD_ROTATION_RAW_PEAK_OVERALL = 'OrientZones_OutwardRotationRawPeak-Mask-Overall'
OUTWARD_ROTATION_RAW_PEAK_SPARSE = 'OrientZones_OutwardRotationRawPeak-Mask-Sparse'
OUTWARD_ROTATION_RING_SUPPORT_DENSE = 'OrientZones_OutwardRotationRingSupport-Mask-Dense'
OUTWARD_ROTATION_RING_SUPPORT_OVERALL = 'OrientZones_OutwardRotationRingSupport-Mask-Overall'
OUTWARD_ROTATION_RING_SUPPORT_SPARSE = 'OrientZones_OutwardRotationRingSupport-Mask-Sparse'
OUTWARD_ROTATION_RUN_SPAN_SUPPORT_DENSE = 'OrientZones_OutwardRotationRunSpanSupport-Mask-Dense'
OUTWARD_ROTATION_RUN_SPAN_SUPPORT_OVERALL = 'OrientZones_OutwardRotationRunSpanSupport-Mask-Overall'
OUTWARD_ROTATION_RUN_SPAN_SUPPORT_SPARSE = 'OrientZones_OutwardRotationRunSpanSupport-Mask-Sparse'
OUTWARD_ROTATION_TOTAL_VARIATION_DENSE = 'OrientZones_OutwardRotationTotalVariation-Mask-Dense'
OUTWARD_ROTATION_TOTAL_VARIATION_OVERALL = 'OrientZones_OutwardRotationTotalVariation-Mask-Overall'
OUTWARD_ROTATION_TOTAL_VARIATION_SPARSE = 'OrientZones_OutwardRotationTotalVariation-Mask-Sparse'
OUTWARD_TURNING_MASK_DENSE = 'OrientZones_OutwardTurning-Mask-Dense'
OUTWARD_TURNING_MASK_OVERALL = 'OrientZones_OutwardTurning-Mask-Overall'
OUTWARD_TURNING_MASK_SPARSE = 'OrientZones_OutwardTurning-Mask-Sparse'
RADIAL_SECTOR_SUPPORT_MASK_DENSE = 'OrientZones_RadialSectorSupport-Mask-Dense'
RADIAL_SECTOR_SUPPORT_MASK_OVERALL = 'OrientZones_RadialSectorSupport-Mask-Overall'
RADIAL_SECTOR_SUPPORT_MASK_SPARSE = 'OrientZones_RadialSectorSupport-Mask-Sparse'
RADIAL_TILT_MASK_DENSE = 'OrientZones_RadialTilt-Mask-Dense'
RADIAL_TILT_MASK_OVERALL = 'OrientZones_RadialTilt-Mask-Overall'
RADIAL_TILT_MASK_SPARSE = 'OrientZones_RadialTilt-Mask-Sparse'
SIGNED_LONG_RANGE_ROTATION_MASK_DENSE = 'OrientZones_SignedLongRangeRotation-Mask-Dense'
SIGNED_LONG_RANGE_ROTATION_MASK_DENSE_TO_SPARSE = 'OrientZones_SignedLongRangeRotation-Mask-DenseToSparse'
SIGNED_LONG_RANGE_ROTATION_MASK_OVERALL = 'OrientZones_SignedLongRangeRotation-Mask-Overall'
SIGNED_LONG_RANGE_ROTATION_MASK_SPARSE = 'OrientZones_SignedLongRangeRotation-Mask-Sparse'
TURNING_MASK_DENSE = 'OrientZones_Turning-Mask-Dense'
TURNING_MASK_OVERALL = 'OrientZones_Turning-Mask-Overall'
TURNING_MASK_SPARSE = 'OrientZones_Turning-Mask-Sparse'
TURNING_RADIAL_DENSE = 'OrientZones_Turning-Radial-Dense'
TURNING_RADIAL_OVERALL = 'OrientZones_Turning-Radial-Overall'
TURNING_RADIAL_SPARSE = 'OrientZones_Turning-Radial-Sparse'
ZONE_CHANGE_POINT_MINIMUM_SEGMENT = 'OrientZones_ZoneChangePointMinimumSegment'
ZONE_CHANGE_POINT_OBJECTIVE = 'OrientZones_ZoneChangePointObjective'
ZONE_CHANGE_POINT_RING_COUNT = 'OrientZones_ZoneChangePointRingCount'
ZONE_SEGMENTATION_METHOD_CODE = 'OrientZones_ZoneSegmentationMethodCode'
ZONE_SUPPORTED_RING_FRACTION = 'OrientZones_ZoneSupportedRingFraction'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.ORIENTATION_ZONE_PRIMARY(*values)[source]

Bases: DescriptiveTrait

Primary outward-rotation traits over resolved branch zones.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

OUTWARD_ROTATION_CONSISTENCY_DENSE = 'OrientZones_OutwardRotationConsistency-Mask-Dense'
OUTWARD_ROTATION_CONSISTENCY_OVERALL = 'OrientZones_OutwardRotationConsistency-Mask-Overall'
OUTWARD_ROTATION_CONSISTENCY_SPARSE = 'OrientZones_OutwardRotationConsistency-Mask-Sparse'
OUTWARD_ROTATION_NET_DENSE = 'OrientZones_OutwardRotationNet-Mask-Dense'
OUTWARD_ROTATION_NET_OVERALL = 'OrientZones_OutwardRotationNet-Mask-Overall'
OUTWARD_ROTATION_NET_SPARSE = 'OrientZones_OutwardRotationNet-Mask-Sparse'
OUTWARD_ROTATION_RATE_DENSE = 'OrientZones_OutwardRotationRate-Mask-Dense'
OUTWARD_ROTATION_RATE_OVERALL = 'OrientZones_OutwardRotationRate-Mask-Overall'
OUTWARD_ROTATION_RATE_SPARSE = 'OrientZones_OutwardRotationRate-Mask-Sparse'
OUTWARD_ROTATION_SUSTAINED_PEAK_DENSE = 'OrientZones_OutwardRotationSustainedPeak-Mask-Dense'
OUTWARD_ROTATION_SUSTAINED_PEAK_OVERALL = 'OrientZones_OutwardRotationSustainedPeak-Mask-Overall'
OUTWARD_ROTATION_SUSTAINED_PEAK_SPARSE = 'OrientZones_OutwardRotationSustainedPeak-Mask-Sparse'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.PLATE(*values)[source]

Bases: MetadataInfo

Recommended metadata tags describing the assay plate and its array.

These capture plate-level grouping and physical layout (plate id, batch, array density, incubator position). Members render in the shared Metadata_<Label> namespace with the other experimental-tag enums. Recommended vocabulary, not a validator.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ARRAY_DENSITY = 'Metadata_ArrayDensity'
BATCH = 'Metadata_Batch'
CONFIGURATION = 'Metadata_Configuration'
INCUBATOR_POSITION = 'Metadata_IncubatorPosition'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

PLATE_ID = 'Metadata_PlateID'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_CHECK(*values)[source]

Bases: QualityInfo

Generic QC output columns emitted by every QualityCheck subclass.

The metric-family convention used elsewhere in the codebase would produce column names QC_Flag, QC_Metric, QC_Status — but the actual emitted columns include each subclass’s name between the metric family and the label (QC_Count_Flag, QC_SE_Flag). This enum overrides append_rst_to_doc() to substitute the subclass’s name into the RST column header, so each concrete subclass’s docstring documents its real emitted columns.

classmethod append_rst_to_doc(doc: str | object, *, check_name: str | None = None) → str[source]

Append an RST table with optional per-check name substitution.

Parameters:
  • doc (str | object) – Existing class docstring to splice into. If a string, it is treated as the docstring itself; otherwise its __doc__ attribute is used.

  • check_name (str | None) – When provided, column names render as QC_<check_name>_<Label> (e.g. QC_Count_Flag). When omitted (called on the base QualityCheck class or for general docs), column names render as QC_<name>_<Label> with <name> as a literal placeholder, signalling the per-subclass substitution.

Returns:

Docstring with an appended RST table of output columns.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header(member: QUALITY_CHECK, check_name: str | None = None) → str[source]

Return the column a quality check writes for member.

The single formatter behind QualityCheck.output_header (what analyze() writes), the check docstrings and the Measurements reference, so the three cannot disagree.

Parameters:
  • member (QUALITY_CHECK) – A QUALITY_CHECK member.

  • check_name (str | None) – The check’s name (ICC). None renders the <name> placeholder used for the generic form.

Returns:

The header, e.g. QC_ICC_Metric.

Return type:

str

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

FLAG = 'QC_Flag'
METRIC = 'QC_Metric'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

STATUS = 'QC_Status'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_COUNT(*values)[source]

Bases: QualityInfo

Measurement info for the expected-vs-detected colony count QC check.

Carries the per-group colony counts compared by the count quality check: how many colonies were detected on the plate versus how many the metadata declared, and their signed difference. Negative Delta values flag missing colonies (e.g. failed spots, dropouts) while positive values flag spurious detections (e.g. fragmentation, artifacts).

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

DELTA = 'QC_Count_Delta'
DETECTED = 'QC_Count_Detected'
EXPECTED = 'QC_Count_Expected'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_ICC(*values)[source]

Bases: QualityInfo

Measurement info for the replicate-agreement ICC QC check.

Documents the per-check extra columns produced by the intraclass correlation coefficient (ICC) agreement check, which models colony phenotypes with a two-way design to quantify how consistently replicates (raters) reproduce each subject’s measurement. Low agreement between replicates often signals contamination, edge artifacts, or imaging issues rather than real biology, so these columns support curation decisions downstream of the QC pipeline.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NUM_MEMBERS = 'QC_ICC_NumMembers'
NUM_RATERS = 'QC_ICC_NumRaters'
NUM_SUBJECTS = 'QC_ICC_NumSubjects'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_MAD(*values)[source]

Bases: QualityInfo

Measurement info for the replicate-agreement MAD QC check.

Documents the per-check extra columns produced by the median absolute deviation (MAD) agreement check, which gauges how tightly biological replicates or detection runs agree on a colony phenotype. The MAD is a robust spread estimate that resists single contaminated or mis-segmented colonies, so these columns help flag groups whose disagreement signals imaging artifacts rather than real biology.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

MAD = 'QC_MAD_MAD'
MEDIAN = 'QC_MAD_Median'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NUM_MEMBERS = 'QC_MAD_NumMembers'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_OCCUPANCY(*values)[source]

Bases: QualityInfo

Measurement info for the grid-occupancy QC check.

Carries the per-group cell-occupancy counts compared by the occupancy quality check: how many of a plate’s expected grid cells are filled by at least one colony (doublets collapse to one), how many cells the metadata frame declared, and how many remain empty. A high Vacant count flags plates with many missing pin positions (failed spots, dropouts) independent of any over-detection elsewhere on the plate.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

EXPECTED = 'QC_Occupancy_Expected'
FILLED = 'QC_Occupancy_Filled'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

VACANT = 'QC_Occupancy_Vacant'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_SE(*values)[source]

Bases: QualityInfo

Measurement info for the replicate-agreement standard-error QC check.

Carries the per-(group, time) summary statistics used to gauge how tightly biological replicates agree on a colony phenotype. Disagreement between replicates often signals contamination, edge artifacts, or imaging issues rather than real biology, so the SE and CV columns drive curation decisions downstream of the QC pipeline.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

CV = 'QC_SE_CV'
MEAN = 'QC_SE_Mean'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NUM_REPLICATES = 'QC_SE_NumReplicates'
VALUE = 'QC_SE_Value'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_TUKEY(*values)[source]

Bases: QualityInfo

Measurement info for the replicate-agreement Tukey-fence QC check.

Documents the per-check extra columns behind the Tukey-fence agreement check, which flags colonies whose measurement falls outside Q1 - k*IQR or Q3 + k*IQR relative to their replicates or detection runs. Members beyond the fences are robust outliers that frequently reflect contamination, edge artifacts, or segmentation errors rather than real biology, so these columns drive curation decisions downstream of the QC pipeline.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

LOWER_FENCE = 'QC_Tukey_LowerFence'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NUM_MEMBERS = 'QC_Tukey_NumMembers'
NUM_OUTLIERS = 'QC_Tukey_NumOutliers'
UPPER_FENCE = 'QC_Tukey_UpperFence'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.QUALITY_ZMAX(*values)[source]

Bases: QualityInfo

Measurement info for the replicate-agreement modified Z-score QC check.

Documents the per-check extra columns behind the modified Z-score (ZMax) agreement check, which scales each member’s deviation from the group median by the MAD to spot the colony that disagrees most with its replicates or detection runs. A large modified Z-score often marks contamination, edge artifacts, or segmentation errors rather than real biology, so these columns drive curation decisions downstream of the QC pipeline.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

MAD = 'QC_ZMax_MAD'
MEDIAN = 'QC_ZMax_Median'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NUM_MEMBERS = 'QC_ZMax_NumMembers'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.RADIAL_EXPANSION(*values)[source]

Bases: DescriptiveTrait

Radial expansion measurements for filamentous fungal colonies.

Quantifies branching morphology by decomposing colony structure into a dense core and peripheral branches via PELT changepoint detection on radial density profiles, followed by skeleton-based branch tracing. Includes runner detection for identifying anomalously long branches.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

CORE_RADIUS = 'RadialExpansion_CoreRadius'
MAX_BRANCH_LENGTH = 'RadialExpansion_MaxBranchLength'
MEAN_RADIUS = 'RadialExpansion_MeanRadius'
MEDIAN_RADIUS = 'RadialExpansion_MedianRadius'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

NUM_BRANCHES = 'RadialExpansion_NumBranches'
ROBUST_MEAN_RADIUS = 'RadialExpansion_RobustMeanRadius'
RUNNER_DETECTED = 'RadialExpansion_RunnerDetected'
RUNNER_LENGTH = 'RadialExpansion_RunnerLength'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.REMBI_MODULE(*values)[source]

Bases: str, Enum

REMBI metadata modules. Definition order is canonical.

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ANALYZED_DATA = 'AnalyzedData'
BIOSAMPLE = 'Biosample'
IMAGE_ACQUISITION = 'ImageAcquisition'
IMAGE_DATA = 'ImageData'
SPECIMEN_PREP = 'SpecimenPreparation'
STUDY = 'Study'
UNCATEGORIZED = 'Uncategorized'
class phenotypic.schema.SAMPLE(*values)[source]

Bases: MetadataInfo

Recommended metadata tags identifying a sample and its provenance.

These distinguish individual biological samples and track where each colony came from (replicate, clone, source plate/well, library). Members render in the shared Metadata_<Label> namespace with the other experimental-tag enums. Recommended vocabulary, not a validator: arbitrary metadata columns are still accepted.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

BARCODE = 'Metadata_Barcode'
BIO_REPLICATE = 'Metadata_BioReplicate'
CLONE = 'Metadata_Clone'
COND_REPLICATE = 'Metadata_CondReplicate'
CONTROL = 'Metadata_Control'
LIBRARY_ID = 'Metadata_LibraryID'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

SAMPLE_ID = 'Metadata_SampleID'
SOURCE_PLATE = 'Metadata_SourcePlate'
SOURCE_WELL = 'Metadata_SourceWell'
TECHNICAL_REPLICATE = 'Metadata_TechReplicate'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.SHAPE(*values)[source]

Bases: PrimaryMeasure

Measure the form of each detected colony.

Extract dimensionless and angular form descriptors – circularity, compactness, solidity, extent, eccentricity, orientation – plus the colony’s interior thickness (distance from its pixels to the nearest edge). Size magnitudes (area, perimeter, radii, axis lengths, Feret diameters) live in SIZE.

Changed in version 0.20.0: Colony size magnitudes moved from SHAPE to SIZE: MeasureSize is now their only source, and MeasureShape emits form descriptors only. The radius columns were rebuilt so each name matches its value. Retired columns are not aliased, and stores written by earlier versions keep their old column names. A run started before 0.20.0 must be re-run with --overwrite, not resumed. Resuming reuses the images it already finished, with their old column names.

Retired column

Successor

Shape_Area

Size_Area

Shape_Perimeter

Size_Perimeter

Shape_ConvexArea

Size_ConvexArea

Shape_BboxArea

Size_BboxArea

Shape_MajorAxisLength

Size_MajorAxisLength

Shape_MinorAxisLength

Size_MinorAxisLength

Shape_MinFeretDiameter

Size_MinFeretDiameter

Shape_MaxFeretDiameter

Size_MaxFeretDiameter

Shape_MaxRadius

Size_InscribedRadius

Shape_MeanRadius

Shape_MeanBoundaryDist

Shape_MedianRadius

Shape_MedianBoundaryDist

New columns: Size_MedianRadius, Size_MeanRadius, Size_RobustMeanRadius and Size_MaxRadius, all measured from one center, the centroid of the distance-transform peak.

Same name, different value: Size_MedianRadius, Size_MeanRadius and Size_MaxRadius are not the retired Shape_MedianRadius, Shape_MeanRadius and Shape_MaxRadius. Compare old data against the successor in the table above (identical except for colonies touching another colony or the image border, which now measure to that edge), never against the same-named Size_ column. Model outputs are named by the stripped label, so <Model>_MaxRadius_*, <Model>_MeanRadius_* and <Model>_MedianRadius_* fitted before and after 0.20.0 share a name but not a meaning.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str[source]

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int[source]

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

CIRCULARITY = 'Shape_Circularity'
COMPACTNESS = 'Shape_Compactness'
ECCENTRICITY = 'Shape_Eccentricity'
EXTENT = 'Shape_Extent'
MEAN_BOUNDARY_DIST = 'Shape_MeanBoundaryDist'
MEDIAN_BOUNDARY_DIST = 'Shape_MedianBoundaryDist'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

ORIENTATION = 'Shape_Orientation'
SOLIDITY = 'Shape_Solidity'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.SIZE(*values)[source]

Bases: DirectPhenotype

Measure the key size magnitudes of each detected colony.

Extract colony area, integrated intensity, perimeter, convex-hull and bounding-box areas, best-fit-ellipse axis lengths, the Feret (caliper) diameters, the inscribed radius, and four radii measured from one center, the centroid of the distance-transform peak. These are the starting measurements for growth and fitness comparisons; form descriptors (circularity, solidity, eccentricity, interior thickness) live in SHAPE.

Changed in version 0.20.0: Colony size magnitudes moved from SHAPE to SIZE: MeasureSize is now their only source, and MeasureShape emits form descriptors only. The radius columns were rebuilt so each name matches its value. Retired columns are not aliased, and stores written by earlier versions keep their old column names. A run started before 0.20.0 must be re-run with --overwrite, not resumed. Resuming reuses the images it already finished, with their old column names.

Retired column

Successor

Shape_Area

Size_Area

Shape_Perimeter

Size_Perimeter

Shape_ConvexArea

Size_ConvexArea

Shape_BboxArea

Size_BboxArea

Shape_MajorAxisLength

Size_MajorAxisLength

Shape_MinorAxisLength

Size_MinorAxisLength

Shape_MinFeretDiameter

Size_MinFeretDiameter

Shape_MaxFeretDiameter

Size_MaxFeretDiameter

Shape_MaxRadius

Size_InscribedRadius

Shape_MeanRadius

Shape_MeanBoundaryDist

Shape_MedianRadius

Shape_MedianBoundaryDist

New columns: Size_MedianRadius, Size_MeanRadius, Size_RobustMeanRadius and Size_MaxRadius, all measured from one center, the centroid of the distance-transform peak.

Same name, different value: Size_MedianRadius, Size_MeanRadius and Size_MaxRadius are not the retired Shape_MedianRadius, Shape_MeanRadius and Shape_MaxRadius. Compare old data against the successor in the table above (identical except for colonies touching another colony or the image border, which now measure to that edge), never against the same-named Size_ column. Model outputs are named by the stripped label, so <Model>_MaxRadius_*, <Model>_MeanRadius_* and <Model>_MedianRadius_* fitted before and after 0.20.0 share a name but not a meaning.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str[source]

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family()[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

AREA = 'Size_Area'
BBOX_AREA = 'Size_BboxArea'
CONVEX_AREA = 'Size_ConvexArea'
INSCRIBED_RADIUS = 'Size_InscribedRadius'
INTEGRATED_INTENSITY = 'Size_IntegratedIntensity'
MAJOR_AXIS_LENGTH = 'Size_MajorAxisLength'
MAX_FERET_DIAMETER = 'Size_MaxFeretDiameter'
MAX_RADIUS = 'Size_MaxRadius'
MEAN_RADIUS = 'Size_MeanRadius'
MEDIAN_RADIUS = 'Size_MedianRadius'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

MINOR_AXIS_LENGTH = 'Size_MinorAxisLength'
MIN_FERET_DIAMETER = 'Size_MinFeretDiameter'
PERIMETER = 'Size_Perimeter'
ROBUST_MEAN_RADIUS = 'Size_RobustMeanRadius'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.STUDY(*values)[source]

Bases: MetadataInfo

Recommended metadata tags for the REMBI Study component.

One set per run (title, authors, license, …). Mirrors REMBI’s Study field names. Members render in the shared Metadata_<Label> namespace. Structured REMBI lists (authors/publications/links) are flattened to scalar tags whose value may be a delimited string. Recommended vocabulary, not a validator.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod header_set() → frozenset[str]

Return this owner’s finite set of currently emitted headers.

Return type:

frozenset[str]

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str

Return the shared physical namespace for metadata columns.

Return type:

str

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE[source]

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int | None

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int | None

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ACKNOWLEDGEMENTS = 'Metadata_Acknowledgements'
AUTHOR = 'Metadata_Author'
DESCRIPTION = 'Metadata_Description'
FUNDING = 'Metadata_Funding'
KEYWORDS = 'Metadata_Keywords'
LICENSE = 'Metadata_License'
LINKS = 'Metadata_Links'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

PRIVATE_UNTIL_DATE = 'Metadata_PrivateUntilDate'
PUBLICATIONS = 'Metadata_Publications'
TITLE = 'Metadata_Title'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.SYMMETRIC_ZONES(*values)[source]

Bases: DescriptiveTrait

Radial expansion, symmetry, and branch-orientation zone geometry.

The first four measurements are independent summaries derived directly from the binary object mask: PELT core radius, angular symmetry radius, and mean and maximum expansion. Canonical CoreZone, DenseZone, and SparseZone geometry is resolved by Method B from the target mask, detection matrix, structure-tensor field, and literal skeleton crossings. Historical colony-ness geometry remains available through legacy_mode=True.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers() → list[str]

Get all measurement headers with metric family prefix.

Returns a list of the full enumeration values (with metric family prefix) for all measurements defined in this enumeration. These strings are suitable for use as DataFrame column names, dictionary keys, or in any context where the full prefixed name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Size_Area’, ‘Size_Perimeter’]). Each header includes the metric family prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header_scheme() → str

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str) → MeasurementInfo | None

Return the member column is an output header for, or None.

Parameters:

column (str)

Return type:

MeasurementInfo | None

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

CORE_AREA = 'SymZones_CoreArea'
CORE_END_RADIUS = 'SymZones_CoreEndRadius'
CORE_RADIUS = 'SymZones_CoreRadius'
DENSE_AREA = 'SymZones_DenseArea'
DENSE_END_RADIUS = 'SymZones_DenseEndRadius'
MAX_EXPANSION = 'SymZones_MaxExpansion'
MEAN_EXPANSION = 'SymZones_MeanExpansion'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

SPARSE_AREA = 'SymZones_SparseArea'
SPARSE_END_RADIUS = 'SymZones_SparseEndRadius'
SYMMETRIC_RADIUS = 'SymZones_SymmetricRadius'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

class phenotypic.schema.TEXTURE(*values)[source]

Bases: DiscriminativeFeature

Second-order texture features derived from the gray-level co-occurrence matrix (GLCM).

All features assume normalized GLCMs computed at one or more pixel offsets and averaged across directions unless otherwise noted. Values depend on quantization, window size, and scale; interpret ranges comparatively within the same imaging setup.

Textures are calculated along the 0, 45, 90, and 135 degree axes across the surface of an object. This is denoted by the axis placeholder. The texture is also computed along different scales in the image, and this scale can be converted to real distance measurements using the px-per-mm conversion. If your image’s are from ExFAB BioFoundry we provide this for you, otherwise it can be found using ImageJ. As an example, a scale of 10 with 40 px-per-mm means that the measurement is the texture measured across every 0.25 mm on the surface of an object.

Texture_<feature_name>-deg<axis>-scale<scale>

We also average the texture across all degrees to provide:

Texture_<feature_name>-avg-scale<scale>

Each scale value passed to MeasureTexture(scale=...) writes its own full set of these columns, so measuring at scale=[5, 10] yields both the scale05 and the scale10 columns side by side.

classmethod append_rst_to_doc(module: str | object) → str

Append the measurement documentation table to a module or class docstring.

Generates the RST documentation table for this measurement enumeration and appends it to the provided module’s or class’s existing docstring. This is useful for automatically documenting which measurements a class produces or uses. When the enum defines a change_note(), it is placed between the docstring and the table.

If the input is a string, it is treated as the docstring itself. If it is an object (class, function, module), its __doc__ attribute is used.

Parameters:

module (str | object) – Either a docstring string or an object (class, function, module) whose __doc__ attribute contains the docstring. The existing docstring is preserved, and the measurement table is appended with a blank line separator.

Returns:

The original docstring (or string) with the RST measurement table appended,

separated by two blank lines. The returned string is ready to be assigned back to the target’s __doc__ attribute.

Return type:

str

classmethod change_note() → str

Return an RST change-note block rendered above this enum’s table.

Rendered by append_rst_to_doc() (measurer class docs and the enum’s own docstring) and by the Measurements reference page. Empty by default; an enum overrides it when a release changes its public columns. Keep the text in phenotypic.schema._base._change_notes.

Returns:

RST, typically a .. versionchanged:: directive, or "".

Return type:

str

classmethod get_headers(scale: int, matrix_name=None) → list[str][source]

Return full texture labels with angles in order 0, 45, 90, 135 for each feature and the average across degrees of each feature at the end.

Parameters:

scale (int)

Return type:

list[str]

classmethod get_labels() → list[str]

Get all measurement labels without metric family prefix.

Returns a list of the short labels (without metric family prefix) for all measurements defined in this enumeration. These come from each member’s Entry.label field. Useful for creating human-readable lists or column names when the metric family context is already established.

Returns:

List of measurement labels in enumeration order (e.g.,

[‘Area’, ‘Perimeter’]). Does not include the metric family prefix; to get prefixed names, use get_headers().

Return type:

list[str]

classmethod header(member: TEXTURE, direction: str, scale: int | str) → str[source]

Return one texture header, {family}_{label}-{direction}-scale{scale}.

The single formatter behind get_headers() and the documented pattern, so the two cannot disagree.

Parameters:
  • member (TEXTURE) – The texture feature.

  • direction (str) – deg000, deg045, deg090, deg135 or avg, or a placeholder such as <direction>.

  • scale (int | str) – The GLCM pixel offset, zero-padded to two digits, or a placeholder string such as <x>, used verbatim.

Returns:

The header, e.g. Texture_Contrast-deg045-scale05.

Return type:

str

classmethod header_scheme() → str[source]

Naming scheme for this enum’s DataFrame output headers.

"static" (default) → exact {family}_{label}; "metric_qualified" → {family}_{metric}_{label} (growth models + model metrics, where {metric} is a runtime value); "texture" → TEXTURE’s -deg/-scale suffix scheme.

Return type:

str

classmethod kind() → str

Coarse classification kind, or None until assigned by a base class.

Return type:

str

classmethod member_for_header(column: str)[source]

Recognize TEXTURE’s {cat}_{label}-deg###-scale## / -avg-scale##.

Parameters:

column (str)

classmethod metric_family() → str[source]

Return the metric family for this measurement enumeration.

Subclasses must implement this method to provide a metric family name that will be used to prefix all measurement labels. This ensures consistent naming conventions across the codebase.

Returns:

The family name (e.g., ‘Size’, ‘Color’, ‘Texture’). This string is

prepended to each measurement label with an underscore separator to form the full header name (e.g., ‘Size_Area’).

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod owns_header(column: str) → bool

Whether column is one of this enum’s output headers.

Parameters:

column (str)

Return type:

bool

classmethod rembi_module() → REMBI_MODULE | None

REMBI module for this enum, or None until a subclass declares it.

Return type:

REMBI_MODULE | None

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False, members: Iterable[MeasurementInfo] | None = None, header_for: Callable[[MeasurementInfo], str] | None = None) → str

Render an RST list-table of this enum’s members.

Adds a Categories column when any member carries a category, a Biology column when any sets bio_desc and an Image column when any sets image (each suppressed otherwise).

Parameters:
  • title (str | None) – Table caption; defaults to the metric family name.

  • header (tuple[str, str]) – (name_column_header, description_column_header).

  • use_headers (bool) – Name cell shows the prefixed value (Size_Area) instead of the bare label (Area).

  • members (Iterable[MeasurementInfo] | None) – The members to list, in the order given; defaults to every member. The Measurements reference passes only the members that appear in output tables.

  • header_for (Callable[[MeasurementInfo], str] | None) – Name-cell text for a member, overriding use_headers. The Measurements reference passes the producer’s output_header so the table shows the header actually written (QC_ICC_Metric, not QC_Metric).

Return type:

str

classmethod tier() → int

Trust tier (1/2/3) for primary measurements, or None.

Return type:

int

static maketrans()

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

__dir__()

Returns public methods and other interesting attributes.

__new_member__(entry: Entry)

Create a member from an Entry.

The enum value is the family-prefixed header (e.g. Size_Area); label/desc/bio_desc/image are stored as instance attributes. Anything other than an Entry raises TypeError at class-creation time.

Parameters:

entry (Entry)

__str__() → str

Return the string representation of this measurement as the prefixed name.

Returns the full enumeration value, which is the family-prefixed label (e.g., ‘Size_Area’). This is used when the measurement is converted to a string or used in string formatting.

Returns:

The full prefixed name of the measurement (e.g., ‘{family}_{label}’).

Return type:

str

capitalize()

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) → int

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) → bool

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) → str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) → str

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) → int

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

partition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) → int

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) → bool

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()

Return a copy of the string converted to uppercase.

zfill(width, /)

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

ANGULAR_SECOND_MOMENT = 'Texture_AngularSecondMoment'
CONTRAST = 'Texture_Contrast'
CORRELATION = 'Texture_Correlation'
DIFFERENCE_ENTROPY = 'Texture_DiffEntropy'
DIFFERENCE_VARIANCE = 'Texture_DiffVariance'
ENTROPY = 'Texture_Entropy'
IMC1 = 'Texture_InfoCorrelation1'
IMC2 = 'Texture_InfoCorrelation2'
INVERSE_DIFFERENCE_MOMENT = 'Texture_InverseDifferenceMoment'
property METRIC_FAMILY: str

Get the metric family name for this measurement instance.

Provides instance-level access to the metric family defined by the metric_family() classmethod. This is useful when you have a measurement instance and need to know which metric family it belongs to without explicitly referencing the class.

Returns:

The metric family name from the enum class’s metric_family() method.

Return type:

str

SUM_AVERAGE = 'Texture_SumAverage'
SUM_ENTROPY = 'Texture_SumEntropy'
SUM_VARIANCE = 'Texture_SumVariance'
VARIANCE = 'Texture_HaralickVariance'
bio_desc: str
categories: frozenset[CATEGORIES]
property category_badges: str

RST outline badges, one per category, linking to the Categories page.

Empty when the member has no category.

derivation_type: str | None
derives_from: str | None
desc: str
image: str | None
label: str
pair: tuple[str, str]
rembi_module_override: REMBI_MODULE | None
property resolved_kind: str

The coarse kind for this member (identity/quality/primary/derived).

property resolved_rembi_module: REMBI_MODULE

override > enum declaration > fallback.

Type:

Total REMBI-module resolver

property resolved_tier: int | None

The trust tier (1/2/3) for this member, or None for non-primary.

tier_override: int | None
property use_badge: str

RST sphinx-design xref badge for this member’s classification.

A coloured :bdg-ref-{color}: pill linking to the measurement- classification explanation page (tier badges deep-link to the trust- contract table). Unlike use_label, this covers every kind — Identity, Quality and normalization-Derived included — so the rendered reference table classifies every column. Returns "" for members that do not classify (e.g. enums that subclass MeasurementInfo directly).

property use_label: str

Short human-readable ‘how to apply’ label, empty for non-primary.

phenotypic.schema.__getattr__(name: str)[source]

Resolve one-release compatibility names for metadata enum owners.

Parameters:

name (str)

phenotypic.schema.header_to_module() → dict[str, REMBI_MODULE][source]

Map every known column header to its REMBI module.

Walks every MeasurementInfo subclass exported from phenotypic.schema and reads each member’s resolved_rembi_module. Cached (lru_cache): the mapping derives entirely from the import-time schema enums, which are fixed once the package is imported, so there is no staleness concern and the hot-path callers (manifest builder + metadata accessor) skip the walk on every call after the first. The returned dict is read-only by contract; callers must not mutate it (mirrors _label_to_category()).

Return type:

dict[str, REMBI_MODULE]

phenotypic.schema.parse_qualified_header(info_cls: type[MeasurementInfo], column: str) → tuple[str, MeasurementInfo] | None[source]

Inverse of qualified_header() for one enum.

Returns (metric_token, member) when column is a metric-qualified header of info_cls ({family}_{metric}_{label} with a non-empty metric), else None. Anchors on the longest matching member-label suffix, so an underscore inside the metric token stays unambiguous.

Parameters:
Return type:

tuple[str, MeasurementInfo] | None

phenotypic.schema.qualified_header(member: MeasurementInfo, token: str) → str[source]

Runtime output header {Family}_{token}_{label}.

Embeds the fitted-metric token so a reader can tell which measurement a growth-model parameter was trained on. Inverse of parse_qualified_header().

Parameters:
Return type:

str