hologradpy.fitting ================== .. py:module:: hologradpy.fitting .. autoapi-nested-parse:: This module contains functions for curve fitting. Classes ------- .. autoapisummary:: hologradpy.fitting.FitSine Functions --------- .. autoapisummary:: hologradpy.fitting.tilt hologradpy.fitting.remove_tilt hologradpy.fitting.gaussian hologradpy.fitting.fit_gaussian Module Contents --------------- .. py:function:: tilt(xy, *args, mask=None) Fit function containing the first three Zernike polynomials of the form z = c0 + c1 * x + c2 * y + c3 * 2xy. :param xy: x, y coordinate vectors. :param args: Vector of length 4, containing Zernike coefficients. :return: First 3 Zernike polynomials. .. py:function:: remove_tilt(img, mask=None) This function removes fits the first three Zernike polynomials (Piston and tilt) to an image and subtracts the fitted function from the original image. :param ndarray img: Input image. :param ndarray mask: Binary mask in which to remove tilt. :return: Image without tilt. .. py:function:: gaussian(xy, *args) Gaussian fit function. :param xy: x, y coordinate vectors. :param args: Fitting parameters passed to patterns.gaussian. :return: Gaussian. .. py:function:: fit_gaussian(img, dx=None, dy=None, sig_x=15, sig_y=15, a=None, c=0, blur_width=10, xy=None) Fits a 2D Gaussian to an image. The image s blurred using a Gaussian filer before fitting. :param img: Input image. :param dx: X-offset of Gaussian [px]. :param dy: Y-offset of Gaussian [px]. :param sig_x: X-width of Gaussian [px]. :param sig_y: -width of Gaussian [px]. :param a: Amplitude. :param c: Offset. :param blur_width: Width of Gaussian blurring kernel [px]. :param xy: X, Y meshgrid. If not specified, pixel coordinates are used. :return: Fitting parameters, parameter errors. .. py:class:: FitSine(fl, k, dx=None, dy=None) This class is used in the wavefront measurement to fit a 2D sine to the interference pattern on the camera. The distance between the sample and reference patch can be set by calling the method set_dx_dy. .. py:attribute:: fl .. py:attribute:: dx :value: None .. py:attribute:: dy :value: None .. py:attribute:: k .. py:method:: set_dx_dy(dx, dy) Method to set parameters dx and dy. :param dx: New dx. :param dy: New dy. .. py:method:: fit_sine(xy, *args) Method to perform 2D sine fit. :param xy: x, y coordinate vectors. :param args: Args passed to patterns.fringes_wavefront :return: 2D sine.