41 """ DM handler for compass simulation
44 dms : (sutraWrap.Dms) : Sutra dms instance
46 context : (carmaContext) : CarmaContext instance
48 config : (config module) : Parameters configuration structure module
51 """ Initialize a DmCompass component for DM related supervision
54 context : (carmaContext) : CarmaContext instance
56 config : (config module) : Parameters configuration structure module
64 def set_command(self, commands: np.ndarray) ->
None:
65 """ Immediately sets provided command to DMs - does not affect integrator
68 commands : (np.ndarray) : commands vector to apply
70 self.
dms.set_full_com(commands)
72 def set_one_actu(self, dm_index: int, nactu: int, *, ampli: float = 1) ->
None:
73 """ Push the selected actuator
76 dm_index : (int) : DM index
78 nactu : (int) : actuator index to push
80 ampli : (float, optional) : amplitude to apply. Default is 1 volt
82 self.
dms.d_dms[dm_index].comp_oneactu(nactu, ampli)
85 """ Returns the influence function cube for the given dm
88 dm_index : (int) : index of the DM
91 influ : (np.ndarray) : Influence functions of the DM dm_index
93 return self.
config.p_dms[dm_index]._influ
96 """ Returns the lower left coordinates of the influ function support in the ipupil coord system
99 dm_index : (int) : index of the DM
102 coords : (tuple) : (i, j)
104 i1 = self.
config.p_dm0._i1
105 j1 = self.
config.p_dm0._j1
106 ii1 = i1 + self.
config.p_dm0._n1
107 jj1 = j1 + self.
config.p_dm0._n1
110 def reset_dm(self, dm_index: int = -1) ->
None:
111 """ Reset the specified DM or all DMs if dm_index is -1
114 dm_index : (int, optional) : Index of the DM to reset
115 Default is -1, i.e. all DMs are reset
118 for dm
in self.
dms.d_dms:
121 self.
dms.d_dms[dm_index].reset_shape()
124 """ Return the current phase shape of the selected DM
127 indx : (int) : Index of the DM
130 dm_shape : (np.ndarray) : DM phase screen
133 return np.array(self.
dms.d_dms[indx].d_shape)
136 theta : float=
None, G : float=
None) ->
None:
137 """Set the registration parameters for DM #dm_index
140 dm_index : (int) : DM index
142 dx : (float, optionnal) : X axis registration parameter [meters]. If None, re-use the last one
144 dy : (float, optionnal) : Y axis registration parameter [meters]. If None, re-use the last one
146 theta : (float, optionnal) : Rotation angle parameter [rad]. If None, re-use the last one
148 G : (float, optionnal) : Magnification factor. If None, re-use the last one
151 self.
config.p_dms[dm_index].set_dx(dx)
153 self.
config.p_dms[dm_index].set_dy(dy)
154 if theta
is not None:
155 self.
config.p_dms[dm_index].set_theta(theta)
157 self.
config.p_dms[dm_index].set_G(G)
159 self.
dms.d_dms[dm_index].set_registration(
160 self.
config.p_dms[dm_index].dx / self.
config.p_geom._pixsize,
161 self.
config.p_dms[dm_index].dy / self.
config.p_geom._pixsize,
162 self.
config.p_dms[dm_index].theta, self.
config.p_dms[dm_index].G)