phenotypic.measure.MeasureGridLinRegStats#
- class phenotypic.measure.MeasureGridLinRegStats(section_num: int | None = None)[source]
Bases:
GridMeasureFeaturesEvaluate 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.
- Args:
- section_num: Grid section index to restrict measurements to.
Nonemeasures across the entire grid. Default:None.
- Returns:
pd.DataFrame: Per-object metrics indexed by object label:
RowM, RowB: row regression slope and intercept.
ColM, ColB: column regression slope and intercept.
PredRR, PredCC: predicted centroid from regression.
ResidualError: Euclidean distance between actual and predicted centroid.
- Best For:
Identifying colonies that grew outside their designated grid position on arrayed plates.
Detecting systematic rotation or shear across the plate to validate grid detection quality.
Filtering or weighting colonies by positional confidence before downstream phenotypic analysis.
- Consider Also:
MeasureGridSpatialfor neighbor-distance metrics between adjacent grid cells.MeasureGridSpreadfor detecting over-segmentation and multi-object wells.MeasureBoundsfor raw centroid and bounding box coordinates without regression.
- See Also:
Tutorial 7: Measuring and Exporting for a walkthrough of grid-level measurements.
Category: GRID_LINREG_STATS# Name
Description
RowMSlope of row-wise linear regression fit across column positions. Measures systematic drift in row alignment. Values near 0 indicate horizontal rows; non-zero values suggest rotational misalignment or systematic row curvature across the plate.
RowBIntercept of row-wise linear regression fit. Represents the expected row coordinate when column position is 0. Combined with slope, defines the expected row trend line for quality assessment and position prediction.
ColMSlope of column-wise linear regression fit across row positions. Measures systematic drift in column alignment. Values near 0 indicate vertical columns; non-zero values suggest rotational misalignment or systematic column curvature across the plate.
ColBIntercept of column-wise linear regression fit. Represents the expected column coordinate when row position is 0. Combined with slope, defines the expected column trend line for quality assessment and position prediction.
PredRRPredicted row coordinate from column-wise linear regression. Uses the column position and column regression parameters (ColM, ColB) to estimate where the row coordinate should be if the grid were perfectly aligned. Used for calculating residual errors and detecting misaligned colonies.
PredCCPredicted column coordinate from row-wise linear regression. Uses the row position and row regression parameters (RowM, RowB) to estimate where the column coordinate should be if the grid were perfectly aligned. Used for calculating residual errors and detecting misaligned colonies.
ResidualErrorEuclidean distance between the actual colony centroid and the predicted position from linear regression. Quantifies how far each colony deviates from the expected grid pattern. High values indicate misdetections, off-grid growth, or local plate warping. Used by refinement operations to filter outliers and select the most plausible colony per grid cell.
Methods
__init__Compute grid edges and assign each detected object to a grid cell.
- Parameters:
section_num (Optional[int])
- __del__()
Automatically stop tracemalloc when the object is deleted.
- measure(image)
Compute grid edges and assign each detected object to a grid cell.
- Parameters:
image – Image with detected objects.
- Returns:
DataFrame with grid assignments (ROW_NUM, COL_NUM, ROW_MAJOR_IDX).