{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How To: Fit Logistic Growth Models\n", "\n", "Fit logistic growth curves to time-series colony measurements and extract\n", "kinetic parameters (growth rate, carrying capacity, lag time) using\n", "`LogGrowthModel`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from phenotypic.data import load_meas\n", "from phenotypic.analysis import LogGrowthModel" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df = load_meas()\n", "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Fit the Model\n", "\n", "Specify the target measurement column, grouping structure, and time\n", "label. The model fits a logistic curve to each group independently." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "model = LogGrowthModel(\n", " on=\"Shape_Area\",\n", " groupby=[\"Metadata_Strain\"],\n", " time_label=\"Metadata_Time\",\n", " agg_func=\"mean\",\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "results = model.analyze(df)\n", "results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The results DataFrame contains fitted parameters for each group:\n", "growth rate, carrying capacity (K), and lag time. Use these to\n", "compare strain fitness across experimental conditions." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11.0" } }, "nbformat": 4, "nbformat_minor": 4 }