clophfit.fitting.odr#

Orthogonal Distance Regression (ODR) utilities and fitting pipeline.

Functions#

format_estimate(value, error[, significant_digit_limit])

Format the value and its associated error into "{value} ± {error}" string.

generalized_combined_model(pars, x, dataset_lengths)

Handle multiple datasets with different lengths and masks.

fit_binding_odr(ds_or_fr)

Analyze multi-label titration datasets using ODR.

fit_binding_odr_recursive(ds_or_fr[, max_iterations, tol])

Analyze multi-label titration datasets using iterative ODR.

outlier(output, *[, threshold, plot_z_scores])

Identify outliers.

fit_binding_odr_recursive_outlier(ds_or_fr[, tol, ...])

Analyze multi-label titration datasets using ODR with outlier removal.

Module Contents#

clophfit.fitting.odr.format_estimate(value, error, significant_digit_limit=5)#

Format the value and its associated error into “{value} ± {error}” string.

Parameters:
  • value (float)

  • error (float)

  • significant_digit_limit (int)

Return type:

str

clophfit.fitting.odr.generalized_combined_model(pars, x, dataset_lengths)#

Handle multiple datasets with different lengths and masks.

Parameters:
  • pars (list[float])

  • x (clophfit.clophfit_types.ArrayF)

  • dataset_lengths (list[int])

Return type:

clophfit.clophfit_types.ArrayF

clophfit.fitting.odr.fit_binding_odr(ds_or_fr)#

Analyze multi-label titration datasets using ODR.

Parameters:

ds_or_fr (Dataset | FitResult[MiniT]) – Either a Dataset (will run initial LS fit) or a FitResult with initial params.

Returns:

ODR fitting results. Residuals are WEIGHTED by the ORIGINAL y_err (before ODR modified it), making them comparable to LM residuals.

Return type:

FitResult[odr.Output]

clophfit.fitting.odr.fit_binding_odr_recursive(ds_or_fr, max_iterations=15, tol=0.1)#

Analyze multi-label titration datasets using iterative ODR.

Parameters:
  • ds_or_fr (Dataset | FitResult[MiniT]) – Either a Dataset (will run initial LS fit) or a FitResult with initial params.

  • max_iterations (int) – Maximum number of iterations.

  • tol (float) – Convergence tolerance for residual variance.

Returns:

ODR fitting results.

Return type:

FitResult[odr.Output]

clophfit.fitting.odr.outlier(output, *, threshold=2.0, plot_z_scores=False)#

Identify outliers.

Parameters:
  • output (scipy.odr.Output)

  • threshold (float)

  • plot_z_scores (bool)

Return type:

clophfit.clophfit_types.ArrayMask

clophfit.fitting.odr.fit_binding_odr_recursive_outlier(ds_or_fr, tol=0.5, threshold=2.0)#

Analyze multi-label titration datasets using ODR with outlier removal.

Parameters:
  • ds_or_fr (Dataset | FitResult[MiniT]) – Either a Dataset (will run initial LS fit) or a FitResult with initial params.

  • tol (float) – Convergence tolerance for residual variance.

  • threshold (float) – Z-score threshold for outlier detection.

Returns:

ODR fitting results.

Return type:

FitResult[odr.Output]