fit_power_spectrum

lumicks.pylake.fit_power_spectrum

fit_power_spectrum(power_spectrum, model, analytical_fit_range=(10.0, 10000.0), ftol=1e-07, max_function_evals=10000, bias_correction=True, loss_function='gaussian') lumicks.pylake.force_calibration.power_spectrum_calibration.CalibrationResults

Fit a power spectrum.

Performs force calibration. The power spectrum calibration algorithms implemented here are based on 1 2 3 4 5 6.

Parameters
  • power_spectrum (PowerSpectrum) – A power spectrum used for calibration

  • model (CalibrationModel) – The model to be used for power spectrum calibration.

  • analytical_fit_range (tuple (f_min, f_max), optional) – Tuple of two floats, indicating the frequency range to use for the analytical simple Lorentzian fit, used to obtain initial parameter guesses [Hz]

  • ftol (float) – Termination tolerance for the model fit.

  • max_function_evals (int) – Maximum number of function evaluations during the fit.

  • bias_correction (bool) – Apply bias correction to the estimate of the diffusion coefficient according to [5]. This bias correction is calculated as N/(N+1) where N represents the number of points used in the computation of each data point in the power spectral density. Valid only for loss_function == “gaussian” (see below).

  • loss_function (string) – Loss function to use during fitting. Options: “gaussian” (default), “lorentzian”. For least squares fitting, use “gaussian”. For robust fitting, that is, an attempt to ignore spurious peaks in the power spectrum, use “lorentzian”. In that case, no error estimates are available, and the corresponding entries are set to NaN. This is beta functionality. While usable, this has not yet been tested in a large number of different scenarios. The API can still be subject to change without any prior deprecation notice! If you use this functionality keep a close eye on the changelog for any changes that may affect your analysis.

Returns

Parameters obtained from the calibration procedure.

Return type

CalibrationResults

Raises
  • RuntimeError – If there are fewer than 4 data points to fit in the power spectrum.

  • TypeError – If the supplied power spectrum is not of the type PowerSpectrum.

  • RuntimeError – If there is insufficient data to perform the analytical fit used as initial condition.

  • ValueError – If the loss function is not one of the possible values (case sensitive)

  • Runtime Error – If bias correction is on and the loss function is not “gaussian”

References

1

Berg-Sørensen, K. & Flyvbjerg, H. Power spectrum analysis for optical tweezers. Rev. Sci. Instrum. 75, 594 (2004).

2

Tolić-Nørrelykke, I. M., Berg-Sørensen, K. & Flyvbjerg, H. MatLab program for precision calibration of optical tweezers. Comput. Phys. Commun. 159, 225–240 (2004).

3

Hansen, P. M., Tolic-Nørrelykke, I. M., Flyvbjerg, H. & Berg-Sørensen, K. tweezercalib 2.1: Faster version of MatLab package for precise calibration of optical tweezers. Comput. Phys. Commun. 175, 572–573 (2006).

4

Berg-Sørensen, K., Peterman, E. J. G., Weber, T., Schmidt, C. F. & Flyvbjerg, H. Power spectrum analysis for optical tweezers. II: Laser wavelength dependence of parasitic filtering, and how to achieve high bandwidth. Rev. Sci. Instrum. 77, 063106 (2006).

5

Tolić-Nørrelykke, S. F, and Flyvbjerg, H, “Power spectrum analysis with least-squares fitting: amplitude bias and its elimination, with application to optical tweezers and atomic force microscope cantilevers.” Review of Scientific Instruments 81.7 (2010)

6

Tolić-Nørrelykke S. F, Schäffer E, Howard J, Pavone F. S, Jülicher F and Flyvbjerg, H. Calibration of optical tweezers with positional detection in the back focal plane, Review of scientific instruments 77, 103101 (2006).