scopesim.effects.spectral_trace_list_utils.Transform2D#
- class scopesim.effects.spectral_trace_list_utils.Transform2D(matrix, pretransform_x=None, pretransform_y=None, posttransform=None)#
Bases:
object2-dimensional polynomial transform.
The class is instantiated from a m x n matrix A that contains the coefficients of the polynomial. Along rows, the power of x increases; along columns, the power of y increases, such that A[j, i] is the coefficient of x^i y^j.
The functions pretransform_x and pretransform_y can be used to transform the input variables before the matrix is applied. The function posttransform can be applied to the output after application of the matrix.
In Scopesim, a usecase for the pre- and post-transform functions is the METIS LMS, where the matrices are applied to phases while Scopesim operates on wavelengths. The functions to pass are lam2phase and phase2lam.
- Parameters:
matrix (np.array) – matrix of polynomial coefficients
pretransform_x (function, tuple)
pretransform_y (function, tuple) – If not None, the function is applied to the input variable x or y before the actual 2D transform is computed
posttransform (function, tuple) – If not None, the function is applied to the output variable after the 2D transform is computed
tuple (When passed as a)
itself (the first element is the function)
:param : :param the second element is a dictionary of arguments to the function.: :param Example: :param
`: :param def rescale(x: return x * scale :param scale=1.): return x * scale :param pretransform_x = (rescale: :type pretransform_x = (rescale: 0.5}) :param {"scale": :type {"scale": 0.5}) :param `:- __init__(matrix, pretransform_x=None, pretransform_y=None, posttransform=None)#
Methods
__init__(matrix[, pretransform_x, ...])fit(xin, yin, xout[, degree])Determine polynomial fits.
gradient()Compute the gradient of a 2d polynomial transformation.
- classmethod fit(xin, yin, xout, degree=4)#
Determine polynomial fits.
- gradient()#
Compute the gradient of a 2d polynomial transformation.