residual¶
-
pyoof.residual(params, idx, N_K_coeff, beam_data_norm, u_data, v_data, d_z, wavel, illum_func, telgeo, resolution, box_factor, interp, config_params)[source] [edit on github]¶ Wrapper for the
residual_truefunction. The objective of this function is to fool theleast_squarespackage by changing the number of parameters that will be used in the fit. The parameter array must be organized as follows,params = np.hstack([ I_coeff, K_coeff]). The parameter selection is done by default or by adding aconfig_params.ymlfile to thefit_beamfunction.Parameters: params :
ndarrayTwo stacked arrays, the illumination and Zernike circle polynomials coefficients.
params = np.hstack([I_coeff, K_coeff]).idx :
listList of the positions for the removed parameters for the least squares minimization in the
paramsarray. on.N_K_coeff :
intTotal number of Zernike circle polynomials coefficients to fit. It is obtained from the order to be fitted with the formula
N_K_coeff = (n + 1) * (n + 2) // 2..beam_data_norm :
listThe
beam_data_normis a list with the three observed beam maps, \(P^\mathrm{obs}_\mathrm{norm}(u, v)\), minus, zero and plus out-of-focus. The data has to be initially normalized by its maximum.u_data :
ndarray\(x\) axis value for the 3 beam maps in radians. The values have to be flatten, in one dimension, and stacked in the same order as the
d_z = [d_z-, 0., d_z+]values from each beam map.v_data :
ndarray\(y\) axis value for the 3 beam maps in radians. The values have to be flatten, one dimensional, and stacked in the same order as the
d_z = [d_z-, 0., d_z+]values from each beam map.d_z :
listRadial offset \(d_z\), added to the sub-reflector in meters. This characteristic measurement adds the classical interference pattern to the beam maps, normalized squared (field) radiation pattern, which is an out-of-focus property. The radial offset list must be as follows,
d_z = [d_z-, 0., d_z+]all of them in meters.wavel :
floatWavelength, \(\lambda\), of the observation in meters.
illum_func :
functionIllumination function, \(E_\mathrm{a}(x, y)\), to be evaluated with the key I_coeff. The illumination functions available are
illum_pedestalandillum_gauss.telgeo :
listList that contains the blockage distribution, optical path difference (OPD) function, and the primary radius (
float) in meters. The list must have the following order,telego = [block_dist, opd_func, pr].resolution :
intFast Fourier Transform resolution for a rectangular grid. The input value has to be greater or equal to the telescope resolution and with power of 2 for faster FFT processing. It is recommended a value higher than
resolution = 2 ** 8.box_factor :
intRelated to the FFT resolution (resolution key), defines the image pixel size level. It depends on the primary radius,
pr, of the telescope, e.g. abox_factor = 5returnsx = np.linspace(-5 * pr, 5 * pr, resolution), an array to be used in the FFT2 (fft2).interp :
boolIf
True, it will process the correspondent interpolation between the observed grid (\(P^\mathrm{obs}_\mathrm{norm}(u, v)\)) and the computed grid (\(P_\mathrm{norm}(u, v)\)) for the FFT2 aperture distribution model (\(\underline{E_\mathrm{a}}(x, y)\)).config_params :
dictContains the values for the fixed parameters (excluded from the least squares minimization), by default four parameters are kept fixed,
i_amp,x0,y0andK(0, 0). See theconfig_params.ymlfile.Returns: _residual_true :
ndarraySame output from
residual_true. One dimensional array of the residual between the observed data and the FFT aperture distribution model. It has been concatenated as minus, zero and plus radial offset (to do a multiple fit). It is required to have the residual in one dimension in order to use a least squares minimizationleast_squarespackage.Notes
The idx key needs an indices list of the parameters to be removed. The structure of the parameters always follows,
params = np.hstack([ I_coeff, K_coeff]), a list withidx = [0, 1, 2, 4]will remove from the least squares minimization,[i_amp, taper_dB, x0, y0, K(0, 0)].