COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
imat.py
1 import numpy as np
2 
3 def compose_imat(sup, *, compose_type="controller", controller_id=0):
4  """ Return an interaction matrix
5 
6  return either the specified controller interaction matrix (if compose_type="controller")
7  or an imat composed of all controller interaction matrices (if compose_type="splitTomo")
8 
9  Args:
10  sup : (compasSSupervisor) : supervisor
11 
12  Kargs:
13  compose_type : (str) : (optional), default "controller" possibility to specify split tomography case ("controller" or "splitTomo")
14 
15  controller_id : (int) : (optional), default 0 controller index
16 
17  Returns:
18  imat : (np.ndarray[ndim=1, dtype=np.float32]) : interaction matrix
19  """
20  if(compose_type=="controller"):
21  return sup.rtc.get_interaction_matrix(controller_id)
22  elif(compose_type=="splitTomo"):
23  n_actu = 0
24  n_meas = 0
25  for c in range(len(sup.config.p_controllers)):
26  imShape = sup.rtc.get_interaction_matrix(c).shape
27  n_meas += imShape[0]
28  n_actu += imShape[1]
29  imat=np.zeros((n_meas, n_actu))
30  n_meas = 0
31  n_actu = 0
32  for c in range(len(sup.config.p_controllers)):
33  im = sup.rtc.get_interaction_matrix(c)
34  imat[n_meas:n_meas+im.shape[0],n_actu:n_actu+im.shape[1]]=np.copy(im)
35  n_meas += im.shape[0]
36  n_actu += im.shape[1]
37  return imat
38 
39  else:
40  print("Unknown composition type")
def compose_imat(sup, *compose_type="controller", controller_id=0)
Return an interaction matrix.
Definition: imat.py:19