DwelltimeModel¶
lumicks.pylake.DwelltimeModel
- class DwelltimeModel(dwelltimes, n_components=1, *, min_observation_time=0, max_observation_time=inf, tol=None, max_iter=None)¶
Exponential mixture model optimization for dwelltime analysis.
- Parameters
dwelltimes (numpy.ndarray) – observations on which the model was trained. Note: the units of the optimized lifetime will be in the units of the dwelltime data. If the dwelltimes are calculated as the number of frames, these then need to be multiplied by the frame time in order to obtain the physically relevant parameter.
n_components (int) – number of components in the model.
min_observation_time (float) – minimum experimental observation time
max_observation_time (float) – maximum experimental observation time.
tol (float) – The tolerance for optimization convergence. This parameter is forwarded as the
ftol
argument toscipy.optimize.minimize(method="SLSQP")
.max_iter (int) – The maximum number of iterations to perform. This parameter is forwarded as the
maxiter
argument toscipy.optimize.minimize(method="SLSQP")
.
- calculate_bootstrap(iterations=500)¶
Calculate a bootstrap distribution for the model.
- Parameters
iterations (int) – Number of iterations to sample for the distribution.
- hist(n_bins=25, bin_spacing='linear', hist_kwargs=None, component_kwargs=None, fit_kwargs=None, xscale=None, yscale=None)¶
Plot the dwelltime distribution histogram and overlayed model density.
- Parameters
n_bins (int) – number of bins in the histogram
bin_spacing ({"log", "linear"}) – determines how bin edges are spaced apart
hist_kwargs (Optional[dict]) – dictionary of plotting kwargs applied to histogram
component_kwargs (Optional[dict]) – dictionary of plotting kwargs applied to the line plot for each component
fit_kwargs (Optional[dict]) – dictionary of plotting kwargs applied to line plot for the total fit
xscale ({"log", "linear", None}) – scaling for the x-axis; when
None
default is “linear”yscale ({"log", "linear", None}) – scaling for the y-axis; when
None
default is same asbin_spacing
- pdf(x)¶
Probability Distribution Function (states as rows).
- Parameters
x (np.array) – array of independent variable values at which to calculate the PDF.
- plot(n_bins=25, bin_spacing='linear', hist_kwargs=None, component_kwargs=None, fit_kwargs=None, xscale=None, yscale=None)¶
Deprecated since version 0.12.0: This method has been renamed to more closely match its behavior. Use
DwelltimeModel.hist()
instead.
- property aic¶
Akaike Information Criterion.
- property amplitudes¶
Fractional amplitude of each model component.
- property bic¶
Bayesian Information Criterion.
- property bootstrap¶
Bootstrap distribution.
Deprecated since version 0.13.3: This property will be removed in a future release. Use the class
population.dwelltime.DwelltimeBootstrap
returned fromcalculate_bootstrap()
instead.
- property lifetimes¶
Lifetime parameter (in time units) of each model component.
- property rate_constants¶
First order rate constant (units of per time) of each model component.