Simulation of fluorophore brightness¶
-
class
fret_tester.
PolyLnBrightness
(parms, max_mean=None, precision=0.0)[source]¶ LognormalBrightness subclass with polynomial mean-vs.-std relation
This is a subclass of
LognormalBrightness
where the relation between mean and standard deviation is described by a polynomial.Parameters: - parms (list of float) – Polynomial coefficients in decreasing order
- max_mean (float or None) – If given (and precision > 0), precalculate parameters of the lognormal distributions (corresponding to means and matchings stds) from 0 to max_mean in steps of precision for a performance gain (at cost of accuracy). Defaults to None, i.e. no pre-computation.
- precision (float or None) – Precision of pre-computed lognormal parameters. The smaller, the more accurate, as long as it is > 0. Defaults to 0, i.e. no pre-computation.
-
class
fret_tester.
LognormalBrightness
(max_mean=None, precision=0.0)[source]¶ Fluorophore brightness modeled by a lognormal distribution
This is intended as a base class. One needs to implement the
std_from_mean()
in a subclass which gives the lognormal distribution standard deviation for a certain mean.Parameters: - max_mean (float or None) – If given (and precision > 0), precalculate parameters of the lognormal distributions (corresponding to means and matchings stds) from 0 to max_mean in steps of precision for a performance gain (at cost of accuracy). Defaults to None, i.e. no pre-computation.
- precision (float or None) – Precision of pre-computed lognormal parameters. The smaller, the more accurate, as long as it is > 0. Defaults to 0, i.e. no pre-computation.
-
parameters
(m)[source]¶ Calculate lognormal parameters from desired mean
Compute \(\mu\) and \(\sigma\) of the Gaussian distribution that the lognormal distribution is based on such that the lognormal distribution will have mean m and standard deviation
std_from_mean(m)
(see__init__()
).Parameters: m (array_like) – Mean value for which the lognormal parameters are desired Returns: - mu (numpy.ndarray) – \(\mu\) of the underlying Gaussian
- sigma (numpy.ndarray) – \(\sigma\) of the underlying Gaussian
-
generate
(m)[source]¶ Draw random value from the brightness distribution with given mean
Parameters: m (array_like) – Mean values. For each entry, draw a random number from the brightness distribution whose mean value is this entry. Returns: Random brightness values Return type: numpy.ndarray
-
__call__
(m)[source]¶ Synonymous for
generate()