clophfit.prtecan.export#
Export data and fit results from Titration objects.
Functions#
Generate parameter combinations for export and fitting. |
|
|
Apply a combination of parameters to the Titration. |
|
Prepare the output folder for a given combination of parameters. |
|
Export fit residuals and their statistics to files. |
|
Write posterior statistics and the trace of a sampled model. |
|
Export a list of bad wells flagged during global fits. |
|
Run pre-fit detection of bad wells and write discarded_wells.txt. |
|
Run optional PyMC fits for export, per well or jointly. |
|
Fit the whole plate at once, classically, and write K per well. |
|
Export all fitted parameters, plots, and data files. |
|
Export dat files [x,y1,..,yN] from copy of titration.data. |
Module Contents#
- clophfit.prtecan.export.generate_combinations()#
Generate parameter combinations for export and fitting.
- Return type:
list[tuple[tuple[bool, …], str]]
- clophfit.prtecan.export.apply_combination(titration, combination)#
Apply a combination of parameters to the Titration.
- Parameters:
titration (clophfit.prtecan.titration.Titration)
combination (tuple[tuple[bool, ...], str])
- Return type:
None
- clophfit.prtecan.export.prepare_output_folder(titration, base_path)#
Prepare the output folder for a given combination of parameters.
- Parameters:
titration (clophfit.prtecan.titration.Titration)
base_path (pathlib.Path)
- Return type:
pathlib.Path
- clophfit.prtecan.export.export_residuals(outfit, fit_results, index)#
Export fit residuals and their statistics to files.
- Parameters:
outfit (pathlib.Path)
fit_results (dict[str, clophfit.fitting.data_structures.FitResult])
index (int)
- Return type:
None
- clophfit.prtecan.export.export_trace_summary(trace, outfit, tag)#
Write posterior statistics and the trace of a sampled model.
Sampling and then keeping nothing from it is not a usable result: the multi-well path inferred
x_true, a per-wellKand the whole ye_mag family, and dropped the trace on return, so a run could be performed but not inspected. This writestrace_summary_<tag>.csv- mean, sd, HDI,r_hatand ESS per variable, the numbers that say whether to trust the rest - and the full trace as NetCDF for anything the summary does not cover.Failures here are logged and swallowed. The summary describes a fit that has already succeeded, and a diagnostic must not be able to destroy the run it reports on.
- Parameters:
trace (object) – PyMC/ArviZ inference data from the fit.
Nonewrites nothing.outfit (Path) – Directory to write into.
tag (str) – Suffix identifying the model, e.g.
"multi".
- Return type:
None
- clophfit.prtecan.export.export_bad_wells(outfit, global_res)#
Export a list of bad wells flagged during global fits.
- Parameters:
outfit (pathlib.Path)
global_res (clophfit.prtecan.titration.TitrationResults)
- Return type:
None
- clophfit.prtecan.export.run_pre_fit_detection(titration, subfolder)#
Run pre-fit detection of bad wells and write discarded_wells.txt.
- Parameters:
titration (clophfit.prtecan.titration.Titration)
subfolder (pathlib.Path)
- Return type:
None
- clophfit.prtecan.export.fit_single_mcmc(titration, datasets, outfit, spec)#
Run optional PyMC fits for export, per well or jointly.
- Parameters:
titration (Titration) – Titration object containing the plate scheme, fit keys, and background noise.
datasets (dict[str, Any]) – Mapping from well identifiers to datasets to fit.
outfit (Path) – Output directory used for residual-refit diagnostic CSV files.
spec (McmcSpec | None) – Sampling request deciding whether and how to run MCMC.
Nonedisables MCMC export.
- Returns:
Per-well PyMC fit results when spec is provided. Returns
Nonewhen spec isNone.- Return type:
TitrationResults | None
- clophfit.prtecan.export.export_plate_fit(titration, datasets, outfit, method)#
Fit the whole plate at once, classically, and write K per well.
The per-well fits above give each well its own noise scale; this fits every well in one least-squares problem with the observation-noise scale profiled per label across the plate, and each control group pooled onto one K. It is a separate output rather than a replacement: it produces a K and a standard error per well, not the fit objects the plot and dataset exports consume.
- Parameters:
titration (Titration) – Supplies the plate scheme, whose control groups set which wells pool.
datasets (dict[str, Any]) – Well identifier to global Dataset, as built for the other fits.
outfit (Path) – Fit output directory.
method (str) –
"lm"for the plate-wide least squares,"odr"to also let each titration step’s x move within its recorded uncertainty.
- Returns:
The CSV written, or
Nonewhen no wells were fitted.- Return type:
Path | None
- clophfit.prtecan.export.export_fit(titration, subfolder, config, spec=None, plate_fit=None)#
Export all fitted parameters, plots, and data files.
- Parameters:
titration (clophfit.prtecan.titration.Titration)
subfolder (pathlib.Path)
spec (clophfit.prtecan.titration.McmcSpec | None)
plate_fit (str | None)
- Return type:
None
- clophfit.prtecan.export.export_data_fit(titration, tecan_config, mcmc=None, plate_fit=None)#
Export dat files [x,y1,..,yN] from copy of titration.data.
- Parameters:
titration (clophfit.prtecan.titration.Titration)
tecan_config (clophfit.prtecan.titration.TecanConfig)
mcmc (clophfit.prtecan.titration.McmcSpec | None)
plate_fit (str | None)
- Return type:
None