8 config = load_config_from_file(os.getenv(
"COMPASS_ROOT") +
"/shesha/tests/pytest/par/test_pyrhr.py")
9 config.p_controllers[0].set_type(
"generic")
19 assert(sup.iter == 101)
30 sup.atmos.enable_atmos(
False)
31 assert(sup.atmos.is_enable ==
False)
34 sup.atmos.set_r0(0.15)
35 assert(sup.config.p_atmos.r0 == 0.15)
38 sup.atmos.set_wind(0,windspeed=10, winddir=45)
42 sup.atmos.reset_turbu()
46 sup.atmos.get_atmos_layer(0)
50 sup.atmos.move_atmos()
58 sup.dms.set_command(np.zeros(sup.config.p_controllers[0].nactu))
62 sup.dms.set_one_actu(0, 0, ampli=1)
66 sup.dms.get_influ_function(0)
70 sup.dms.get_influ_function_ipupil_coords(0)
78 sup.dms.get_dm_shape(0)
82 sup.dms.set_dm_registration(0, dx=0, dy=0, theta=0, G=1)
90 sup.target.get_tar_image(0)
91 sup.target.get_tar_image(0, expo_type=
"le")
95 sup.target.get_tar_phase(0)
96 sup.target.get_tar_phase(0, pupil=
True)
100 sup.target.set_tar_phase(0, sup.target.get_tar_phase(0))
104 sup.target.reset_strehl(0)
108 sup.target.reset_tar_phase(0)
112 sup.target.get_ncpa_tar(0)
116 sup.target.set_ncpa_tar(0, sup.target.get_ncpa_tar(0))
120 sup.target.comp_tar_image(0)
121 sup.target.comp_tar_image(0, puponly=1, compLE=
False)
125 sup.target.comp_strehl(0)
126 sup.target.comp_strehl(0, do_fit=
False)
130 sup.target.get_strehl(0)
131 sup.target.get_strehl(0, do_fit=
False)
139 sup.wfs.get_wfs_image(0)
143 sup.wfs.set_noise(0,-1)
144 sup.wfs.set_noise(0,1,seed=1235)
148 sup.wfs.set_gs_mag(0, 5)
152 sup.wfs.compute_wfs_image(0)
153 sup.wfs.compute_wfs_image(0, noise=
False)
157 sup.wfs.reset_noise()
161 sup.wfs.get_wfs_phase(0)
165 sup.wfs.set_ncpa_wfs(0, sup.wfs.get_wfs_phase(0) * 0.)
169 sup.wfs.get_ncpa_wfs(0)
173 sup.wfs.set_wfs_phase(0, sup.wfs.get_wfs_phase(0))
177 sup.wfs.set_wfs_pupil(0, sup.config.p_geom._mpupil)
180 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
182 sup.wfs.set_pyr_modulation_points(0, sup.config.p_wfss[0]._pyr_cx, sup.config.p_wfss[0]._pyr_cy)
185 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
187 _ = sup.wfs.set_pyr_modulation_ampli(0,3)
190 @pytest.mark.skip(reason=
"How does it work ?")
195 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
197 sup.wfs.set_pyr_disk_source_hexa(0, 1)
200 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
202 sup.wfs.set_pyr_disk_source(0,3)
205 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
207 sup.wfs.set_pyr_square_source(0, 3)
210 @pytest.mark.skip(reason=
"How does it work ?")
214 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
216 sup.wfs.set_fourier_mask(0, sup.config.p_wfss[0].get_halfxy())
219 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
221 sup.wfs.get_pyrhr_image(0)
224 @pytest.mark.skipif(sup.config.p_wfss[0].type !=
"pyrhr", reason=
"pyrhr only")
226 sup.wfs.get_pyr_focal_plane(0)
234 sup.rtc.set_perturbation_voltage(0,
"test",np.zeros(sup.config.p_controllers[0].nactu))
238 sup.rtc.get_slopes(0)
250 sup.rtc.set_ref_slopes(np.zeros(sup.config.p_controllers[0].nslope))
254 sup.rtc.get_ref_slopes()
258 sup.rtc.set_gain(0, 0.2)
262 sup.rtc.get_interaction_matrix(0)
266 sup.rtc.get_command_matrix(0)
270 sup.rtc.set_command_matrix(0, sup.rtc.get_command_matrix(0))
273 @pytest.mark.skip(reason=
"not implemented")
275 sup.rtc.get_intensities()
279 sup.rtc.set_flat(0, sup.wfs.get_wfs_image(0) * 0 + 1.)
283 sup.rtc.set_dark(0,sup.wfs.get_wfs_image(0) * 0)
287 sup.rtc.compute_slopes(0)
291 sup.rtc.reset_perturbation_voltage(0)
295 sup.rtc.set_perturbation_voltage(0,
"test", np.zeros(sup.config.p_controllers[0].nactu))
298 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"ls", reason=
"LS only")
304 sup.rtc.get_voltages(0)
307 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
309 sup.rtc.set_integrator_law(0)
312 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
314 sup.rtc.set_2matrices_law(0)
317 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
319 sup.rtc.set_modal_integrator_law(0)
322 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
324 sup.rtc.set_decay_factor(0, np.ones(sup.config.p_controllers[0].nactu))
327 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
329 sup.rtc.set_E_matrix(0, np.identity(sup.config.p_controllers[0].nactu))
333 sup.rtc.reset_ref_slopes(0)
336 @pytest.mark.skipif(sup.config.p_centroiders[0].type !=
"tcog", reason=
"tcog only")
338 sup.rtc.set_centroider_threshold(0, 10)
341 @pytest.mark.skipif(sup.config.p_centroiders[0].type !=
"pyr", reason=
"pyr only")
343 sup.rtc.get_pyr_method(0)
346 @pytest.mark.skipif(sup.config.p_centroiders[0].type !=
"pyr", reason=
"pyr only")
348 sup.rtc.set_pyr_method(0, 0)
349 sup.rtc.set_pyr_method(0, 1)
350 sup.rtc.set_pyr_method(0, 2)
351 sup.rtc.set_pyr_method(0, 3)
354 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
356 sup.rtc.set_modal_gains(0, np.ones(sup.config.p_controllers[0].nactu))
359 @pytest.mark.skipif(sup.config.p_controllers[0].type !=
"generic", reason=
"Generic only")
361 sup.rtc.get_modal_gains
364 @pytest.mark.skipif(sup.config.p_centroiders[0].type !=
"maskedpix", reason=
"maskedpix only")
366 sup.rtc.get_masked_pix(0)
370 sup.rtc.get_command(0)
374 sup.rtc.set_command(0, np.zeros(sup.config.p_controllers[0].nactu))
378 sup.rtc.reset_command()
382 sup.rtc.get_slopes_geom(0)
385 @pytest.mark.skipif(sup.config.p_centroiders[0].type !=
"maskedpix", reason=
"maskedpix only")
387 sup.rtc.get_selected_pix()
391 sup.rtc.do_ref_slopes(0)
395 sup.rtc.do_control(0)
399 sup.rtc.do_calibrate_img(0)
403 sup.rtc.do_centroids(0)
407 sup.rtc.do_centroids_geom(0)
411 sup.rtc.apply_control(0)
415 sup.rtc.do_clipping(0)
419 sup.rtc.set_scale(0, 1)
422 @pytest.mark.skipif(sup.cacao
is False, reason=
"cacao only")
432 sup.basis.compute_influ_basis(0)
436 _ = sup.basis.compute_modes_to_volts_basis(
"KL2V")
437 _ = sup.basis.compute_modes_to_volts_basis(
"Btt")
441 sup.basis.compute_btt_basis()
444 @pytest.mark.skipif(sup.config.p_tel.type_ap ==
"EELT", reason=
"EELT pupil only")
446 sup.basis.compute_merged_influ(0)
449 @pytest.mark.skipif(
"petal" not in [dm.influ_type
for dm
in sup.config.p_dms], reason=
"Petal dm only")
451 sup.basis.compute_btt_petal()
455 sup.basis.compute_phase_to_modes(sup.basis.projection_matrix)
463 sup.calibration.apply_volts_and_get_slopes(0)
464 sup.calibration.apply_volts_and_get_slopes(0, noise=
True, turbu=
True, reset=
False)
468 sup.calibration.do_imat_modal(0, np.ones(sup.basis.modal_basis.shape[0]), sup.basis.modal_basis)
472 sup.calibration.do_imat_phase(0, np.zeros((5, sup.wfs.get_ncpa_wfs(0).shape[0], sup.wfs.get_ncpa_wfs(0).shape[0])))
476 sup.calibration.compute_modal_residuals(sup.basis.projection_matrix)