hologradpy.fitting¶
This module contains functions for curve fitting.
Classes¶
This class is used in the wavefront measurement to fit a 2D sine to the interference pattern on the camera. The |
Functions¶
|
Fit function containing the first three Zernike polynomials of the form z = c0 + c1 * x + c2 * y + c3 * 2xy. |
|
This function removes fits the first three Zernike polynomials (Piston and tilt) to an image and subtracts the |
|
Gaussian fit function. |
|
Fits a 2D Gaussian to an image. The image s blurred using a Gaussian filer before fitting. |
Module Contents¶
- hologradpy.fitting.tilt(xy, *args, mask=None)¶
Fit function containing the first three Zernike polynomials of the form z = c0 + c1 * x + c2 * y + c3 * 2xy.
- Parameters:
xy – x, y coordinate vectors.
args – Vector of length 4, containing Zernike coefficients.
- Returns:
First 3 Zernike polynomials.
- hologradpy.fitting.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.
- hologradpy.fitting.gaussian(xy, *args)¶
Gaussian fit function.
- Parameters:
xy – x, y coordinate vectors.
args – Fitting parameters passed to patterns.gaussian.
- Returns:
Gaussian.
- hologradpy.fitting.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.
- Parameters:
img – Input image.
dx – X-offset of Gaussian [px].
dy – Y-offset of Gaussian [px].
sig_x – X-width of Gaussian [px].
sig_y – -width of Gaussian [px].
a – Amplitude.
c – Offset.
blur_width – Width of Gaussian blurring kernel [px].
xy – X, Y meshgrid. If not specified, pixel coordinates are used.
- Returns:
Fitting parameters, parameter errors.
- class hologradpy.fitting.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.
- fl¶
- dx = None¶
- dy = None¶
- k¶
- set_dx_dy(dx, dy)¶
Method to set parameters dx and dy. :param dx: New dx. :param dy: New dy.
- 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.