COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
shesha.supervisor.optimizers.calibration.Calibration Class Reference

This optimizer class handles all the modal basis and DM Influence functions related operations. More...

Inheritance diagram for shesha.supervisor.optimizers.calibration.Calibration:
Collaboration diagram for shesha.supervisor.optimizers.calibration.Calibration:

Public Member Functions

def __init__ (self, config, tel, atmos, dms, target, rtc, wfs)
 
def apply_volts_and_get_slopes (self, int controller_index, *bool noise=False, bool turbu=False, bool reset=True)
 Apply voltages, raytrace, compute WFS image, compute slopes and returns it. More...
 
np.ndarray do_imat_modal (self, int controller_index, np.ndarray ampli, np.ndarray modal_basis, *bool noise=False, int nmodes_max=0, bool with_turbu=False, bool push_pull=False)
 Computes an interaction matrix from provided modal basis. More...
 
np.ndarray do_imat_phase (self, int controller_index, np.ndarray cube_phase, *bool noise=False, int nmodes_max=0, bool with_turbu=False, bool push_pull=False, int wfs_index=0)
 Computes an interaction matrix with the provided cube phase. More...
 
np.ndarray compute_modal_residuals (self, np.ndarray projection_matrix, *np.ndarray selected_actus=None)
 Computes the modal residual coefficients of the residual phase. More...
 

Public Attributes

 config
 
 tel
 
 atmos
 
 dms
 
 target
 
 rtc
 
 wfs
 Instantiate a ModalBasis object. More...
 

Detailed Description

This optimizer class handles all the modal basis and DM Influence functions related operations.

Definition at line 44 of file calibration.py.

Constructor & Destructor Documentation

◆ __init__()

def shesha.supervisor.optimizers.calibration.Calibration.__init__ (   self,
  config,
  tel,
  atmos,
  dms,
  target,
  rtc,
  wfs 
)

Definition at line 95 of file calibration.py.

95 
96  reset : (bool, optional) : Flag to reset previous phase screen before raytracing.
97  Default is True
98  """
99  self.rtc.apply_control(controller_index)
100  for w in range(len(self.config.p_wfss)):
101  if (turbu):
102  self.wfs.raytrace(w, tel=self.tel, atm=self.atmos, dms=self.dms)
103  else:

Member Function Documentation

◆ apply_volts_and_get_slopes()

def shesha.supervisor.optimizers.calibration.Calibration.apply_volts_and_get_slopes (   self,
int  controller_index,
*bool   noise = False,
bool   turbu = False,
bool   reset = True 
)

Apply voltages, raytrace, compute WFS image, compute slopes and returns it.

Parameters
controller_index (int) : Controller index
noise (bool, optional) : Flag to enable noise for WFS image compuation. Default is False
turbu (bool, optional) : Flag to enable atmosphere for WFS phase screen raytracing. Default is False
reset (bool, optional) : Flag to reset previous phase screen before raytracing. Default is True

Definition at line 117 of file calibration.py.

117  modal_basis : (np.ndarray) : modal basis matrix
118 
119  noise : (bool, optional) : Flag to enable noise for WFS image compuation. Default is False
120 
121  nmodes_max : (int, optional) : Default is 0. TODO : description
122 
123  with_turbu : (bool, optional) : Flag to enable atmosphere for WFS phase screen raytracing.
124  Default is False
125 
126  push_pull : (bool, optional) : If True, imat is computed as an average of push and pull ampli
127  on each mode
Here is the caller graph for this function:

◆ compute_modal_residuals()

np.ndarray shesha.supervisor.optimizers.calibration.Calibration.compute_modal_residuals (   self,
np.ndarray  projection_matrix,
*np.ndarray  selected_actus = None 
)

Computes the modal residual coefficients of the residual phase.

   /!\ It supposed that roket is enabled, and the associated GEO controller is index 1.

   Uses the projection matrix computed from compute_modes_to_volts_basis (modalBasis module)
Parameters
projection_matrix (np.ndarray) : Modal projection matrix
selected_actus (np.ndarray) : TODO : description
Return
ai (np.ndarray) : Modal coefficients

Definition at line 244 of file calibration.py.

◆ do_imat_modal()

np.ndarray shesha.supervisor.optimizers.calibration.Calibration.do_imat_modal (   self,
int  controller_index,
np.ndarray  ampli,
np.ndarray  modal_basis,
*bool  noise = False,
int  nmodes_max = 0,
bool  with_turbu = False,
bool  push_pull = False 
)

Computes an interaction matrix from provided modal basis.

Parameters
controller_index (int) : Controller index
ampli (np.ndarray) : amplitude to apply on each mode
modal_basis (np.ndarray) : modal basis matrix
noise (bool, optional) : Flag to enable noise for WFS image compuation. Default is False
nmodes_max (int, optional) : Default is 0. TODO : description
with_turbu (bool, optional) : Flag to enable atmosphere for WFS phase screen raytracing. Default is False
push_pull (bool, optional) : If True, imat is computed as an average of push and pull ampli on each mode
Return
modal_imat (np.ndarray) : Modal interaction matrix

Definition at line 150 of file calibration.py.

150  modal_imat[:, m] = (devpos - devmin) / (2. * ampli[m])
151  else: # No turbulence => push only
152  self.rtc.open_loop(controller_index) # open_loop
153  self.rtc.set_perturbation_voltage(controller_index, "imat_modal", v)
154  modal_imat[:, m] = self.apply_volts_and_get_slopes(controller_index, noise=noise) / ampli[m]
155  self.rtc.remove_perturbation_voltage(controller_index, "imat_modal")
156  if ((push_pull is True) or (with_turbu is True)):
157  self.rtc.close_loop(controller_index) # We are supposed to be in close loop now
158  return modal_imat
159 
160  def do_imat_phase(self, controller_index: int, cube_phase: np.ndarray, *, noise : bool=False,
161  nmodes_max : int=0, with_turbu : bool=False, push_pull : bool=False, wfs_index : int=0) -> np.ndarray:
162  """ Computes an interaction matrix with the provided cube phase
163 
164  Parameters:
165  controller_index : (int) : Controller index
166 
167  cube_phase : (np.ndarray) : Cube of phase to insert as NCPA
168 
169  noise : (bool, optional) : Flag to enable noise for WFS image compuation. Default is False
170 
171  nmodes_max : (int, optional) : Default is 0. TODO : description
172 
173  with_turbu : (bool, optional) : Flag to enable atmosphere for WFS phase screen raytracing.
174  Default is False
175 
176  push_pull : (bool, optional) : If True, imat is computed as an average of push and pull ampli
177  on each mode
178 
179  wfs_index : (int, optional) : WFS index. Default is 0
Here is the call graph for this function:

