phenotypic.data#

Sample and synthetic agar plate images for fungal colony testing.

Provides loaders and generators for representative plate scenes used in demos, benchmarks, and tests: synthetic single colonies, synthetic full plates, time-course captures at 12–72 hours, early low-contrast crops, and smear-plate examples. Utilities return arrays or ready-to-use Image/GridImage objects for rapid pipeline trials.

phenotypic.data.load_colony(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Returns a colony image array of K. Marxianus at 72 hrs

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_early_colony(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Returns a colony image array of K. Marxianus at 12 hrs

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_faint_early_colony(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Returns a faint colony image array of K. Marxianus at 12 hrs

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_plate_12hr(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Returns a plate image of a K. Marxianus colony 96 array plate at 12 hrs

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_plate_72hr(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Return a image of a k. marxianus colony 96 array plate at 72 hrs

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_plate_series(mode: Literal['array', 'Image', 'GridImage'] = 'array') List[np.ndarray | Image | GridImage][source]#

Return a series of plate images across 6 time samples

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

List[Union[np.ndarray, Image, GridImage]]

phenotypic.data.load_smear_plate_12hr(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Returns a plate image array of K. Marxianus that contains noise such as smears

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_smear_plate_24hr(mode: Literal['array', 'Image', 'GridImage'] = 'array') np.ndarray | Image | GridImage[source]#

Returns a plate image array of K. Marxianus that contains noise such as smears

Parameters:

mode (Literal['array', 'Image', 'GridImage'])

Return type:

Union[np.ndarray, Image, GridImage]

phenotypic.data.load_synthetic_colony(mode: Literal['array', 'Image'] = 'array') np.ndarray | Image[source]#

Loads synthetic colony data from a pre-saved file and returns it in the specified mode.

This function provides two modes for handling the synthetic colony data: ‘array’ and ‘Image’. Depending on the mode specified, it either returns the array directly or converts it into an Image object. When ‘Image’ mode is selected, the object mask is also applied to the Image object.

Parameters:

mode (Literal['array', 'Image']) – Specifies the format in which the synthetic colony data should be returned. Use ‘array’ to return the raw data as an array or ‘Image’ to return an Image object with the corresponding objmask.

Returns:

The synthetic colony data, either as a numpy array or an Image object, depending on the specified mode.

Return type:

Union[np.ndarray, Image]

Raises:

ValueError – If the mode is neither ‘array’ nor ‘Image’.

Example

Load synthetic colony data as a NumPy array or Image object
>>> from phenotypic.data import load_synthetic_colony
>>> img = load_synthetic_colony(mode='array')
phenotypic.data.load_synthetic_detection_image()[source]#

returns a phenotypic.GridImage of a synthetic plate with the colonies detected

phenotypic.data.make_synthetic_colony(h: int = 256, w: int = 256, bit_depth: int = 8, colony_rgb: Tuple[float, float, float] = (0.96, 0.88, 0.82), agar_rgb: Tuple[float, float, float] = (0.55, 0.56, 0.54), seed: int = 1) numpy.ndarray[source]#

Generate a single bright fungal colony on solid-media agar. Returns an RGB NumPy array.

Parameters:
  • h (int) – Image height (pixels).

  • w (int) – Image width (pixels).

  • bit_depth (int) – 8 or 16.

  • colony_rgb (Tuple[float, float, float]) – Linear RGB in [0,1] for colony tint. Will be forced lighter than agar.

  • agar_rgb (Tuple[float, float, float]) – Linear RGB in [0,1] for agar background.

  • seed (int) – RNG seed.

Returns:

HxWx3 RGB, dtype uint8 or uint16.

Return type:

np.ndarray

Notes

  • Colony is lighter than background via screen-like blend.

  • No Petri dish. Scene is a cropped colony with padding on agar.

phenotypic.data.make_synthetic_plate(nrows: int = 8, ncols: int = 12, plate_h: int = 2048, plate_w: int = 3072, bit_depth: int = 8, colony_rgb: Tuple[float, float, float] = (0.96, 0.88, 0.82), agar_rgb: Tuple[float, float, float] = (0.55, 0.56, 0.54), seed: int = 1, spacing_factor: float = 0.85, colony_size_variation: float = 0.15) numpy.ndarray[source]#

Generate a synthetic array plate with multiple colonies arranged in a grid.

Parameters:
  • nrows (int) – Number of rows in the plate array (e.g., 8 for 96-well plate).

  • ncols (int) – Number of columns in the plate array (e.g., 12 for 96-well plate).

  • plate_h (int) – Total plate image height (pixels).

  • plate_w (int) – Total plate image width (pixels).

  • bit_depth (int) – 8 or 16.

  • colony_rgb (Tuple[float, float, float]) – Linear RGB in [0,1] for colony tint. Will be forced lighter than agar.

  • agar_rgb (Tuple[float, float, float]) – Linear RGB in [0,1] for agar background.

  • seed (int) – RNG seed for reproducibility.

  • spacing_factor (float) – Factor controlling spacing between colonies (0-1). Lower = more spacing.

  • colony_size_variation (float) – Random variation in colony sizes (0-1). 0 = uniform size.

Returns:

plate_h x plate_w x 3 RGB array, dtype uint8 or uint16.

Return type:

np.ndarray

Example

# Create a standard 96-well plate (8x12) plate = make_synthetic_plate(rows=8, cols=12, plate_h=2048, plate_w=3072)

# Create a 384-well plate (16x24) plate = make_synthetic_plate(rows=16, cols=24, plate_h=2048, plate_w=3072)