43 from typing
import Union
45 from abc
import ABC, abstractmethod
49 """ RTC handler for compass simulation
52 _rtc : (sutraWrap.Rtc) : Sutra rtc instance
54 _context : (carmaContext) : CarmaContext instance
56 _config : (config module) : Parameters configuration structure module
58 brahma : (bool) : BRAHMA features enabled in the RTC
60 fp16 : (bool) : FP16 features enabled in the RTC
62 cacao : (bool) : CACAO features enabled in the RTC
65 def __init__(self, context: carmaWrap_context, config, *, brahma: bool =
False,
66 fp16: bool =
False, cacao: bool =
False):
67 """ Initialize a RtcCompass component for rtc related supervision
70 context : (carmaContext) : CarmaContext instance
72 config : (config module) : Parameters configuration structure module
75 brahma : (bool, optional) : If True, enables BRAHMA features in RTC (Default is False)
76 Requires BRAHMA to be installed
78 fp16 : (bool, optional) : If True, enables FP16 features in RTC (Default is False)
79 Requires CUDA_SM>60 to be installed
81 cacao : (bool) : If True, enables CACAO features in RTC (Default is False)
82 Requires OCTOPUS to be installed
86 self.
cacaocacao = cacao
96 command: np.ndarray) ->
None:
97 """ Add circular buffer of offset values to integrator (will be applied at the end of next iteration)
100 controller_index : (int) : Controller index
102 name : (str) : Buffer name
104 command : (np.ndarray) : perturbation voltage circular buffer
106 if len(command.shape) == 1:
107 self.
_rtc_rtc.d_control[controller_index].set_perturb_voltage(name, command, 1)
108 elif len(command.shape) == 2:
109 self.
_rtc_rtc.d_control[controller_index].set_perturb_voltage(
110 name, command, command.shape[0])
112 raise AttributeError(
"command should be a 1D or 2D array")
114 def get_slopes(self, controller_index: int) -> np.ndarray:
115 """ Return the current slopes vector of the controller_index controller
118 controller_index : (int) : controller index handling the slopes
121 slopes : (np.ndarray) : Current slopes vector containing slopes of all
122 the WFS handled by the specified controller
124 return np.array(self.
_rtc_rtc.d_control[controller_index].d_centroids)
126 def close_loop(self, controller_index: int =
None) ->
None:
127 """ DM receives controller output + pertuVoltage
130 controller_index: (int): controller index.
131 If None (default), apply on all controllers
133 if controller_index
is None:
134 for controller
in self.
_rtc_rtc.d_control:
135 controller.set_open_loop(0)
137 self.
_rtc_rtc.d_control[controller_index].set_open_loop(0)
139 def open_loop(self, controller_index: int =
None, reset=
True) ->
None:
140 """ Integrator computation goes to /dev/null but pertuVoltage still applied
143 controller_index: (int): controller index.
144 If None (default), apply on all controllers
146 reset : (bool) : If True (default), integrator is reset
148 if controller_index
is None:
149 for controller
in self.
_rtc_rtc.d_control:
150 controller.set_open_loop(1, reset)
152 self.
_rtc_rtc.d_control[controller_index].set_open_loop(1, reset)
155 centro_index: int =
None) ->
None:
156 """ Set given ref slopes in centroider
159 ref_slopes : (ndarray) : Reference slopes vectoronly set the reference slop
162 centro_index : (int) : If given, only set the reference slopes vector
163 used by the specified centroider. If None, the reference
164 slopes vector must be a concatenation of all the reference
165 slopes to use for each centroiders handled by the controller
167 if (centro_index
is None):
168 self.
_rtc_rtc.set_centroids_ref(ref_slopes)
170 self.
_rtc_rtc.d_centro[centro_index].set_centroids_ref(ref_slopes)
173 """ Get the currently used reference slopes
176 centro_index : (int) : If given, only get the reference slopes vector
177 used by the specified centroider. If None, the reference
178 slopes vector returned is a concatenation of all the reference
179 slopes used for by centroiders in the RTC
182 ref_slopes : (np.ndarray) : Reference slopes vector
184 ref_slopes = np.empty(0)
185 if (centro_index
is None):
186 for centro
in self.
_rtc_rtc.d_centro:
187 ref_slopes = np.append(ref_slopes, np.array(centro.d_centroids_ref))
190 return np.array(self.
_rtc_rtc.d_centro[centro_index].d_centroids_ref)
192 def set_gain(self, controller_index: int, gain: float) ->
None:
193 """ Set the scalar gain
196 controller_index : (int) : Index of the controller to modify
198 gain : (float) : scalar gain of modal gain to set
203 """ Return the interaction matrix of the controller
206 controller_index: (int): controller index
209 imat : (np.ndarray) : Interaction matrix currently set in the controller
211 return np.array(self.
_rtc_rtc.d_control[controller_index].d_imat)
214 """ Return the command matrix of the controller
217 controller_index: (int): controller index
220 cmat : (np.ndarray) : Command matrix currently used by the controller
222 return np.array(self.
_rtc_rtc.d_control[controller_index].d_cmat)
225 """ Set the command matrix for the controller to use
228 controller_index : (int) : Controller index to modify
230 cmat : (np.ndarray) : command matrix to set
232 self.
_rtc_rtc.d_control[controller_index].set_cmat(cmat)
235 """ Return sum of intensities in subaps. Size nSubaps, same order as slopes
237 raise NotImplementedError(
"Not implemented")
244 """ Load flat field for the given wfs
247 centro_index : (int) : index of the centroider handling the WFS
249 flat : (np.ndarray) : New WFS flat to use
251 self.
_rtc_rtc.d_centro[centro_index].
set_flat(flat, flat.shape[0])
253 def set_dark(self, centro_index: int, dark: np.ndarray):
254 """ Load dark for the given wfs
257 centro_index : (int) : index of the centroider handling the WFS
259 dark : (np.ndarray) : New WFS dark to use
261 self.
_rtc_rtc.d_centro[centro_index].
set_dark(dark, dark.shape[0])
264 """ Compute the slopes handled by a controller, and returns it
267 controller_index : (int) : Controller index that will compute its slopes
270 slopes : (np.ndarray) : Slopes vector
273 return self.
get_slopesget_slopes(controller_index)
276 """ Reset the perturbation voltage of the controller_index controller
277 (i.e. will remove ALL perturbation voltages.)
278 If you want to reset just one, see the function remove_perturbation_voltage()
281 controller_index : (int) : controller index from where to remove the buffer
283 self.
_rtc_rtc.d_control[controller_index].reset_perturb_voltage()
286 """ Remove the perturbation voltage called <name>, from the controller number <controller_index>.
287 If you want to remove all of them, see function reset_perturbation_voltage()
290 controller_index : (int) : controller index from where to remove the buffer
292 name : (str) : Name of the buffer to remove
294 self.
_rtc_rtc.d_control[controller_index].remove_perturb_voltage(name)
297 name: str =
None) -> Union[dict, tuple]:
298 """ Get a perturbation voltage buffer
301 controller_index : (int) : controller index from where to get the buffer
304 name : (str) : Name of the buffer to get. If None, returns all the buffers
307 pertu : (dict or tuple) : If name is None, returns a dictionnary with the buffers names as keys
308 and a tuple (buffer, circular_counter, is_enabled)
310 pertu_map = self.
_rtc_rtc.d_control[controller_index].d_perturb_map
312 for key
in pertu_map.keys():
313 pertu_map[key] = (np.array(pertu_map[key][0]), pertu_map[key][1],
317 pertu = pertu_map[name]
318 pertu = (np.array(pertu[0]), pertu[1], pertu[2])
321 def get_err(self, controller_index: int) -> np.ndarray:
322 """ Get integrator increment from controller_index controller
325 controller_index : (int) : controller index
327 return np.array(self.
_rtc_rtc.d_control[controller_index].d_err)
329 def get_voltages(self, controller_index: int) -> np.ndarray:
330 """ Get voltages vector (i.e. vector sent to the DM) from controller_index controller
333 controller_index : (int) : controller index
336 voltages : (np.ndarray) : current voltages vector
339 return np.array(self.
_rtc_rtc.d_control[controller_index].d_voltage)
342 """ Set the command law to integrator (controller generic only)
343 v[k] = v[k-1] + g.R.s[k]
346 controller_index: (int): controller index
348 self.
_rtc_rtc.d_control[controller_index].set_commandlaw(
"integrator")
351 """ Set the command law to 2matrices (controller generic only)
352 v[k] = decayFactor.E.v[k-1] + g.R.s[k]
355 controller_index: (int): controller index
357 self.
_rtc_rtc.d_control[controller_index].set_commandlaw(
"2matrices")
360 """ Set the command law to 2matrices (controller generic only)
361 v[k] = v[k-1] + E.g.R.s[k]
364 controller_index: (int): controller index
366 self.
_rtc_rtc.d_control[controller_index].set_commandlaw(
"modal_integrator")
368 def set_decay_factor(self, controller_index: int, decay: np.ndarray) ->
None:
369 """ Set the decay factor used in 2matrices command law (controller generic only)
372 controller_index: (int): controller index
374 decay : (np.ndarray) : decay factor vector
376 self.
_rtc_rtc.d_control[controller_index].set_decayFactor(decay)
378 def set_E_matrix(self, controller_index: int, e_matrix: np.ndarray) ->
None:
379 """ Set the E matrix used in 2matrices or modal command law (controller generic only)
382 e_matrix : (np.ndarray) : E matrix to set
384 controller_index: (int): controller index
386 self.
_rtc_rtc.d_control[controller_index].set_matE(e_matrix)
388 def _get_x_buffer(self, controller_index: int) -> list:
389 """ Get the buffer of state vectors (controller generic linear only)
392 controller_index: (int): controller index
394 return [np.array(x)
for x
in self.
_rtc_rtc.d_control[controller_index].d_circular_x]
396 def _get_s_buffer(self, controller_index: int) -> list:
397 """ Get the buffer of slope vectors (controller generic linear only)
400 controller_index: (int): controller index
402 return [np.array(x)
for x
in self.
_rtc_rtc.d_control[controller_index].d_circular_s]
404 def _get_u_in_buffer(self, controller_index: int) -> list:
405 """ Get the buffer of iir input vectors (controller generic linear only)
408 controller_index: (int): controller index
410 return [np.array(x)
for x
in self.
_rtc_rtc.d_control[controller_index].d_circular_u_in]
412 def _get_u_out_buffer(self, controller_index: int) -> list:
413 """ Get the buffer of iir output vectors (controller generic linear only)
416 controller_index: (int): controller index
418 return [np.array(x)
for x
in self.
_rtc_rtc.d_control[controller_index].d_circular_u_out]
420 def _get_A_matrix(self, controller_index: int, matrix_index: int) -> np.ndarray:
421 """ Get a particular A matrix from the list of A matrices (controller generic linear only)
424 controller_index: (int): controller index
426 matrix_index: (int): matrix index
428 return np.array(self.
_rtc_rtc.d_control[controller_index].d_matA[matrix_index])
430 def _get_L_matrix(self, controller_index: int, matrix_index: int) -> np.ndarray:
431 """ Get a particular L matrix from the list of L matrices (controller generic linear only)
434 controller_index: (int): controller index
436 matrix_index: (int): matrix index
438 return np.array(self.
_rtc_rtc.d_control[controller_index].d_matL[matrix_index])
440 def _get_K_matrix(self, controller_index: int) -> np.ndarray:
441 """ Get the K matrix (controller generic linear only)
444 controller_index: (int): controller index
446 return np.array(self.
_rtc_rtc.d_control[controller_index].d_matK)
448 def _get_D_matrix(self, controller_index: int) -> np.ndarray:
449 """ Get the D matrix (controller generic linear only)
452 controller_index: (int): controller index
454 return np.array(self.
_rtc_rtc.d_control[controller_index].d_matD)
456 def _get_F_matrix(self, controller_index: int) -> np.ndarray:
457 """ Get the F matrix (controller generic linear only)
460 controller_index: (int): controller index
462 return np.array(self.
_rtc_rtc.d_control[controller_index].d_matF)
464 def _get_iir_a_vector(self, controller_index: int, vector_index: int) -> np.ndarray:
465 """ Get a particular iir "a" vector (outputs) (controller generic linear only)
468 controller_index: (int): controller index
470 vector_index: (int): vector index
472 return np.array(self.
_rtc_rtc.d_control[controller_index].d_iir_a[vector_index])
474 def _get_iir_b_vector(self, controller_index: int, vector_index: int) -> np.ndarray:
475 """ Get a particular iir "b" vector (inputs) (controller generic linear only)
478 controller_index: (int): controller index
480 vector_index: (int): vector index
482 return np.array(self.
_rtc_rtc.d_control[controller_index].d_iir_b[vector_index])
484 def set_A_matrix(self, controller_index: int, matrix_index: int,
485 a_matrix: np.ndarray) ->
None:
486 """ Set a particular A matrix (controller generic linear only)
489 controller_index: (int): controller index
491 matrix_index : (int) : matrix index
493 a_matrix : (np.ndarray) : A matrix to set
495 self.
_rtc_rtc.d_control[controller_index].set_matA(a_matrix, matrix_index)
497 def set_L_matrix(self, controller_index: int, matrix_index: int,
498 l_matrix: np.ndarray) ->
None:
499 """ Set a particular L matrix (controller generic linear only)
502 controller_index: (int): controller index
504 matrix_index : (int) : matrix index
506 l_matrix : (np.ndarray) : L matrix to set
508 self.
_rtc_rtc.d_control[controller_index].set_matL(l_matrix, matrix_index)
510 def set_K_matrix(self, controller_index: int, k_matrix: np.ndarray) ->
None:
511 """ Set the K matrix (controller generic linear only)
514 controller_index: (int): controller index
516 k_matrix : (np.ndarray) : K matrix to set
518 self.
_rtc_rtc.d_control[controller_index].set_matK(k_matrix)
520 def set_D_matrix(self, controller_index: int, d_matrix: np.ndarray) ->
None:
521 """ Set the D matrix (controller generic linear only)
524 controller_index: (int): controller index
526 d_matrix : (np.ndarray) : D matrix to set
528 self.
_rtc_rtc.d_control[controller_index].set_matD(d_matrix)
530 def set_F_matrix(self, controller_index: int, f_matrix: np.ndarray) ->
None:
531 """ Set the K matrix (controller generic linear only)
534 controller_index: (int): controller index
536 f_matrix : (np.ndarray) : F matrix to set
538 self.
_rtc_rtc.d_control[controller_index].set_matF(f_matrix)
541 iir_a_vector: np.ndarray) ->
None:
542 """ Set a particular iir "a" vector (outputs) (controller generic linear only)
545 controller_index: (int): controller index
547 vector_index: (int): vector index
549 iir_a_vector : (np.ndarray) : iir "a" vector to set
551 self.
_rtc_rtc.d_control[controller_index].set_iir_a(iir_a_vector, vector_index)
554 iir_b_vector: np.ndarray) ->
None:
555 """ Set a particular iir "b" vector (outputs) (controller generic linear only)
558 controller_index: (int): controller index
560 vector_index: (int): vector index
562 iir_b_vector : (np.ndarray) : iir "b" vector to set
564 self.
_rtc_rtc.d_control[controller_index].set_iir_b(iir_b_vector, vector_index)
567 """ Reset the reference slopes of each WFS handled by the specified controller
570 controller_index: (int): controller index
572 for centro
in self.
_rtc_rtc.d_centro:
573 centro.d_centroids_ref.reset()
576 """ Set the threshold value of a thresholded COG
579 centro_index: (int): centroider index
581 thresh: (float): new threshold value
583 self.
_rtc_rtc.d_centro[centro_index].set_threshold(thresh)
586 """ Get pyramid compute method currently used
589 centro_index: (int): centroider index
592 method : (str) : Pyramid compute method currently used
594 return self.
_rtc_rtc.d_centro[centro_index].pyr_method
596 def set_pyr_method(self, centro_index: int, pyr_method: int) ->
None:
597 """ Set the pyramid method for slopes computation
600 centro_index : (int) : centroider index
602 pyr_method : (int) : new centroiding method (0: nosinus global
610 print(
"PYR method set to " + self.
_rtc_rtc.d_centro[centro_index].pyr_method)
612 def set_modal_gains(self, controller_index: int, mgain: np.ndarray) ->
None:
613 """ Sets the modal gain (when using modal integrator command law)
616 controller_index : (int) : Controller index to modify
618 mgain : (np.ndarray) : Modal gains to set
623 """ Returns the modal gains (when using modal integrator command law)
626 controller_index : (int) : Controller index to modify
629 mgain : (np.ndarray) : Modal gains vector currently used
631 return np.array(self.
_rtc_rtc.d_control[controller_index].d_gain)
634 """ Return the mask of valid pixels used by a maskedpix centroider
637 centro_index : (int): Centroider index. Must be a maskedpix centroider
640 mask : (np.ndarray) : Mask used
642 if (self.
_rtc_rtc.d_centro[centro_index].type != scons.CentroiderType.MASKEDPIX):
643 raise TypeError(
"Centroider must be a maskedpix one")
645 return np.array(self.
_rtc_rtc.d_centro[centro_index].d_mask)
647 def get_command(self, controller_index: int) -> np.ndarray:
648 """ Returns the last computed command before conversion to voltages
651 controller_index : (int) : Controller index
654 com : (np.ndarray) : Command vector
656 return np.array(self.
_rtc_rtc.d_control[controller_index].d_com)
658 def set_command(self, controller_index: int, com: np.ndarray) -> np.ndarray:
659 """ Returns the last computed command before conversion to voltages
662 controller_index : (int) : Controller index
664 com : (np.ndarray) : Command vector to set
666 if (com.size != self.
_config_config.p_controllers[controller_index].nactu):
667 raise ValueError(
"Dimension mismatch")
668 self.
_rtc_rtc.d_control[controller_index].set_com(com, com.size)
670 def reset_command(self, controller_index: int =
None) ->
None:
671 """ Reset the controller_index Controller command buffer, reset all controllers if controller_index is None
674 controller_index : (int) : Controller index
675 Default is None, i.e. all controllers are reset
677 if (controller_index
is None):
678 for control
in self.
_rtc_rtc.d_control:
679 control.d_com.reset()
681 self.
_rtc_rtc.d_control[controller_index].d_com.reset()
683 def get_slopes_geom(self, controller_index: int, geom_type: int = 0) -> np.ndarray:
684 """ Computes and return the slopes geom from the specified controller
687 controller_index : (int) : controller index
689 geom_type : (int) : geom centroiding method, default = 0, others (1,2) are experimental
691 slopes_geom : (np.ndarray) : geometrically computed slopes
694 slopes_geom = np.array(self.
_rtc_rtc.d_control[controller_index].d_centroids)
699 """ Return the pyramid image with only the selected pixels used by the full pixels centroider
702 selected_pix : (np.ndarray) : PWFS image with only selected pixels
704 if (self.
_config_config.p_centroiders[0].type != scons.CentroiderType.MASKEDPIX):
705 raise TypeError(
"Centroider must be maskedPix")
707 carma_centroids = self.
_rtc_rtc.d_control[0].d_centroids
708 self.
_rtc_rtc.d_centro[0].fill_selected_pix(carma_centroids)
710 return np.array(self.
_rtc_rtc.d_centro[0].d_selected_pix)
713 """ Computes and set a new reference slopes for each WFS handled by
714 the specified controller
717 controller_index: (int): controller index
719 print(
"Doing reference slopes...")
720 self.
_rtc_rtc.do_centroids_ref(controller_index)
721 print(
"Reference slopes done")
723 def do_control(self, controller_index: int, *, sources: SourceCompass =
None,
724 source_index: int = 0, is_wfs_phase: bool =
False) ->
None:
725 """Computes the command from the Wfs slopes
728 controller_index: (int): controller index
731 sources : (SourceCompass) : List of phase screens of a wfs or target sutra object
732 If the controller is a GEO one, specify a SourceCompass instance
733 from WfsCompass or TargetCompass to project the corresponding phase
735 source_index : (int) : Index of the phase screen to consider inside <sources>. Default is 0
737 is_wfs_phase : (bool) : If True, sources[source_index] is a WFS phase screen.
738 Else, it is a Target phase screen (Default)
740 if (self.
_rtc_rtc.d_control[controller_index].type == scons.ControllerType.GEO):
741 if (sources
is not None):
742 self.
_rtc_rtc.d_control[controller_index].comp_dphi(
743 sources[source_index], is_wfs_phase)
747 """ Computes the calibrated image from the Wfs image
750 controller_index: (int): controller index
755 """ Computes the centroids from the Wfs image
758 controller_index: (int): controller index
762 def do_centroids_geom(self, controller_index: int, *, geom_type: int = 0) ->
None:
763 """ Computes the centroids geom from the Wfs image
766 controller_index: (int): controller index
768 geom_type : (int) : geom centroiding method, default = 0, others (1,2) are experimental
772 def apply_control(self, controller_index: int, *, comp_voltage: bool =
True) ->
None:
773 """ Computes the final voltage vector to apply on the DM by taking into account delay and perturbation voltages, and shape the DMs
776 controller_index: (int): controller index
779 comp_voltage: (bool): If True (default), computes the voltage vector from the command one (delay + perturb). Else, directly applies the current voltage vector
784 """ Clip the commands between vmin and vmax values set in the RTC
787 controller_index: (int): controller index
791 def set_scale(self, centroider_index: int, scale: float) ->
None:
792 """ Update the scale factor of the centroider
795 centroider_index : (int) : Index of the centroider to update
797 scale : (float) : scale factor to apply on slopes
802 """ Publish loop data on DDS topics
804 only with cacao enabled, requires OCTOPUS
809 raise AttributeError(
"CACAO must be enabled")
811 def get_image_raw(self, centroider_index: int) -> np.ndarray:
812 """ Return the raw image currently loaded on the specified centroider
815 centroider_index : (int) : Index of the centroider
818 image_raw : (np.ndarray) : Raw WFS image loaded in the centroider
820 return np.array(self.
_rtc_rtc.d_centro[centroider_index].d_img_raw)
823 """ Return the last image calibrated by the specified centroider
826 centroider_index : (int) : Index of the centroider
829 image_cal : (np.ndarray) : Calibrated WFS image loaded in the centroider
831 img = np.array(self.
_rtc_rtc.d_centro[centroider_index].d_img)
832 if self.
_config_config.p_centroiders[
833 centroider_index].type == scons.CentroiderType.MASKEDPIX:
RTC handler for compass simulation.
None set_command_matrix(self, int controller_index, np.ndarray cmat)
Set the command matrix for the controller to use.
brahma
(bool) : BRAHMA features enabled in the RTC
np.ndarray get_err(self, int controller_index)
Get integrator increment from controller_index controller.
None do_ref_slopes(self, int controller_index)
Computes and set a new reference slopes for each WFS handled by the specified controller.
None set_E_matrix(self, int controller_index, np.ndarray e_matrix)
Set the E matrix used in 2matrices or modal command law (controller generic only)
None set_D_matrix(self, int controller_index, np.ndarray d_matrix)
Set the D matrix (controller generic linear only)
None do_clipping(self, int controller_index)
Clip the commands between vmin and vmax values set in the RTC.
None do_centroids_geom(self, int controller_index, *int geom_type=0)
Computes the centroids geom from the Wfs image.
def set_dark(self, int centro_index, np.ndarray dark)
Load dark for the given wfs.
None set_integrator_law(self, int controller_index)
Set the command law to integrator (controller generic only)
None remove_perturbation_voltage(self, int controller_index, str name)
Remove the perturbation voltage called <name>, from the controller number <controller_index>.
def set_flat(self, int centro_index, np.ndarray flat)
Load flat field for the given wfs.
None reset_ref_slopes(self, int controller_index)
Reset the reference slopes of each WFS handled by the specified controller.
None set_2matrices_law(self, int controller_index)
Set the command law to 2matrices (controller generic only)
np.ndarray get_voltages(self, int controller_index)
Get voltages vector (i.e.
def get_interaction_matrix(self, int controller_index)
Return the interaction matrix of the controller.
None close_loop(self, int controller_index=None)
DM receives controller output + pertuVoltage.
None publish(self)
Publish loop data on DDS topics.
None set_ref_slopes(self, np.ndarray ref_slopes, *int centro_index=None)
Set given ref slopes in centroider.
None do_control(self, int controller_index, *SourceCompass sources=None, int source_index=0, bool is_wfs_phase=False)
Computes the command from the Wfs slopes.
None set_gain(self, int controller_index, float gain)
Set the scalar gain.
def compute_slopes(self, int controller_index)
Compute the slopes handled by a controller, and returns it.
cacao
(bool) : CACAO features enabled in the RTC
None do_calibrate_img(self, int controller_index)
Computes the calibrated image from the Wfs image.
None set_F_matrix(self, int controller_index, np.ndarray f_matrix)
Set the K matrix (controller generic linear only)
None set_iir_b_vector(self, int controller_index, int vector_index, np.ndarray iir_b_vector)
Set a particular iir "b" vector (outputs) (controller generic linear only)
np.ndarray get_slopes_geom(self, int controller_index, int geom_type=0)
Computes and return the slopes geom from the specified controller.
str get_pyr_method(self, int centro_index)
Get pyramid compute method currently used.
None set_centroider_threshold(self, int centro_index, float thresh)
Set the threshold value of a thresholded COG.
None open_loop(self, int controller_index=None, reset=True)
Integrator computation goes to /dev/null but pertuVoltage still applied.
None set_iir_a_vector(self, int controller_index, int vector_index, np.ndarray iir_a_vector)
Set a particular iir "a" vector (outputs) (controller generic linear only)
np.ndarray get_modal_gains(self, int controller_index)
Returns the modal gains (when using modal integrator command law)
np.ndarray get_ref_slopes(self, centro_index=None)
Get the currently used reference slopes.
np.ndarray get_image_raw(self, int centroider_index)
Return the raw image currently loaded on the specified centroider.
np.ndarray get_image_calibrated(self, int centroider_index)
Return the last image calibrated by the specified centroider.
np.ndarray get_masked_pix(self, int centro_index)
Return the mask of valid pixels used by a maskedpix centroider.
None set_modal_integrator_law(self, int controller_index)
Set the command law to 2matrices (controller generic only)
np.ndarray get_intensities(self)
Return sum of intensities in subaps.
None set_modal_gains(self, int controller_index, np.ndarray mgain)
Sets the modal gain (when using modal integrator command law)
Union[dict, tuple] get_perturbation_voltage(self, int controller_index, *str name=None)
Get a perturbation voltage buffer.
np.ndarray get_slopes(self, int controller_index)
Return the current slopes vector of the controller_index controller.
np.ndarray set_command(self, int controller_index, np.ndarray com)
Returns the last computed command before conversion to voltages.
None set_L_matrix(self, int controller_index, int matrix_index, np.ndarray l_matrix)
Set a particular L matrix (controller generic linear only)
None set_pyr_method(self, int centro_index, int pyr_method)
Set the pyramid method for slopes computation.
None do_centroids(self, int controller_index)
Computes the centroids from the Wfs image.
np.ndarray get_command(self, int controller_index)
Returns the last computed command before conversion to voltages.
np.ndarray get_selected_pix(self)
Return the pyramid image with only the selected pixels used by the full pixels centroider.
None set_K_matrix(self, int controller_index, np.ndarray k_matrix)
Set the K matrix (controller generic linear only)
None apply_control(self, int controller_index, *bool comp_voltage=True)
Computes the final voltage vector to apply on the DM by taking into account delay and perturbation vo...
def get_command_matrix(self, int controller_index)
Return the command matrix of the controller.
None reset_command(self, int controller_index=None)
Reset the controller_index Controller command buffer, reset all controllers if controller_index is No...
None reset_perturbation_voltage(self, int controller_index)
Reset the perturbation voltage of the controller_index controller (i.e.
None set_perturbation_voltage(self, int controller_index, str name, np.ndarray command)
Add circular buffer of offset values to integrator (will be applied at the end of next iteration)
None set_scale(self, int centroider_index, float scale)
Update the scale factor of the centroider.
None set_A_matrix(self, int controller_index, int matrix_index, np.ndarray a_matrix)
Set a particular A matrix (controller generic linear only)
None set_decay_factor(self, int controller_index, np.ndarray decay)
Set the decay factor used in 2matrices command law (controller generic only)
fp16
(bool) : FP16 features enabled in the RTC
def __init__(self, carmaWrap_context context, config, *bool brahma=False, bool fp16=False, bool cacao=False)
Initialize a RtcCompass component for rtc related supervision.
Numerical constants for shesha and config enumerations for safe-typing.
int fill_mask(float *d_odata, float *d_idata, int N, int norm, CarmaDevice *device)