COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
rtcCompass.py
1 
37 from shesha.init.rtc_init import rtc_init
38 from shesha.supervisor.components.sourceCompass import SourceCompass
39 import shesha.constants as scons
40 import numpy as np
41 
42 class RtcCompass(object):
43  """ RTC handler for compass simulation
44 
45  Attributes:
46  rtc : (sutraWrap.Rtc) : Sutra rtc instance
47 
48  context : (carmaContext) : CarmaContext instance
49 
50  config : (config module) : Parameters configuration structure module
51 
52  cacao : (bool) : CACAO features enabled in the RTC
53  """
54  def __init__(self, context, config, tel, wfs, dms, atm, *, cacao=False):
55  """ Initialize a RtcCompass component for rtc related supervision
56 
57  Parameters:
58  context : (carmaContext) : CarmaContext instance
59 
60  config : (config module) : Parameters configuration structure module
61 
62  tel : (TelescopeCompass) : A TelescopeCompass instance
63 
64  wfs : (WfsCompass) : A WfsCompass instance
65 
66  dms : (DmCompass) : A DmCompass instance
67 
68  atm : (AtmosCompass) : An AtmosCompass instance
69 
70  cacao : (bool, optional) : If True, enables CACAO features in RTC (Default is False)
71  /!\ Requires OCTOPUS to be installed
72  """
73  self.context = context
74  self.config = config # Parameters configuration coming from supervisor init
75  self.cacao = cacao
76  print("->rtc init")
77  self.rtc = rtc_init(self.context, tel.tel, wfs.wfs, dms.dms, atm.atmos,
78  self.config.p_wfss, self.config.p_tel,
79  self.config.p_geom, self.config.p_atmos, self.config.p_loop.ittime,
80  self.config.p_centroiders, self.config.p_controllers,
81  self.config.p_dms, cacao=cacao)
82 
83  def set_perturbation_voltage(self, controller_index: int, name: str,
84  command: np.ndarray) -> None:
85  """ Add circular buffer of offset values to integrator (will be applied at the end of next iteration)
86 
87  Parameters:
88  controller_index : (int) : Controller index
89 
90  name : (str) : Buffer name
91 
92  command : (np.ndarray) : perturbation voltage circular buffer
93  """
94  if len(command.shape) == 1:
95  self.rtc.d_control[controller_index].set_perturb_voltage(name, command, 1)
96  elif len(command.shape) == 2:
97  self.rtc.d_control[controller_index].set_perturb_voltage(
98  name, command, command.shape[0])
99  else:
100  raise AttributeError("command should be a 1D or 2D array")
101 
102  def get_slopes(self, controller_index: int) -> np.ndarray:
103  """ Return the current slopes vector of the controller_index controller
104 
105  Parameters:
106  controller_index : (int) : controller index handling the slopes
107 
108  Return:
109  slopes : (np.ndarray) : Current slopes vector containing slopes of all
110  the WFS handled by the specified controller
111  """
112  return np.array(self.rtc.d_control[controller_index].d_centroids)
113 
114  def close_loop(self, controller_index: int=None) -> None:
115  """ DM receives controller output + pertuVoltage
116 
117  Parameters:
118  controller_index: (int, optional): controller index.
119  If None (default), apply on all controllers
120  """
121  if controller_index is None:
122  for controller in self.rtc.d_control:
123  controller.set_open_loop(0)
124  else:
125  self.rtc.d_control[controller_index].set_open_loop(0) # close_loop
126 
127  def open_loop(self, controller_index: int=None, reset=True) -> None:
128  """ Integrator computation goes to /dev/null but pertuVoltage still applied
129 
130  Parameters:
131  controller_index: (int): controller index.
132  If None (default), apply on all controllers
133 
134  reset : (bool, optional) : If True (default), integrator is reset
135  """
136  if controller_index is None:
137  for controller in self.rtc.d_control:
138  controller.set_open_loop(1, reset)
139  else:
140  self.rtc.d_control[controller_index].set_open_loop(1, reset) # open_loop
141 
142  def set_ref_slopes(self, ref_slopes: np.ndarray, *, centro_index=None) -> None:
143  """ Set given ref slopes in centroider
144 
145  Parameters:
146  ref_slopes : (ndarray) : Reference slopes vectoronly set the reference slop
147 
148  centro_index : (int, optionnal) : If given, only set the reference slopes vector
149  used by the specified centroider. If None, the reference
150  slopes vector must be a concatenation of all the reference
151  slopes to use for each centroiders handled by the controller
152  """
153  if (centro_index is None):
154  self.rtc.set_centroids_ref(ref_slopes)
155  else:
156  self.rtc.d_centro[centro_index].set_centroids_ref(ref_slopes)
157 
158  def get_ref_slopes(self, centro_index=None) -> np.ndarray:
159  """ Get the currently used reference slopes
160 
161  Parameters:
162  centro_index : (int, optionnal) : If given, only get the reference slopes vector
163  used by the specified centroider. If None, the reference
164  slopes vector returned is a concatenation of all the reference
165  slopes used for by centroiders in the RTC
166 
167  Return:
168  ref_slopes : (np.ndarray) : Reference slopes vector
169  """
170  ref_slopes = np.empty(0)
171  if (centro_index is None):
172  for centro in self.rtc.d_centro:
173  ref_slopes = np.append(ref_slopes, np.array(centro.d_centroids_ref))
174  return ref_slopes
175  else:
176  return np.array(self.rtc.d_centro[centro_index].d_centroids_ref)
177 
178  def set_gain(self, controller_index: int, gain: float) -> None:
179  """ Set the scalar gain
180 
181  Parameters:
182  controller_index : (int) : Index of the controller to modify
183 
184  gain : (float) : scalar gain of modal gain to set
185  """
186  self.rtc.d_control[controller_index].set_gain(gain)
187 
188  def get_interaction_matrix(self, controller_index: int):
189  """ Return the interaction matrix of the controller
190 
191  Parameters :
192  controller_index: (int): controller index
193 
194  Return:
195  imat : (np.ndarray) : Interaction matrix currently set in the controller
196  """
197  return np.array(self.rtc.d_control[controller_index].d_imat)
198 
199  def get_command_matrix(self, controller_index: int):
200  """ Return the command matrix of the controller
201 
202  Parameters:
203  controller_index: (int): controller index
204 
205  Return:
206  cmat : (np.ndarray) : Command matrix currently used by the controller
207  """
208  return np.array(self.rtc.d_control[controller_index].d_cmat)
209 
210  def set_command_matrix(self, controller_index: int, cmat: np.ndarray) -> None:
211  """ Set the command matrix for the controller to use
212 
213  Parameters:
214  controller_index : (int) : Controller index to modify
215 
216  cmat : (np.ndarray) : command matrix to set
217  """
218  self.rtc.d_control[controller_index].set_cmat(cmat)
219 
220  def get_intensities(self) -> np.ndarray:
221  """ Return sum of intensities in subaps. Size nSubaps, same order as slopes
222  """
223  raise NotImplementedError("Not implemented")
224 
225  def set_flat(self, centro_index: int, flat: np.ndarray,):
226  """ Load flat field for the given wfs
227 
228  Parameters:
229  centro_index : (int) : index of the centroider handling the WFS
230 
231  flat : (np.ndarray) : New WFS flat to use
232  """
233  self.rtc.d_centro[centro_index].set_flat(flat, flat.shape[0])
234 
235  def set_dark(self, centro_index: int, dark: np.ndarray):
236  """ Load dark for the given wfs
237 
238  Parameters:
239  centro_index : (int) : index of the centroider handling the WFS
240 
241  dark : (np.ndarray) : New WFS dark to use
242  """
243  self.rtc.d_centro[centro_index].set_dark(dark, dark.shape[0])
244 
245  def compute_slopes(self, controller_index: int):
246  """ Compute the slopes handled by a controller, and returns it
247 
248  Parameters:
249  controller_index : (int) : Controller index that will compute its slopes
250 
251  Return:
252  slopes : (np.ndarray) : Slopes vector
253  """
254  self.rtc.do_centroids(controller_index)
255  return self.get_slopes(controller_index)
256 
257  def reset_perturbation_voltage(self, controller_index: int) -> None:
258  """ Reset the perturbation voltage of the controller_index controller
259  (i.e. will remove ALL perturbation voltages.)
260  If you want to reset just one, see the function remove_perturbation_voltage()
261 
262  Parameters:
263  controller_index : (int) : controller index from where to remove the buffer
264  """
265  self.rtc.d_control[controller_index].reset_perturb_voltage()
266 
267  def remove_perturbation_voltage(self, controller_index: int, name: str) -> None:
268  """ Remove the perturbation voltage called <name>, from the controller number <controller_index>.
269  If you want to remove all of them, see function reset_perturbation_voltage()
270 
271  Parameters:
272  controller_index : (int) : controller index from where to remove the buffer
273  """
274  self.rtc.d_control[controller_index].remove_perturb_voltage(name)
275 
276  def get_err(self, controller_index: int) -> np.ndarray:
277  """ Get integrator increment from controller_index controller
278 
279  Parameters:
280  controller_index : (int) : controller index
281  """
282  return np.array(self.rtc.d_control[controller_index].d_err)
283 
284  def get_voltages(self, controller_index: int) -> np.ndarray:
285  """ Get voltages vector (i.e. vector sent to the DM) from controller_index controller
286 
287  Parameters:
288  controller_index : (int) : controller index
289 
290  Return:
291  voltages : (np.ndarray) : current voltages vector
292 
293  """
294  return np.array(self.rtc.d_control[controller_index].d_voltage)
295 
296  def set_integrator_law(self, controller_index: int) -> None:
297  """ Set the control law to integrator (controller generic only)
298  v[k] = v[k-1] + g.R.s[k]
299 
300  Parameters:
301  controller_index: (int): controller index
302  """
303  self.rtc.d_control[controller_index].set_commandlaw("integrator")
304 
305  def set_2matrices_law(self, controller_index: int) -> None:
306  """ Set the control law to 2matrices (controller generic only)
307  v[k] = decayFactor.E.v[k-1] + g.R.s[k]
308 
309  Parameters:
310  controller_index: (int): controller index
311  """
312  self.rtc.d_control[controller_index].set_commandlaw("2matrices")
313 
314  def set_modal_integrator_law(self, controller_index: int) -> None:
315  """ Set the control law to 2matrices (controller generic only)
316  v[k] = v[k-1] + E.g.R.s[k]
317 
318  Parameters:
319  controller_index: (int): controller index
320  """
321  self.rtc.d_control[controller_index].set_commandlaw("modal_integrator")
322 
323  def set_decay_factor(self, controller_index: int, decay : np.ndarray) -> None:
324  """ Set the decay factor used in 2matrices command law (controller generic only)
325 
326  Parameters :
327  controller_index: (int): controller index
328 
329  decay : (np.ndarray) : decay factor vector
330  """
331  self.rtc.d_control[controller_index].set_decayFactor(decay)
332 
333  def set_E_matrix(self, controller_index: int, e_matrix : np.ndarray) -> None:
334  """ Set the E matrix used in 2matrices or modal command law (controller generic only)
335 
336  Parameters :
337  e_matrix : (np.ndarray) : E matrix to set
338 
339  controller_index: (int): controller index
340  """
341  self.rtc.d_control[controller_index].set_matE(e_matrix)
342 
343  def reset_ref_slopes(self, controller_index: int) -> None:
344  """ Reset the reference slopes of each WFS handled by the specified controller
345 
346  Parameters:
347  controller_index: (int): controller index
348  """
349  for centro in self.rtc.d_centro:
350  centro.d_centroids_ref.reset()
351 
352  def set_centroider_threshold(self, centro_index: int, thresh: float) -> None:
353  """ Set the threshold value of a thresholded COG
354 
355  Parameters:
356  centro_index: (int): centroider index
357 
358  thresh: (float): new threshold value
359  """
360  self.rtc.d_centro[centro_index].set_threshold(thresh)
361 
362  def get_pyr_method(self, centro_index : int) -> str:
363  """ Get pyramid compute method currently used
364 
365  Parameters:
366  centro_index: (int): centroider index
367 
368  Return:
369  method : (str) : Pyramid compute method currently used
370  """
371  return self.rtc.d_centro[centro_index].pyr_method
372 
373  def set_pyr_method(self, centro_index: int, pyr_method : int) -> None:
374  """ Set the pyramid method for slopes computation
375 
376  Parameters :
377  centro_index : (int) : centroider index
378 
379  pyr_method : (int) : new centroiding method (0: nosinus global
380  1: sinus global
381  2: nosinus local
382  3: sinus local)
383  """
384  self.rtc.d_centro[centro_index].set_pyr_method(pyr_method) # Sets the pyr method
385  self.rtc.do_centroids(0) # To be ready for the next get_slopess
386  print("PYR method set to " + self.rtc.d_centro[centro_index].pyr_method)
387 
388 
389  def set_modal_gains(self, controller_index: int, mgain: np.ndarray) -> None:
390  """ Sets the modal gain (when using modal integrator control law)
391 
392  Parameters:
393  controller_index : (int) : Controller index to modify
394 
395  mgain : (np.ndarray) : Modal gains to set
396  """
397  self.rtc.d_control[controller_index].set_modal_gains(mgain)
398 
399  def get_modal_gains(self, controller_index: int) -> np.ndarray:
400  """ Returns the modal gains (when using modal integrator control law)
401 
402  Parameters:
403  controller_index : (int) : Controller index to modify
404 
405  Return:
406  mgain : (np.ndarray) : Modal gains vector currently used
407  """
408  return np.array(self.rtc.d_control[controller_index].d_gain)
409 
410  def get_masked_pix(self, centro_index: int) -> np.ndarray:
411  """ Return the mask of valid pixels used by a maskedpix centroider
412 
413  Parameters:
414  centro_index : (int): Centroider index. Must be a maskedpix centroider
415 
416  Return:
417  mask : (np.ndarray) : Mask used
418  """
419  if (self.rtc.d_centro[centro_index].type != scons.CentroiderType.MASKEDPIX):
420  raise TypeError("Centroider must be a maskedpix one")
421  self.rtc.d_centro[centro_index].fill_mask()
422  return np.array(self.rtc.d_centro[centro_index].d_mask)
423 
424  def get_command(self, controller_index: int) -> np.ndarray:
425  """ Returns the last computed command before conversion to voltages
426 
427  Parameters:
428  controller_index : (int, optional) : Controller index
429 
430  Return:
431  com : (np.ndarray) : Command vector
432  """
433  return np.array(self.rtc.d_control[controller_index].d_com)
434 
435  def set_command(self, controller_index: int, com : np.ndarray) -> np.ndarray:
436  """ Returns the last computed command before conversion to voltages
437 
438  Parameters:
439  controller_index : (int, optional) : Controller index
440 
441  com : (np.ndarray) : Command vector to set
442  """
443  if(com.size != self.config.p_controllers[controller_index].nactu):
444  raise ValueError("Dimension mismatch")
445  self.rtc.d_control[controller_index].set_com(com, com.size)
446 
447  def reset_command(self, controller_index: int = None) -> None:
448  """ Reset the controller_index Controller command buffer, reset all controllers if controller_index is None
449 
450  Parameters:
451  controller_index : (int, optional) : Controller index
452  Default is None, i.e. all controllers are reset
453  """
454  if (controller_index is None): # All Dms reset
455  for control in self.rtc.d_control:
456  control.d_com.reset()
457  else:
458  self.rtc.d_control[controller_index].d_com.reset()
459 
460  def get_slopes_geom(self, controller_index: int) -> np.ndarray:
461  """ Computes and return the slopes geom from the specified controller
462 
463  Parameters:
464  controller_index : (int) : controller index
465 
466  Return:
467  slopes_geom : (np.ndarray) : geometrically computed slopes
468  """
469  self.rtc.do_centroids_geom(controller_index)
470  slopes_geom = np.array(self.rtc.d_control[controller_index].d_centroids)
471  self.rtc.do_centroids(controller_index) # To return in non-geo state
472  return slopes_geom
473 
474  def get_selected_pix(self) -> np.ndarray:
475  """ Return the pyramid image with only the selected pixels used by the full pixels centroider
476 
477  Return:
478  selected_pix : (np.ndarray) : PWFS image with only selected pixels
479  """
480  if (self.config.p_centroiders[0].type != scons.CentroiderType.MASKEDPIX):
481  raise TypeError("Centroider must be maskedPix")
482 
483  carma_centroids = self.rtc.d_control[0].d_centroids
484  self.rtc.d_centro[0].fill_selected_pix(carma_centroids)
485 
486  return np.array(self.rtc.d_centro[0].d_selected_pix)
487 
488  def do_ref_slopes(self, controller_index: int) -> None:
489  """ Computes and set a new reference slopes for each WFS handled by
490  the specified controller
491 
492  Parameters:
493  controller_index: (int): controller index
494  """
495  print("Doing reference slopes...")
496  self.rtc.do_centroids_ref(controller_index)
497  print("Reference slopes done")
498 
499  def do_control(self, controller_index: int, *, sources : SourceCompass = None, source_index : int = 0, is_wfs_phase : bool = False) -> None:
500  """Computes the command from the Wfs slopes
501 
502  Parameters :
503  controller_index: (int): controller index
504 
505  sources : (SourceCompass, optional) : List of phase screens of a wfs or target sutra object
506  If the controller is a GEO one, specify a SourceCompass instance
507  from WfsCompass or TargetCompass to project the corresponding phase
508 
509  source_index : (int, optional) : Index of the phase screen to consider inside <sources>. Default is 0
510 
511  is_wfs_phase : (bool, optional) : If True, sources[source_index] is a WFS phase screen.
512  Else, it is a Target phase screen (Default)
513  """
514  if (self.rtc.d_control[controller_index].type == scons.ControllerType.GEO):
515  if (sources is not None):
516  self.rtc.d_control[controller_index].comp_dphi(sources[source_index],
517  is_wfs_phase)
518  self.rtc.do_control(controller_index)
519 
520  def do_calibrate_img(self, controller_index: int) -> None:
521  """ Computes the calibrated image from the Wfs image
522 
523  Parameters :
524  controller_index: (int): controller index
525  """
526  self.rtc.do_calibrate_img(controller_index)
527 
528  def do_centroids(self, controller_index: int) -> None:
529  """ Computes the centroids from the Wfs image
530 
531  Parameters :
532  controller_index: (int): controller index
533  """
534  self.rtc.do_centroids(controller_index)
535 
536  def do_centroids_geom(self, controller_index: int) -> None:
537  """ Computes the centroids geom from the Wfs image
538 
539  Parameters :
540  controller_index: (int): controller index
541  """
542  self.rtc.do_centroids_geom(controller_index)
543 
544  def apply_control(self, controller_index: int, *, comp_voltage: bool = True) -> None:
545  """ Computes the final voltage vector to apply on the DM by taking into account delay and perturbation voltages, and shape the DMs
546 
547  Parameters :
548  controller_index: (int): controller index
549 
550  comp_voltage: (bool): If True (default), computes the voltage vector from the command one (delay + perturb). Else, directly applies the current voltage vector
551  """
552  self.rtc.apply_control(controller_index, comp_voltage)
553 
554  def do_clipping(self, controller_index: int) -> None:
555  """ Clip the commands between vmin and vmax values set in the RTC
556 
557  Parameters :
558  controller_index: (int): controller index
559  """
560  self.rtc.do_clipping(controller_index)
561 
562  def set_scale(self, centroider_index : int, scale : float) -> None:
563  """ Update the scale factor of the centroider
564 
565  Parameters:
566  centroider_index : (int) : Index of the centroider to update
567 
568  scale : (float) : scale factor to apply on slopes
569  """
570  self.rtc.d_centro[centroider_index].set_scale(scale)
571 
572  def publish(self) -> None:
573  """ Publish loop data on DDS topics
574 
575  /!\ only with cacao enabled, requires OCTOPUS
576  """
577  if self.cacao:
578  self.rtc.rtc.publish()
579  else:
580  raise AttributeError("CACAO must be enabled")
shesha.supervisor.components.rtcCompass.RtcCompass.get_ref_slopes
np.ndarray get_ref_slopes(self, centro_index=None)
Get the currently used reference slopes.
Definition: rtcCompass.py:180
shesha.supervisor.components.rtcCompass.RtcCompass.set_modal_gains
None set_modal_gains(self, int controller_index, np.ndarray mgain)
Sets the modal gain (when using modal integrator control law)
Definition: rtcCompass.py:407
shesha.supervisor.components.rtcCompass.RtcCompass.set_2matrices_law
None set_2matrices_law(self, int controller_index)
Set the control law to 2matrices (controller generic only) v[k] = decayFactor.E.v[k-1] + g....
Definition: rtcCompass.py:322
shesha.supervisor.components.rtcCompass.RtcCompass.get_err
np.ndarray get_err(self, int controller_index)
Get integrator increment from controller_index controller.
Definition: rtcCompass.py:292
shesha.supervisor.components.rtcCompass.RtcCompass
RTC handler for compass simulation.
Definition: rtcCompass.py:46
shesha.supervisor.components.rtcCompass.RtcCompass.rtc
rtc
Definition: rtcCompass.py:88
shesha.supervisor.components.rtcCompass.RtcCompass.get_modal_gains
np.ndarray get_modal_gains(self, int controller_index)
Returns the modal gains (when using modal integrator control law)
Definition: rtcCompass.py:418
shesha.supervisor.components.rtcCompass.RtcCompass.do_ref_slopes
None do_ref_slopes(self, int controller_index)
Computes and set a new reference slopes for each WFS handled by the specified controller.
Definition: rtcCompass.py:505
shesha.supervisor.components.rtcCompass.RtcCompass.set_centroider_threshold
None set_centroider_threshold(self, int centro_index, float thresh)
Set the threshold value of a thresholded COG.
Definition: rtcCompass.py:370
shesha.supervisor.components.rtcCompass.RtcCompass.set_E_matrix
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)
Definition: rtcCompass.py:351
shesha.constants
Numerical constants for shesha and config enumerations for safe-typing.
Definition: constants.py:1
shesha.supervisor.components.sourceCompass
Definition: sourceCompass.py:1
shesha.supervisor.components.rtcCompass.RtcCompass.get_slopes_geom
np.ndarray get_slopes_geom(self, int controller_index)
Computes and return the slopes geom from the specified controller.
Definition: rtcCompass.py:479
shesha.supervisor.components.rtcCompass.RtcCompass.set_flat
def set_flat(self, int centro_index, np.ndarray flat)
Load flat field for the given wfs.
Definition: rtcCompass.py:243
shesha.supervisor.components.rtcCompass.RtcCompass.open_loop
None open_loop(self, int controller_index=None, reset=True)
Integrator computation goes to /dev/null but pertuVoltage still applied.
Definition: rtcCompass.py:146
shesha.supervisor.components.rtcCompass.RtcCompass.__init__
def __init__(self, context, config, tel, wfs, dms, atm, *cacao=False)
Definition: rtcCompass.py:83
shesha.supervisor.components.rtcCompass.RtcCompass.set_decay_factor
None set_decay_factor(self, int controller_index, np.ndarray decay)
Set the decay factor used in 2matrices command law (controller generic only)
Definition: rtcCompass.py:341
shesha.supervisor.components.rtcCompass.RtcCompass.cacao
cacao
Initialize a RtcCompass component for rtc related supervision.
Definition: rtcCompass.py:86
fill_mask
int fill_mask(float *d_odata, float *d_idata, int N, int norm, CarmaDevice *device)
shesha.supervisor.components.rtcCompass.RtcCompass.get_voltages
np.ndarray get_voltages(self, int controller_index)
Get voltages vector (i.e.
Definition: rtcCompass.py:304
shesha.supervisor.components.rtcCompass.RtcCompass.publish
None publish(self)
Publish loop data on DDS topics.
Definition: rtcCompass.py:587
shesha.supervisor.components.rtcCompass.RtcCompass.compute_slopes
def compute_slopes(self, int controller_index)
Compute the slopes handled by a controller, and returns it.
Definition: rtcCompass.py:264
shesha.supervisor.components.rtcCompass.RtcCompass.set_command
np.ndarray set_command(self, int controller_index, np.ndarray com)
Returns the last computed command before conversion to voltages.
Definition: rtcCompass.py:453
shesha.supervisor.components.rtcCompass.RtcCompass.get_pyr_method
str get_pyr_method(self, int centro_index)
Get pyramid compute method currently used.
Definition: rtcCompass.py:381
shesha.supervisor.components.rtcCompass.RtcCompass.get_slopes
np.ndarray get_slopes(self, int controller_index)
Return the current slopes vector of the controller_index controller.
Definition: rtcCompass.py:122
shesha.supervisor.components.rtcCompass.RtcCompass.set_dark
def set_dark(self, int centro_index, np.ndarray dark)
Load dark for the given wfs.
Definition: rtcCompass.py:253
shesha.supervisor.components.rtcCompass.RtcCompass.get_command_matrix
def get_command_matrix(self, int controller_index)
Return the command matrix of the controller.
Definition: rtcCompass.py:218
shesha.supervisor.components.rtcCompass.RtcCompass.reset_perturbation_voltage
None reset_perturbation_voltage(self, int controller_index)
Reset the perturbation voltage of the controller_index controller (i.e.
Definition: rtcCompass.py:275
shesha.supervisor.components.rtcCompass.RtcCompass.set_perturbation_voltage
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)
Definition: rtcCompass.py:103
shesha.init.rtc_init
Initialization of a Rtc object.
Definition: rtc_init.py:1
shesha.supervisor.components.rtcCompass.RtcCompass.set_modal_integrator_law
None set_modal_integrator_law(self, int controller_index)
Set the control law to 2matrices (controller generic only) v[k] = v[k-1] + E.g.R.s[k].
Definition: rtcCompass.py:331
shesha.supervisor.components.rtcCompass.RtcCompass.get_command
np.ndarray get_command(self, int controller_index)
Returns the last computed command before conversion to voltages.
Definition: rtcCompass.py:443
shesha.supervisor.components.rtcCompass.RtcCompass.reset_ref_slopes
None reset_ref_slopes(self, int controller_index)
Reset the reference slopes of each WFS handled by the specified controller.
Definition: rtcCompass.py:359
shesha.supervisor.components.rtcCompass.RtcCompass.close_loop
None close_loop(self, int controller_index=None)
DM receives controller output + pertuVoltage.
Definition: rtcCompass.py:131
shesha.supervisor.components.rtcCompass.RtcCompass.reset_command
None reset_command(self, int controller_index=None)
Reset the controller_index Controller command buffer, reset all controllers if controller_index is No...
Definition: rtcCompass.py:464
shesha.supervisor.components.rtcCompass.RtcCompass.get_intensities
np.ndarray get_intensities(self)
Return sum of intensities in subaps.
Definition: rtcCompass.py:233
shesha.supervisor.components.rtcCompass.RtcCompass.do_clipping
None do_clipping(self, int controller_index)
Clip the commands between vmin and vmax values set in the RTC.
Definition: rtcCompass.py:570
shesha.supervisor.components.rtcCompass.RtcCompass.do_centroids_geom
None do_centroids_geom(self, int controller_index)
Computes the centroids geom from the Wfs image.
Definition: rtcCompass.py:552
shesha.supervisor.components.rtcCompass.RtcCompass.do_centroids
None do_centroids(self, int controller_index)
Computes the centroids from the Wfs image.
Definition: rtcCompass.py:544
shesha.supervisor.components.rtcCompass.RtcCompass.set_command_matrix
None set_command_matrix(self, int controller_index, np.ndarray cmat)
Set the command matrix for the controller to use.
Definition: rtcCompass.py:228
shesha.supervisor.components.rtcCompass.RtcCompass.do_calibrate_img
None do_calibrate_img(self, int controller_index)
Computes the calibrated image from the Wfs image.
Definition: rtcCompass.py:536
shesha.supervisor.components.rtcCompass.RtcCompass.config
config
Definition: rtcCompass.py:85
shesha.supervisor.components.rtcCompass.RtcCompass.get_interaction_matrix
def get_interaction_matrix(self, int controller_index)
Return the interaction matrix of the controller.
Definition: rtcCompass.py:207
shesha.supervisor.components.rtcCompass.RtcCompass.get_masked_pix
np.ndarray get_masked_pix(self, int centro_index)
Return the mask of valid pixels used by a maskedpix centroider.
Definition: rtcCompass.py:429
shesha.supervisor.components.rtcCompass.RtcCompass.set_scale
None set_scale(self, int centroider_index, float scale)
Update the scale factor of the centroider.
Definition: rtcCompass.py:580
shesha.supervisor.components.rtcCompass.RtcCompass.set_gain
None set_gain(self, int controller_index, float gain)
Set the scalar gain.
Definition: rtcCompass.py:196
shesha.supervisor.components.rtcCompass.RtcCompass.set_pyr_method
None set_pyr_method(self, int centro_index, int pyr_method)
Set the pyramid method for slopes computation.
Definition: rtcCompass.py:394
shesha.supervisor.components.rtcCompass.RtcCompass.set_ref_slopes
None set_ref_slopes(self, np.ndarray ref_slopes, *centro_index=None)
Set given ref slopes in centroider.
Definition: rtcCompass.py:163
shesha.supervisor.components.rtcCompass.RtcCompass.context
context
Definition: rtcCompass.py:84
shesha.supervisor.components.rtcCompass.RtcCompass.do_control
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.
Definition: rtcCompass.py:524
shesha.supervisor.components.rtcCompass.RtcCompass.set_integrator_law
None set_integrator_law(self, int controller_index)
Set the control law to integrator (controller generic only) v[k] = v[k-1] + g.R.s[k].
Definition: rtcCompass.py:313
shesha.supervisor.components.rtcCompass.RtcCompass.remove_perturbation_voltage
None remove_perturbation_voltage(self, int controller_index, str name)
Remove the perturbation voltage called <name>, from the controller number <controller_index>.
Definition: rtcCompass.py:284
shesha.supervisor.components.rtcCompass.RtcCompass.apply_control
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...
Definition: rtcCompass.py:562
shesha.supervisor.components.rtcCompass.RtcCompass.get_selected_pix
np.ndarray get_selected_pix(self)
Return the pyramid image with only the selected pixels used by the full pixels centroider.
Definition: rtcCompass.py:490