airy

This module’s scope is the modeling and fitting of Airy functions to data.

class tuna.models.airy.airy_fitter(b_ratio, center_col, center_row, data, finesse, gap, wavelength, mpyfit_parinfo=[])[source]

This class’ responsibility is to fit the Airy function. It will use the given parameters as initial guesses. The fit will stop when the fitter converges.

It inherits from the threading.Thread class, and it auto-starts its thread execution. Clients are expected to use its .join ( ) method before using its results.

Its constructor signature is:

Parameters:

  • b_ratio : float

    The ratio between the pixel size and the camera focal length (b).

  • center_col : integer

    The column for the center of the rings, in pixels.

  • center_row : integer

    The row for the center of the rings, in pixels.

  • data : numpy.ndarray

    Contains the data to be fitted.

  • finesse : float

    (F).

  • gap : float

    The distance between the étalons, in microns (n e_i).

  • wavelength : float

    Wavelength in microns ( lambda_c ).

  • mpyfit_parinfo : list : defaults to [ ]

    List of parameters’ boundaries, and whether they are fixed or not. Must respect mpyfit’s specification.

run()[source]

This method’s goal is to fit an Airy model to a given input.

tuna.models.airy.airy_plane(b_ratio=9e-06, center_col=256, center_row=256, continuum=1, finesse=15, gap=250, intensity=100, shape_cols=512, shape_rows=512, wavelength=0.6563)[source]

This function’s goal is to model the Airy function as:

I = C + \dfrac{I_0}{1 + \dfrac{4F^2}{\pi^2} \sin^2 (\phi/2)}

From the input parameters, this function will return a dataset with the value for I calculated on each point. The intention is to produce a tridimensional array where each plane is an image with rings equivalent to the ones in Fabry-Pérot interferograms.

To calculate phi:

\phi = 2 \pi \dfrac{ 2 n e_i \cos (theta)} {\lambda_c }

Where:

n e_i = n ( e + i \delta_e )

theta = tan^{-1} ( b r ), b = s / f

Parameters: (In parentheses, the equation variable the paremeter corresponds to)

  • b_ratio : float : defaults to 9.e-6

    The ratio between the pixel size and the camera focal length (b).

  • center_col : integer : defaults to 256

    The column for the center of the rings, in pixels.

  • center_row : integer : defaults to 256

    The row for the center of the rings, in pixels.

  • continuum : float : defaults to 1

    The value of the background intensity.

  • finesse : float : defaults to 15

    (F).

  • gap : float : defaults to 250

    The distance between the étalons, in microns (n e_i).

  • intensity : float : defaults to 100

    The beam maximum intensity (I_0).

  • shape_cols : integer : defaults to 512

    The number of columns for the 2D shape (columns, rows) to be generated.

  • shape_rows : integer : defaults to 512

    The number of rows for the 2D shape (columns, rows) to be generated.

  • wavelength : float : defaults to 0.6563

    Wavelength in microns ( lambda_c ).

Returns:

  • result : numpy.ndarray

    Contains the data for the Airy model, given the input parameters.

tuna.models.airy.fit_airy(b_ratio: float, center_col: float, center_row: float, data: numpy.ndarray, finesse: float, gap: float, wavelength: float, mpyfit_parinfo: list=[]) -> (<class 'dict'>, <class 'tuna.io.can.can'>)[source]

This method’s goal is to conveniently fit the Airy function. It will use the given parameters as initial guesses. The fit will stop when the fitter converges.

It inherits from the threading.Thread class, and it auto-starts its thread execution. Clients are expected to use its .join ( ) method before using its results.

Arguments:

  • b_ratio : float

    The ratio between the pixel size and the camera focal length (b).

  • center_col : float

    The column for the center of the rings, in pixels.

  • center_row : float

    The row for the center of the rings, in pixels.

  • data : numpy.ndarray

    Contains the data to be fitted.

  • finesse : float

    (F).

  • gap : float

    The distance between the étalons, in microns (n e_i).

  • wavelength : float

    Wavelength in microns ( lambda_c ).

  • mpyfit_parinfo : list : defaults to [ ]

    List of parameters’ boundaries, and whether they are fixed or not. Must respect mpyfit’s specification.

tuna.models.airy.least_mpyfit(p, args)[source]

This function’s goal is to wrap the airy function proper, so that the API for using mpyfit is obeyed.

Parameters:

  • p : tuple

    Containing the b_ratio, center_col, center_row, continuum, finesse, gap and intensity values.

  • args : tuple

    Containing the shape_cols, shape_rows, wavelength, data and flat values.