WF Estimation
- class Asterix.wfsc.estimator.Estimator(Estimationconfig, testbed: Testbed, matrix_dir='', save_for_bench=False, realtestbed_dir='', silence=False)
Bases:
object
Estimator Class allows you to define a WF estimator.
- It must contains 2 functions at least:
- an initialization (e.g. PW matrix) Estimator.__init__(), with parameters:
the testbed structure
the estimation parameters
saving directories
The estimator initialization requires previous initialization of the testbed.
- an estimation function Estimator.estimate(), with parameters:
the entrance EF
DM voltages
the wavelength
It returns the estimation as a 2D array. In all generality, it can be pupil or focal plane, complex or real with keywords (Estim.is_focal_plane = True, Estim.is_complex = True) to explain the form of the output and potentially prevent wrongfull combination of estim + correc.
AUTHOR : Johan Mazoyer
Methods
estimate
(testbed[, entrance_EF, ...])Run an estimation from a testbed, with a given input wavefront and a state of the DMs.
- estimate(testbed: Testbed, entrance_EF=1.0, voltage_vector=0.0, perfect_estimation=False, **kwargs)
Run an estimation from a testbed, with a given input wavefront and a state of the DMs.
AUTHOR : Johan Mazoyer
- Parameters:
- testbedOpticalSystem.Testbed
Testbed object which describe your testbed
- entrance_EFcomplex float or 2D array, default 1.
initial EF field
- voltage_vector1D float array
vector of voltages vectors for each DMs
- perfect_estimationbool, default = False
if true This is equivalent to have self.technique = “perfect” but even if we are using another technique, we sometimes need a perfect estimation and it avoid re-initialization of the estimation.
- Returns:
- estimationlist of 2D array
list is the number of wl in the estimation, usually 1 or testbed.nb_wav Each arrays are of size of sixe [dimEstim, dimEstim]. estimation of the Electrical field
- Asterix.wfsc.estimator.find_DM_to_probe(testbed: Testbed)
Find which DM to use for the PW probes.
AUTHOR : Johan Mazoyer
- Parameters:
- testbedOpticalSystem.Testbed
Testbed object which describe your testbed
- Returns:
- name_DM_to_probe_in_PWstring
name of the DM to probe in PW
- Asterix.wfsc.wf_sensing_functions.create_pw_matrix(testbed: Testbed, amplitude, posprobes, dimEstim, cutsvd, matrix_dir, polychrom, wav_vec_estim=None, silence=False, **kwargs)
Build the nbwl times interaction matrix for pair-wise probing.
AUTHOR : Johan Mazoyer
Sept 2022 : created
- Parameters:
- testbedTestbed Optical_element
a testbed with one or more DM
- amplitudefloat
amplitude of the actuator pokes for pair(wise probing in nm
- posprobes1D-array
index of the actuators to push and pull for pair-wise probing
- dimEstimint
size of the output image after resizing in pixels
- cutsvdfloat
value not to exceed for the inverse eigeinvalues at each pixels
- matrix_dirstring
path to directory to save all the matrices here
- polychromstring
For polychromatic estimation and correction: - ‘singlewl’: only a single wavelength is used for estimation / correction. 1 Interation Matrix - ‘broadband_pwprobes’: probes images PW are broadband but Matrices are at central wavelength: 1 PW Matrix and 1 Interation Matrix - ‘multiwl’: nb_wav images are used for estimation and there are nb_wav matrices of estimation and nb_wav matrices for correction
- wav_vec_estimlist of float, default None
list of wavelengths to do the estimation, used in the case of polychrom == ‘multiwl’
- silenceboolean, default False.
Whether to silence print outputs.
- Returns:
- PWVectorlist of 2D array
vector probe to be multiplied by the image difference matrix in order to retrieve the focal plane electric field
- Asterix.wfsc.wf_sensing_functions.create_singlewl_pw_matrix(testbed: Testbed, amplitude, posprobes, dimEstim, cutsvd, matrix_dir, wavelength, silence=False, **kwargs)
Build the interaction matrix for pair-wise probing at 1 WL.
AUTHOR : Axel Potier Modified by Johan Mazoyer
Sept 2022 : .fits file saving directly in the function to clean up estimator
- Parameters:
- testbedTestbed Optical_element
a testbed with one or more DM
- amplitudefloat
amplitude of the actuator pokes for pair(wise probing in nm
- posprobes1D-array
index of the actuators to push and pull for pair-wise probing
- dimEstimint
size of the output image after resizing in pixels
- cutsvdfloat
value not to exceed for the inverse eigeinvalues at each pixels
- matrix_dirstring
path to directory to save all the matrices here
- wavelengthfloat
wavelength in m.
- silenceboolean, default False.
Whether to silence print outputs.
- Returns:
- PWVector2D array
vector probe to be multiplied by the image difference matrix in order to retrieve the focal plane electric field
- Asterix.wfsc.wf_sensing_functions.calculate_pw_estimate(Difference, Vectorprobes, dir_save_all_planes=None, dtype_complex='complex128')
Calculate the focal plane electric field from the probe image differences and the modeled probe matrix.
AUTHOR : Axel Potier
- Parameters:
- Difference3D array
Cube with image difference for each probes.
- Vectorprobes2D array
Model probe matrix for the same probe as for difference.
- dir_save_all_planesstring or None, default None
If not None, absolute directory to save all planes in fits for debugging purposes. This can generate a lot of fits especially if in a loop, use with caution.
- dtype_complexstring, default ‘complex128’
bit number for the complex arrays in the PW matrices. Can be ‘complex128’ or ‘complex64’. The latter increases the speed of the mft but at the cost of lower precision.
- Returns:
- Difference3D array
Cube with image difference for each probes. Used for pair-wise probing.
- Asterix.wfsc.wf_sensing_functions.simulate_pw_difference(input_wavefront, testbed: Testbed, posprobes, dimimages, amplitudePW, voltage_vector=0.0, wavelengths=None, **kwargs)
Simulate the acquisition of probe images using Pair-wise.
and calculate the difference of images [I(+probe) - I(-probe)]. we use testbed.name_DM_to_probe_in_PW to do the probes.
AUTHOR : Axel Potier
- Parameters:
- input_wavefrontcomplex scalar or 2d complex array or 3d complex array, default is 1 (flat WF)
Input wavefront in pupil plane.
- testbedTestbed Optical_element
Testbed with one or more DM.
- posprobes1D-array
Index of the actuators to push and pull for pair-wise probing.
- dimimagesint
Size of the output image after resizing in pixels.
- amplitudePWfloat
PW probes amplitude in nm.
- voltage_vector1D float array or float, default 0
Vector of voltages vectors for each DMs arounf which we do the difference.
- wavelengthsfloat, default None
Wavelength of the estimation in m.
- Returns:
- Difference3D array
Cube with image difference for each probes. Use for pair-wise probing.