Correction loop
- Asterix.wfsc.correction_loop.correction_loop(testbed: Testbed, estimator: Estimator, corrector: Corrector, mask_dh: MaskDH, Loopconfig, SIMUconfig, input_wavefront=1.0, initial_DM_voltage=0.0, silence=False, **kwargs)
Run a full loop for several matrices.
In each new iteration, we update the matrix and run correction_loop_1matrix() anew.
AUTHOR : Johan Mazoyer
- Parameters:
- testbedOpticalSystem.Testbed
Object which describes your testbed.
- estimatorEstimator
Estimator object containing all information about the WF estimation.
- correctorCorrector.
Corrector object containing all information about the WF correction.
- mask_dh: 2d numpy array
Binary array of size [dimScience, dimScience], the dark-hole mask.
- Loopconfigdict
Simulation parameters for the WFS&C loop.
- SIMUconfigdict
Simulation parameters.
- input_wavefrontfloat or 2d complex array or 3d complex array
Initial wavefront at the beginning of this loop. Electrical Field which can be a:
float=1 if there are no phase/amplitude aberrations (default) 2D complex array, of size phase_abb.shape if monochromatic or 3D complex array of size [self.nb_wav,phase_abb.shape] if polychromatic
- !!CAREFUL!!: Right now we do not use this wf to measure the matrix, although the update_matrices()
method inside the Corrector allows it. Currently, each matrix is measured with a flat field in the entrance of the testbed (input_wavefront = 1). ‘input_wavefront’ is only used in the loop once the matrix is calculated. This can be changed but be careful.
- initial_DM_voltagefloat or 1D array
Initial DM voltages at the beginning of this loop. The Matrix is measured using these initial DM voltages. Can be:
float 0 if flat DMs (default) or 1D array of size testbed.number_act
- silenceboolean, default False.
Whether to silence print outputs.
- Returns:
- CorrectionLoopResultdict
A dictionary containing the results of all loops.
- Asterix.wfsc.correction_loop.correction_loop_1matrix(testbed: Testbed, estimator: Estimator, corrector: Corrector, mask_dh: MaskDH, Nbiter_corr, CorrectionLoopResult, gain=0.1, Nbmode_corr=None, Linesearch=False, Search_best_Mode=False, input_wavefront=1.0, initial_DM_voltage=0.0, nb_photons=0, silence=False, **kwargs)
Run a loop for a given interaction matrix.
AUTHOR : Johan Mazoyer
- Parameters:
- testbedOpticalSystem.Testbed
object which describes your testbed
- estimatorEstimator
This contains all information about the estimation
- correctorCorrector
This contains all information about the correction
- mask_dh: 2d numpy array
binary array of size [dimScience, dimScience] : dark hole mask
- Nbiter_corrint or list of int
number of iterations in the loop
- CorrectionLoopResult: dict
Dictionary containing the result of the previous loop. This will be updated with the result of the current loop.
- gainfloat between 0 and 1, default 0.1
Control gain of the loop in EFC mode.
- Nbmode_corrint or list of int
Of same size as Nbiter_corr; SVD modes for each iteration.
- Linesearch: bool, default False
If True, the function correction_loop_1matrix() will call itself at each iteration with Search_best_Mode=True to find the best SVD inversion mode among a few Linesearch modes.
- Search_best_Mode: bool, default False
If true, the algorithm does not return the loop information, just the best mode and best contrast. This mode is used in Linesearch mode. Be careful when using this parameter, it can create an infinite loop.
- input_wavefrontfloat or 2d complex array or 3d complex array
Initial wavefront at the beginning of this loop. Electrical Field which can be a:
float=1 if no phase/amplitude aberrations present (default) 2D complex array, of size phase_abb.shape if monochromatic or 3D complex array of size [self.nb_wav,phase_abb.shape] if polychromatic
- initial_DM_voltagefloat or 1D array
Initial DM voltages at the beginning of this loop. The Matrix is measured using this initial DM voltages. Can be:
float 0 if flat DMs (default) or 1D array of size testbed.number_act
- nb_photonsfloat, optional, default 0
Number of photons entering the pupil. If 0, no photon noise.
- silenceboolean, default False.
Whether to silence print outputs.
- Returns:
- if Search_best_Mode == True, return [bestMode, bestContrast]
- else return CorrectionLoopResult dictionary updated with the results from this loop
- Asterix.wfsc.correction_loop.save_loop_results(CorrectionLoopResult, config, testbed: Testbed, MaskScience, result_dir, silence=False)
Save the results from a correction loop into the directory ‘result_dir’.
All fits files have all parameters in their header. The configfile is also saved, to an .ini file.
AUTHOR : Johan Mazoyer
- Parameters:
- CorrectionLoopResultdict
Dictionary containing the results from correction_loop_1matrix() or correction_loop().
- configdict
Dictionary holding the configuration from the input parameter file.
- testbedOpticalSystem
An OpticalSystem object which describes your testbed.
- MaskScience2d numpy array
Binary array of size [dimScience, dimScience]: dark hole mask.
- result_dirstring
Directory to save the results to.
- silenceboolean, default False.
Whether to silence print outputs.