◆ do_imat_phase()

np.ndarray shesha.supervisor.optimizers.calibration.Calibration.do_imat_phase (   self,
int  controller_index,
np.ndarray  cube_phase,
*bool  noise = False,
int  nmodes_max = 0,
bool  with_turbu = False,
bool  push_pull = False,
int  wfs_index = 0 
)

Computes an interaction matrix with the provided cube phase.

Parameters
controller_index (int) : Controller index
cube_phase (np.ndarray) : Cube of phase to insert as NCPA
noise (bool, optional) : Flag to enable noise for WFS image compuation. Default is False
nmodes_max (int, optional) : Default is 0. TODO : description
with_turbu (bool, optional) : Flag to enable atmosphere for WFS phase screen raytracing. Default is False
push_pull (bool, optional) : If True, imat is computed as an average of push and pull ampli on each mode
wfs_index (int, optional) : WFS index. Default is 0
Return
phase_imat (np.ndarray) : Phase interaction matrix

Definition at line 202 of file calibration.py.

202  _ = self.apply_volts_and_get_slopes(controller_index, turbu=with_turbu,
203  noise=noise)
204 
205  return imat_phase
206 
207  def compute_modal_residuals(self, projection_matrix : np.ndarray,
208  *, selected_actus : np.ndarray=None) -> np.ndarray:
209  """ Computes the modal residual coefficients of the residual phase.
210 
211  /!\ It supposed that roket is enabled, and the associated GEO controller is index 1.
212 
213  Uses the projection matrix computed from compute_modes_to_volts_basis (modalBasis module)
214 
215  Parameters:
216  projection_matrix : (np.ndarray) : Modal projection matrix
217 
218  selected_actus : (np.ndarray) : TODO : description
219 
220  Return:
221  ai : (np.ndarray) : Modal coefficients
222  """
223  try:
224  self.rtc.do_control(1, sources=self.target.sources)
225  except:
226  return [0]
227  v = self.rtc.get_command(1) #¬†We compute here the residual phase on the DM modes. Gives the Equivalent volts to apply/
228  if (selected_actus is None):
229  ai = projection_matrix.dot(v) * 1000. # np rms units
Here is the call graph for this function:

Member Data Documentation

◆ atmos

shesha.supervisor.optimizers.calibration.Calibration.atmos

(AtmosScompass) : AtmosCompass instance

Definition at line 98 of file calibration.py.

◆ config

shesha.supervisor.optimizers.calibration.Calibration.config

(config) : Configuration parameters module

Definition at line 96 of file calibration.py.

◆ dms

shesha.supervisor.optimizers.calibration.Calibration.dms

(DmCompass) : DmCompass instance

Definition at line 99 of file calibration.py.

◆ rtc

shesha.supervisor.optimizers.calibration.Calibration.rtc

(RtcCompass) : RtcCompass instance

Definition at line 101 of file calibration.py.

◆ target

shesha.supervisor.optimizers.calibration.Calibration.target

(TargetCompass) : TargetCompass instance

Definition at line 100 of file calibration.py.

◆ tel

shesha.supervisor.optimizers.calibration.Calibration.tel

(TelescopeCompass) : TelescopeCompass instance

Definition at line 97 of file calibration.py.

◆ wfs

shesha.supervisor.optimizers.calibration.Calibration.wfs

Instantiate a ModalBasis object.

(WfsCompass) : WfsCompass instance

Parameters
config (config) : Configuration parameters module
tel (TelescopeCompass) : TelescopeCompass instance
atmos (AtmosScompass) : AtmosCompass instance
dms (DmCompass) : DmCompass instance
target (TargetCompass) : TargetCompass instance
rtc (RtcCompass) : RtcCompass instance
wfs (WfsCompass) : WfsCompass instance

Definition at line 102 of file calibration.py.


The documentation for this class was generated from the following file:
open_loop
Definition: open_loop.py:1