Models#
Built-in models are retrieved by name with get_model();
Models in the user guide lists them. A custom
model subclasses Model, or
BindingModel when it computes equilibrium species.
- bindcurve.get_model(name)[source]#
Return a built-in model by name.
- class bindcurve.Model[source]#
Dose-response model mapping a fraction in [0, 1] onto two plateaus.
The response is
ymin + (ymax - ymin) * fraction(x).- parameters#
All parameters, including
yminandymax.- Type:
Notes
A custom model sets
nameandparametersand implements_fraction(self, x, **params), which receives the concentrations as an array and every parameter as a keyword argument, already validated against itsParameterlimits, and returns the fraction at each concentration. Fitted parameters other than the plateaus and concentrations also need a starting value from an extendedguess. The model can then be passed tofitin place of a name.- evaluate(x, **params)[source]#
Evaluate the response at concentrations
x.- Parameters:
- Raises:
TypeError – If parameters are missing or unknown.
ValueError – If a concentration or parameter value is invalid.
- Return type:
- class bindcurve.BindingModel[source]#
Equilibrium-binding model whose fraction is the tracer-bound fraction.
Notes
A custom binding model implements
_species(self, x, **params)in place of_fraction. It returns a dict of arrays that includes the bound fraction"Fbs".- species(x, **params)[source]#
Return the equilibrium concentrations of all species.
- Parameters:
x (ndarray) – Concentrations of the titrated component, as in
Model.evaluate.**params (float) – A value for every parameter of the model, by name.
- Returns:
Arrays shaped like
x, in the unit of the concentrations:R: free receptorLs: free tracerRLs: tracer-receptor complexL: free competitor (competitive models)RL: competitor-receptor complex (competitive models)RLLs: ternary complex (four-state models)Ls_nonspecific: nonspecifically bound tracer (dir_total)L_nonspecific: nonspecifically bound competitor (comp_*_total)Fbs: fraction of tracer bound to receptor (dimensionless)
dir_simplereturns onlyRandFbs.- Return type:
- class bindcurve.Parameter(name, concentration=False, fixed=False, min=-inf, max=inf)[source]#
One model parameter.
- Parameters:
name (str) – Keyword used in
Model.evaluateand in thefixedandboundsarguments offit.concentration (bool) – Whether this is a positive, concentration-like parameter. Such parameters are optimized on a log10 coordinate and summarized across experiments on the log10 scale.
fixed (bool) – Whether this is an assay constant that must be given in
fit(..., fixed=...).min (float) – Physical limits of the parameter value.
max (float) – Physical limits of the parameter value.