{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How To: Manual Grid Detection When Automatic Fails\n", "\n", "When automatic grid detection does not find the correct grid layout,\n", "use `ManualGridDetector` to specify colony positions explicitly." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from phenotypic.data import load_yeast_plate\n", "from phenotypic.detect import ManualGridDetector" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plate = load_yeast_plate()\n", "plate.dash()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Identify Anchor Points\n", "\n", "Use the interactive Plotly figure above to find the pixel coordinates of\n", "the top-left colony center (`coord1`) and optionally the adjacent colony\n", "at row 1, column 1 (`coord2`). Hover over the colonies to read coordinates.\n", "\n", "`ManualGridDetector` places a footprint of specified `shape` and `width`\n", "at each grid position, using the anchor points to infer the grid spacing." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Replace these coordinates with values from your plate\n", "detector = ManualGridDetector(\n", " coord1=(50, 50), # (y, x) of top-left colony center\n", " coord2=(120, 120), # (y, x) of colony at row 1, col 1\n", " shape=\"disk\",\n", " width=15,\n", ")\n", "plate = detector.apply(plate)\n", "plate.dash(overlay=True, show_grid=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Adjust `coord1`, `coord2`, and `width` until the footprints align with\n", "your colonies. Increase `width` for larger colonies." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11.0" } }, "nbformat": 4, "nbformat_minor": 4 }