piogrowth.analyze module#

Functions used in 0_upload_data.py and 2_turbiostat.py

piogrowth.analyze.build_analysis_params_per_sample_table(stats_df: DataFrame, df_rolling: DataFrame, batch_options: dict, used_params_map: dict | None, selected_fit_times_map: dict | None) DataFrame[source]#

Build a per-sample table of analysis parameters used.

piogrowth.analyze.build_fit_kwargs(model_name: str, n_fits: int, window_points: int, spline_s: int, smooth_mode: str) dict[source]#

Map UI options to growthcurves fit kwargs across API versions.

piogrowth.analyze.collect_selected_series(series: Series, selected_times: ndarray, *, time_tolerance: float = 0.01) tuple[ndarray, ndarray][source]#

Collect selected (t, y) points from a reactor series.

piogrowth.analyze.default_analysis_params(batch_options: dict) dict[source]#

Build default analysis parameter dict for readout table.

piogrowth.analyze.fit_single_series(t_values: ndarray, n_values: ndarray, batch_options: dict) tuple[dict | None, dict][source]#

Fit one reactor series using current batch options.

piogrowth.analyze.format_analysis_params_table(gs: dict, batch_options: dict, analysis_params: dict, n_total: int | None = None, n_selected: int | None = None) DataFrame[source]#

Format analysis parameters into a displayable table.

piogrowth.analyze.format_growth_stats_table(gs: dict) DataFrame[source]#

Format growth stats into a displayable table.

piogrowth.analyze.format_smooth(value) str[source]#

Format spline mode for display.

piogrowth.analyze.get_reactor_stat(stats_df: DataFrame, reactor: str, key: str)[source]#

Get a scalar stat value even if reactor labels are duplicated.

piogrowth.analyze.get_reactor_stats_dict(stats_df: DataFrame, reactor: str) dict[source]#

Get one reactor stats row as a plain dictionary.

piogrowth.analyze.get_selected_times_from_event(event) ndarray[source]#

Extract selected x-values from Streamlit Plotly selection event.

piogrowth.analyze.get_timestamps_from_elapsed_hours(elapsed_hours, start_time, elapsed_time_unit='h', round_to='s')[source]#
piogrowth.analyze.growth_method_from_model(model_name: str) str[source]#

Map selected model name to growth method label.

piogrowth.analyze.is_bad_fit(gs: dict) bool[source]#

Return True when stats indicate no growth or failed fit.

piogrowth.analyze.load_method_notes_markdown() str[source]#

Load method notes markdown shown in the Help popover.

piogrowth.analyze.match_selected_times(all_t: ndarray, selected_times: ndarray, *, time_tolerance: float = 0.01) ndarray[source]#

Return indices in all_t matching selected_times within tolerance.

piogrowth.analyze.normalize_smooth(value) str[source]#

Normalize spline mode to fast/slow with legacy compatibility.

piogrowth.analyze.overlay_selected_points(fig: Figure, t_values: ndarray, y_values: ndarray, selected_times: list[float] | None, *, scale: str, time_tolerance: float = 0.01) Figure[source]#

Overlay included (red) and excluded (gray) points on the growth plot.

piogrowth.analyze.run_model_fitting_on_df_compat(df: DataFrame, model_name: str, n_fits: int, spline_s: int, smooth_mode: str, window_points: int, phase_boundary_method: str, lag_cutoff: float, exp_cutoff: float, min_data_points: int, min_signal_to_noise: float, min_od_increase: float, min_growth_rate: float) tuple[DataFrame, dict][source]#

Run fitting across reactors using gc.fit_model in a version-compatible way.

piogrowth.analyze.update_reactor_stats(stats_df: DataFrame, reactor: str, stats: dict)[source]#

Write a reactor stats dict into the summary DataFrame.