phenotypic.schema package#

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: METADATA (framework-populated image bookkeeping) and the seven experimental-tag enums (GENETIC_METADATA, SAMPLE_METADATA, PLATE_METADATA, CONDITION_METADATA, INCUBATION_METADATA, ACQUISITION_METADATA, EXPERIMENT_METADATA) that standardize Metadata_* columns for the --metadata join and post/ ops.

class phenotypic.schema.ACQUISITION_METADATA(*values)[source]#

Bases: MeasurementInfo

Recommended Metadata_* tags describing image acquisition.

These record how and by whom an image was captured (acquisition date, instrument, operator, resolution, exposure). Members render as Metadata_<Label> (e.g. Metadata_ImagingDate) and share the Metadata_ 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

EXPERIMENTER = 'Metadata_Experimenter'#
EXPOSURE_TIME = 'Metadata_ExposureTime'#
IMAGING_DATE = 'Metadata_ImagingDate'#
INSTRUMENT = 'Metadata_Instrument'#
RESOLUTION = 'Metadata_Resolution'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.BBOX(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

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'#
MIN_CC = 'Bbox_MinCC'#
MIN_RR = 'Bbox_MinRR'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.CONDITION_METADATA(*values)[source]#

Bases: MeasurementInfo

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 as Metadata_<Label> (e.g. Metadata_Treatment) and share the Metadata_ 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

COMPOUND = 'Metadata_Compound'#
CONCENTRATION = 'Metadata_Concentration'#
DOSE = 'Metadata_Dose'#
INDUCER = 'Metadata_Inducer'#
MEDIA = 'Metadata_Media'#
NITROGEN_SOURCE = 'Metadata_NitrogenSource'#
PH = 'Metadata_pH'#
STRESS = 'Metadata_Stress'#
SUPPLEMENT = 'Metadata_Supplement'#
TREATMENT = 'Metadata_Treatment'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.CURATION(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

ERROR_CATEGORY = 'Curation_Category'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.ColorComposition(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

CYAN_PCT = 'ColorComposition_CyanPct'#
GRAY_PCT = 'ColorComposition_GrayPct'#
GREEN_PCT = 'ColorComposition_GreenPct'#
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#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.ColorHSV(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod robust_headers()[source]#
classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

HSV_CONE_VARIANCE = 'ColorHSV_HSVConeVariance'#
HUE_ROBUST_MEAN = 'ColorHSV_HueRobustMean'#
SATURATION_ROBUST_MEAN = 'ColorHSV_SaturationRobustMean'#
VALUE_ROBUST_MEAN = 'ColorHSV_ValueRobustMean'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.ColorLab(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod robust_headers()[source]#
classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

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'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.ColorXYZ(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod cieX_headers()[source]#
classmethod cieY_headers()[source]#
classmethod cieZ_headers()[source]#
classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() 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#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.Colorxy(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
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.DOUBLE_SOFTPLUS_MODEL(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

alpha = 'DoubleSoftplus_alpha'#
beta = 'DoubleSoftplus_beta'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
lam = 'DoubleSoftplus_lambda'#
mode = 'DoubleSoftplus_mode'#
pair: tuple[str, str]#
s0 = 'DoubleSoftplus_s0'#
smax = 'DoubleSoftplus_smax'#
v = 'DoubleSoftplus_v'#
class phenotypic.schema.EDGE_CORRECTION(*values)[source]#

Bases: MeasurementInfo

Measurement info container for edge correction analysis results.

Provides metadata for measurement values produced by the EdgeCorrector, organizing corrected colony measurements under the “EdgeCorrection” category.

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

CORRECTED_CAP = 'EdgeCorrection_Cap'#
NEW_VAL = 'EdgeCorrection_NewVal'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.EXPERIMENT_METADATA(*values)[source]#

Bases: MeasurementInfo

Recommended Metadata_* tags for experiment-level bookkeeping.

These group results by experiment/project and carry free-form provenance (experiment id, project, dataset, protocol, notes). Dataset matches the CLI-emitted Metadata_Dataset column. Members render as Metadata_<Label> (e.g. Metadata_ExperimentID) and share the Metadata_ 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

DATASET = 'Metadata_Dataset'#
EXPERIMENT_ID = 'Metadata_ExperimentID'#
NOTES = 'Metadata_Notes'#
PROJECT = 'Metadata_Project'#
PROTOCOL = 'Metadata_Protocol'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.Entry(label: str, desc: str = '', *, bio_desc: str = '', image: str | None = None)[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.

bio_desc: str#
desc: str#
image: str | None#
label: str#
class phenotypic.schema.ErrorCategory(*values)[source]#

Bases: MeasurementInfo

Closed taxonomy of detection-error categories for object triage.

The enum value is the category-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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

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 category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[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 rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

DEBRIS = 'ErrorCategory_debris'#
MERGED = 'ErrorCategory_merged'#
OTHER = 'ErrorCategory_other'#
OVERSEGMENTED = 'ErrorCategory_oversegmented'#
UNDERSEGMENTED = 'ErrorCategory_undersegmented'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.GENETIC_METADATA(*values)[source]#

Bases: MeasurementInfo

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 share the Metadata_ namespace, so members render as Metadata_<Label> (e.g. Metadata_Strain) 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

GENOTYPE = 'Metadata_Genotype'#
MATING_TYPE = 'Metadata_MatingType'#
ORGANISM = 'Metadata_Organism'#
PLASMID = 'Metadata_Plasmid'#
PLOIDY = 'Metadata_Ploidy'#
SELECTION_MARKER = 'Metadata_SelectionMarker'#
STRAIN = 'Metadata_Strain'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.GRID(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

COL_INTERVAL_END = 'Grid_ColIntervalEnd'#
COL_INTERVAL_START = 'Grid_ColIntervalStart'#
COL_MAJOR_IDX = 'Grid_ColMajorIdx'#
COL_NUM = 'Grid_ColNum'#
ROW_INTERVAL_END = 'Grid_RowIntervalEnd'#
ROW_INTERVAL_START = 'Grid_RowIntervalStart'#
ROW_MAJOR_IDX = 'Grid_RowMajorIdx'#
ROW_NUM = 'Grid_RowNum'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.GRID_LINREG_STATS(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

COL_LINREG_B = 'GridLinReg_ColB'#
COL_LINREG_M = 'GridLinReg_ColM'#
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#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.GRID_SPATIAL(*values)[source]#

Bases: MeasurementInfo

Measure pixel-to-pixel distances to neighbors in adjacent grid cells.

For each detected colony, identify the nearest object in the left, right, above, and below grid cells and report the minimum Euclidean distance between their pixel masks. Distances are computed via a per-section distance transform over a local window covering the target cell and its immediate neighbors, so round colonies are not over-estimated by their bounding boxes. Edge and corner colonies report NaN for directions beyond the plate boundary.

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 = 'GridSpatial_AboveDistance'#
ABOVE_NEIGHBOR_OBJ_LABEL = 'GridSpatial_AboveNeighborObjLabel'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

LEFT_DISTANCE = 'GridSpatial_LeftDistance'#
LEFT_NEIGHBOR_OBJ_LABEL = 'GridSpatial_LeftNeighborObjLabel'#
RIGHT_DISTANCE = 'GridSpatial_RightDistance'#
RIGHT_NEIGHBOR_OBJ_LABEL = 'GridSpatial_RightNeighborObjLabel'#
UNDER_DISTANCE = 'GridSpatial_UnderDistance'#
UNDER_NEIGHBOR_OBJ_LABEL = 'GridSpatial_UnderNeighborObjLabel'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.GRID_SPREAD(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

OBJECT_SPREAD = 'GridSpread_ObjectSpread'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.INCUBATION_METADATA(*values)[source]#

Bases: MeasurementInfo

Recommended Metadata_* tags describing incubation and time course.

These capture the temporal and environmental incubation parameters of an experiment (temperature, elapsed time, timepoint, generation, atmosphere). Time/Timepoint align with the QC time-series axis. Members render as Metadata_<Label> (e.g. Metadata_Time) and share the Metadata_ 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

DAY = 'Metadata_Day'#
GENERATION = 'Metadata_Generation'#
HUMIDITY = 'Metadata_Humidity'#
TEMPERATURE = 'Metadata_Temperature'#
TIME = 'Metadata_Time'#
TIMEPOINT = 'Metadata_Timepoint'#
TIME_UNIT = 'Metadata_TimeUnit'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.INTENSITY(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

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'#
MINIMUM_INTENSITY = 'Intensity_MinimumIntensity'#
Q1_INTENSITY = 'Intensity_LowerQuartileIntensity'#
Q3_INTENSITY = 'Intensity_UpperQuartileIntensity'#
STANDARD_DEVIATION_INTENSITY = 'Intensity_StandardDeviationIntensity'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.LINEAR_SOFTPLUS_MODEL(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

alpha = 'LinearSoftplus_alpha'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
lam = 'LinearSoftplus_lambda'#
pair: tuple[str, str]#
s0 = 'LinearSoftplus_s0'#
v = 'LinearSoftplus_v'#
class phenotypic.schema.LOG_GROWTH_MODEL(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

GROWTH_RATE = 'LogGrowthModel_µmax'#
K_FIT = 'LogGrowthModel_K'#
K_MAX = 'LogGrowthModel_Kmax'#
LAM = 'LogGrowthModel_lambda'#
N0_FIT = 'LogGrowthModel_N0'#
R_FIT = 'LogGrowthModel_r'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.METADATA(*values)[source]#

Bases: MeasurementInfo

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 as Metadata_<Label> (e.g. Metadata_ImageName) so they share the Metadata_ namespace with the user-facing experimental tags in phenotypic.schema (see SAMPLE_METADATA 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

IMAGE_NAME = 'Metadata_ImageName'#
IMAGE_TYPE = 'Metadata_ImageType'#
IMFORMAT = 'Metadata_ImageFormat'#
PARENT_IMAGE_NAME = 'Metadata_ParentImageName'#
PARENT_UUID = 'Metadata_ParentUUID'#
SUFFIX = 'Metadata_FileSuffix'#
UUID = 'Metadata_UUID'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.MODEL_METRICS(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

LOSS = 'ModelMetrics_OptimizerLoss'#
MAE = 'ModelMetrics_MAE'#
MSE = 'ModelMetrics_MSE'#
NUM_SAMPLES = 'ModelMetrics_NumSamples'#
R2 = 'ModelMetrics_R2'#
RMSE = 'ModelMetrics_RMSE'#
STATUS = 'ModelMetrics_OptimizerStatus'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
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 category name, ensuring consistent naming across code and outputs.

Key Purposes:

  • Standardize measurement naming conventions (category_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 category 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 category 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]

CATEGORY#

The category name returned by the category() classmethod. Provides instance-level access to the measurement category.

Type:

property

Examples

Define a custom measurement enumeration:

>>> from phenotypic.schema import Entry, MeasurementInfo
>>> class SHAPE(MeasurementInfo):
...     @classmethod
...     def category(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.CATEGORY
'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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str][source]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str][source]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str[source]#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.OBJECT(*values)[source]#

Bases: MeasurementInfo

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

LABEL = 'Object_Label'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.PLATE_METADATA(*values)[source]#

Bases: MeasurementInfo

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 as Metadata_<Label> (e.g. Metadata_PlateID) and share the Metadata_ 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

INCUBATOR_POSITION = 'Metadata_IncubatorPosition'#
PLATE_ID = 'Metadata_PlateID'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_CHECK(*values)[source]#

Bases: MeasurementInfo

Generic QC output columns emitted by every QualityCheck subclass.

The category 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 category 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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

FLAG = 'QC_Flag'#
METRIC = 'QC_Metric'#
STATUS = 'QC_Status'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_COUNT(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

DELTA = 'QC_Count_Delta'#
DETECTED = 'QC_Count_Detected'#
EXPECTED = 'QC_Count_Expected'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_ICC(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

NUM_MEMBERS = 'QC_ICC_NumMembers'#
NUM_RATERS = 'QC_ICC_NumRaters'#
NUM_SUBJECTS = 'QC_ICC_NumSubjects'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_MAD(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

MAD = 'QC_MAD_MAD'#
MEDIAN = 'QC_MAD_Median'#
NUM_MEMBERS = 'QC_MAD_NumMembers'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_SE(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

CV = 'QC_SE_CV'#
MEAN = 'QC_SE_Mean'#
NUM_REPLICATES = 'QC_SE_NumReplicates'#
VALUE = 'QC_SE_Value'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_TUKEY(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

LOWER_FENCE = 'QC_Tukey_LowerFence'#
NUM_MEMBERS = 'QC_Tukey_NumMembers'#
NUM_OUTLIERS = 'QC_Tukey_NumOutliers'#
UPPER_FENCE = 'QC_Tukey_UpperFence'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.QUALITY_ZMAX(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

MAD = 'QC_ZMax_MAD'#
MEDIAN = 'QC_ZMax_Median'#
NUM_MEMBERS = 'QC_ZMax_NumMembers'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.RADIAL_EXPANSION(*values)[source]#

Bases: MeasurementInfo

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

CORE_RADIUS = 'RadialExpansion_CoreRadius'#
MAX_BRANCH_LENGTH = 'RadialExpansion_MaxBranchLength'#
MEAN_RADIUS = 'RadialExpansion_MeanRadius'#
MEDIAN_RADIUS = 'RadialExpansion_MedianRadius'#
NUM_BRANCHES = 'RadialExpansion_NumBranches'#
ROBUST_MEAN_RADIUS = 'RadialExpansion_RobustMeanRadius'#
RUNNER_DETECTED = 'RadialExpansion_RunnerDetected'#
RUNNER_LENGTH = 'RadialExpansion_RunnerLength'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.SAMPLE_METADATA(*values)[source]#

Bases: MeasurementInfo

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 as Metadata_<Label> (e.g. Metadata_Replicate) and share the Metadata_ 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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

CLONE = 'Metadata_Clone'#
CONTROL = 'Metadata_Control'#
LIBRARY_ID = 'Metadata_LibraryID'#
REPLICATE = 'Metadata_Replicate'#
SAMPLE_ID = 'Metadata_SampleID'#
SOURCE_PLATE = 'Metadata_SourcePlate'#
SOURCE_WELL = 'Metadata_SourceWell'#
TECHNICAL_REPLICATE = 'Metadata_TechnicalReplicate'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.SHAPE(*values)[source]#

Bases: MeasurementInfo

Measure comprehensive morphological characteristics of detected colonies.

Extract geometric metrics from each colony shape: area, perimeter, circularity, convex hull properties, width-based measures, Feret diameters, eccentricity, and best-fit ellipse parameters. The output DataFrame provides a full morphological profile for phenotypic classification and growth-pattern analysis.

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 = 'Shape_Area'#
BBOX_AREA = 'Shape_BboxArea'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

CIRCULARITY = 'Shape_Circularity'#
COMPACTNESS = 'Shape_Compactness'#
CONVEX_AREA = 'Shape_ConvexArea'#
ECCENTRICITY = 'Shape_Eccentricity'#
EXTENT = 'Shape_Extent'#
MAJOR_AXIS_LENGTH = 'Shape_MajorAxisLength'#
MAX_FERET_DIAMETER = 'Shape_MaxFeretDiameter'#
MAX_RADIUS = 'Shape_MaxRadius'#
MEAN_RADIUS = 'Shape_MeanRadius'#
MEDIAN_RADIUS = 'Shape_MedianRadius'#
MINOR_AXIS_LENGTH = 'Shape_MinorAxisLength'#
MIN_FERET_DIAMETER = 'Shape_MinFeretDiameter'#
ORIENTATION = 'Shape_Orientation'#
PERIMETER = 'Shape_Perimeter'#
SOLIDITY = 'Shape_Solidity'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.SIZE(*values)[source]#

Bases: MeasurementInfo

Measure colony area and integrated intensity as lightweight size proxies.

Extract two fundamental size metrics per detected colony: pixel area (biomass extent) and integrated grayscale intensity (total brightness, a proxy for optical density). This is a convenience class for rapid size assessment without the overhead of full shape or intensity statistical analysis.

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.

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 category()[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

INTEGRATED_INTENSITY = 'Size_IntegratedIntensity'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.SYMMETRIC_ZONES(*values)[source]#

Bases: MeasurementInfo

Mask-based radial expansion measurements for colonies on solid media.

Summarises each colony’s radial growth through four scalars derived directly from the binary object mask: the inoculum core radius (shared with RADIAL_EXPANSION), the radius at which growth stops being angularly symmetric, and mean / maximum radial extent beyond the core.

Unlike RADIAL_EXPANSION, no skeletonization, branch tracing, or runner-outlier statistics are involved — all values are computed from per-annulus mask geometry and a circular-statistics angular resultant length. Intended for users who care about colony-level expansion and the symmetry of that expansion, not individual hyphae.

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers() list[str]#

Get all measurement headers with category prefix.

Returns a list of the full enumeration values (with category 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 categorized name is needed.

Returns:

List of prefixed measurement names in enumeration order

(e.g., [‘Shape_Area’, ‘Shape_Perimeter’]). Each header includes the category prefix separated by an underscore.

Return type:

list[str]

classmethod get_labels() list[str]#

Get all measurement labels without category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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 CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

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'#
SPARSE_AREA = 'SymZones_SparseArea'#
SPARSE_END_RADIUS = 'SymZones_SparseEndRadius'#
SYMMETRIC_RADIUS = 'SymZones_SymmetricRadius'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#
class phenotypic.schema.TEXTURE(*values)[source]#

Bases: MeasurementInfo

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.

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.

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 category() str[source]#

Return the category name for this measurement enumeration.

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

Returns:

The category name (e.g., ‘Shape’, ‘Color’, ‘Texture’). This string is

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

Return type:

str

Raises:

NotImplementedError – If not implemented by a subclass.

classmethod get_headers(scale: int, matrix_name) 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 category prefix.

Returns a list of the short labels (without category 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 category context is already established.

Returns:

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

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

Return type:

list[str]

classmethod rst_table(*, title: str | None = None, header: tuple[str, str] = ('Name', 'Description'), use_headers: bool = False) str#

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

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

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

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

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

Return type:

str

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 category-prefixed header (e.g. Shape_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 category-prefixed label (e.g., ‘Shape_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., ‘{category}_{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'#
property CATEGORY: str#

Get the category name for this measurement instance.

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

Returns:

The category name from the enum class’s category() method.

Return type:

str

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'#
SUM_AVERAGE = 'Texture_SumAverage'#
SUM_ENTROPY = 'Texture_SumEntropy'#
SUM_VARIANCE = 'Texture_SumVariance'#
VARIANCE = 'Texture_HaralickVariance'#
bio_desc: str#
desc: str#
image: str | None#
label: str#
pair: tuple[str, str]#