Fit Configuration¶
The fit configuration controls which parameters are free vs fixed, their bounds, and the error model. These can be set via the advanced fit settings panel when creating an analysis.
Default Bounds¶
Default bounds are derived from your data, not fixed constants. When you open the analysis dialog the app fetches them from the core (synfit), so the bounds you see in the advanced settings panel are exactly the ones used for the fit. This replaces the old fixed defaults (e.g. effect_0 ∈ [0, 2.0]), which silently clamped fits on assays whose response is measured in large-magnitude units (ELISA OD, RFU counts).
The two asymptotes get their own bounds rather than one shared symmetric bracket. They meet at the response midpoint \(m = \tfrac{1}{2}(y_\min + y_\max)\): the bottom asymptote is bounded […, m] and the top asymptote [m, …], so the bottom's ceiling equals the top's floor. This keeps the two ends from straying into each other's range while still letting each reach its own data-scale plateau.
| Parameter | Default range | How it is derived |
|---|---|---|
log_c50 |
\([\log_{10} c_\min,\ \log_{10} c_\max + 1]\) | Spans the tested non-zero concentration range, with one decade of headroom above the top dose |
hill |
\([0.1, 4.0]\) | Fixed — from shallow to very steep |
| Top asymptote | gaussian \([m,\ y_\max + 2\,\Delta y]\); lognormal \([m,\ 10\,y_\max]\) | Floored at the midpoint \(m\); extends well above the observed top (\(\Delta y = y_\max - y_\min\)) because the response is far less constrained from above than below |
| Bottom asymptote | gaussian \([y_\min - \tfrac{1}{2}\Delta y,\ m]\); lognormal \([y_\min/100,\ m]\) | Capped at the same midpoint \(m\); extends below the observed bottom by half a dynamic range (gaussian) or down toward — but never reaching — zero (lognormal) |
Which of effect_0 / effect_inf is the top vs the bottom depends on the curve direction (see Curve Direction): for inhibition effect_0 is the top and effect_inf the bottom; for activation it is reversed. \(y_\min\) and \(y_\max\) are robust extremes — the second-smallest / second-largest response when that trimmed range remains positive — so a lone outlier doesn't set a bound; otherwise the true min/max are used. Bounds are rounded outward to roughly two significant figures for a clean display, without collapsing a narrow response range that sits on a large offset.
For the lognormal error model the asymptote lower bound is floored at a strictly-positive value (\(y_\min/100\)), since lognormal noise requires positive predictions everywhere; a dataset containing any non-positive response cannot be fit with lognormal. Switching the error model re-derives these bounds.
The bracket is intentionally generous. The soft boundary penalty discourages values outside the range without causing hard failures. You can still override any bound — see Custom Bounds below.
Drug-combination (matrix) fits¶
The matrix analysis dialog derives its bounds the same way. Its parameter tables show the shared Top/Bottom asymptotes (one pair, shared across both drugs) and each drug's log₁₀ C₅₀ / Hill — all bounded by the same data-derived defaults, computed from the two single-agent edges of the matrix. They are editable just like the single-drug table, and switching the error model re-derives them. Each edge's per-asymptote bounds are derived as above (top floored at its midpoint, bottom capped there); the shared Top bound spans both edges' tops and the shared Bottom bound spans both edges' bottoms, so the same midpoint-meeting structure carries over to the combination fit. Small matrices work too — even a 2×2 plate, whose edges have only a couple of concentrations each, derives bounds rather than erroring.
Fixing Parameters¶
You can fix any parameter to a specific value, removing it from optimization. Common use cases:
- Fix effect_0 = 1.0 — when data is normalized so the zero-drug response is exactly 1
- Fix effect_inf = 0.0 — when the saturating-drug response is known to bottom out at 0 (e.g. complete inhibition, or zero baseline activity)
- Fix hill = 1.0 — to force simple (non-cooperative) binding kinetics
When a parameter is fixed, it is removed from the fitting_parameters list and its value is set as a constant in the fit config. The optimizer then has fewer degrees of freedom.
Custom Bounds¶
You can narrow or widen the default bounds for any parameter. For example:
- If you know IC₅₀ is in the low-µM range, tighten
log_c50bounds to[-1, 2] - If the Hill coefficient is expected to be steep, widen to
[0.1, 6.0]
The Fit button stays disabled while a row is invalid, with the reason next to that parameter. The server also rejects the same mistakes with HTTP 400. Rules:
- every initial value and bound must be a finite number
- bounds, when supplied, must be a pair of numbers
[lower, upper] - the lower bound must be less than the upper bound
- an initial value you typed must lie inside the bounds you typed (under Auto, bounds are re-derived per error model and this last check does not apply)
- at least one parameter must stay free to fit
- a concrete (non-Auto) lognormal fit needs positive Top and Bottom initial values, and positive bounds for any of the two you are fitting (neither end of the interval may be ≤ 0). A pinned Top or Bottom is held at its value, so its bounds are not used and not checked; heteroscedastic Gaussian needs variance initials with a > 0, b ≥ 0, c ≥ 0
An inverted Top/Bottom pair is allowed — that can be real data, not a form error.
Fixed values must be within bounds
If you fix a parameter, its value must lie within the specified bounds. The UI enforces this validation.
Auto error model keeps fit flags and initials, not edited bounds
Fit flags and initial values apply under Auto. Edited bounds apply only when a concrete error model (gaussian or lognormal) is selected. With Auto, each error model is fitted as an independent candidate using its own data-derived bounds (widened if needed to contain your initials). See Auto Selection.
Error Model Selection¶
Choose between:
- Auto — fits both Gaussian and Lognormal as independent candidates, each with its own core-derived bounds. Fit flags and initial values you set are kept; hand-edited bounds are not (each candidate re-derives its own). A candidate that cannot represent a value you set is skipped with a reason. The dialog stays on Auto after Fit, and the saved analysis re-runs Auto on a later re-fit (details)
- Gaussian — for assays with additive noise (constant variance)
- Lognormal — for assays with multiplicative noise (constant CV)
See Error Models for details on when to use each. When "Auto" is selected, the analysis detail page shows the winner as Auto (Gaussian) or Auto (Lognormal).
Curve Direction¶
The direction is set per drug when you upload the data and stored with the dataset; the analysis dialog uses it. There is no default: every analysis needs an explicit direction before it can be fitted.
Older saved analyses without a direction got one from their fitted curve (a falling curve is inhibition, a rising one activation). If that wasn't possible, the analysis asks you to choose a direction when you open the dataset, and refits once you save it. For a drug combination, the chosen directions are saved with the dataset and apply to all of its analyses.
The same Hill function fits both directions; only the role of the two asymptotes flips.
- Inhibition — response decreases with drug concentration.
effect_0is the high-end plateau (Top),effect_infis the low-end plateau (Bottom). The fitted potency is reported as IC₅₀. - Activation — response increases with drug concentration.
effect_0is the low-end baseline (Bottom),effect_infis the saturated maximum (Top). The fitted potency is reported as EC₅₀.
The direction affects initial guesses and the displayed potency label only. The underlying curve is always synfit.hill.hill_curve.
Re-fitting¶
Re-fitting an analysis — for example after excluding points, or by running the same settings again — recomputes it with the current version of the fitting library. The numbers can therefore differ from the original run. Each analysis records which library version produced it (core_version).
Implementation details
Core data classes (synfit.data):
FitConfig— dataclass with fields:log_c50,hill,effect_0,effect_inf(initial values),asymmetry(initial for 5p),fitting_parameters(list of free params),bounds(FitBounds | None),noise(NoiseSpectagged union), anddirection.boundsdefaults toNone;SingleDrugFitthen derives data-driven bounds via_init_config_from_data. Explicitly-supplied bounds are honoured literally.FitBounds— dataclass with per-parameter(lo, hi)tuples, includingasymmetryfor the 5p model.synfit.single.default_fit_config(data, direction, noise)/default_bounds(...)— public entry points that return the same data-derived defaults the fitter applies, so the UI sources its editable defaults from one place. The backend exposes these to the frontend at/api/v1/datasets/<id>/default-fit-config/.