Utility functions

fret_tester.bi_beta_fit(eff, bins=100)[source]

Fit mixture of two Beta distribution PDFs to histogram

Fits f * beta.pdf(x, a1, b1) + (1 - f) * beta.pdf(x, a2, b2) (where beta.pdf is from scipy.stats) to the histogram of f using least squares fitting.

Parameters:
  • eff (numpy.ndarray) – Array of FRET efficiencies
  • bins (int) – Number of bins for the histogram
Returns:

  • f (float) – Weight of first beta distribution. Second distribution has weight 1 - f.
  • param1 (tuple of float) – Shape parameters for first Beta distribution, i.e. (a1, b1).
  • param2 (tuple of float) – Shape parameters for second Beta distribution, i.e. (a2, b2).