39 from typing
import Tuple
42 """ DM handler for compass simulation
45 _dms : (sutraWrap.Dms) : Sutra dms instance
47 _context : (carmaContext) : CarmaContext instance
49 _config : (config module) : Parameters configuration structure module
52 """ Initialize a DmCompass component for DM related supervision
55 context : (carmaContext) : CarmaContext instance
57 config : (config module) : Parameters configuration structure module
65 def set_command(self, commands: np.ndarray, *, dm_index : int=
None, shape_dm : bool=
True) ->
None:
66 """ Immediately sets provided command to DMs - does not affect integrator
69 commands : (np.ndarray) : commands vector to apply
72 dm_index : (int) : Index of the DM to set. If None (default), set all the DMs.
73 In that case, provided commands vector must have a size equal
74 to the sum of all the DMs actuators.
75 If index_dm is set, size must be equal to the number of actuator
78 shape_dm : (bool) : If True (default), immediately apply the given commands on the DMs
81 self.
_dms_dms.set_full_com(commands, shape_dm)
83 self.
_dms_dms.d_dms[dm_index].set_com(commands, shape_dm)
85 def set_one_actu(self, dm_index: int, nactu: int, *, ampli: float = 1) ->
None:
86 """ Push the selected actuator
89 dm_index : (int) : DM index
91 nactu : (int) : actuator index to push
94 ampli : (float) : amplitude to apply. Default is 1 volt
96 self.
_dms_dms.d_dms[dm_index].comp_oneactu(nactu, ampli)
99 """ Returns the influence function cube for the given dm
102 dm_index : (int) : index of the DM
105 influ : (np.ndarray) : Influence functions of the DM dm_index
107 return self.
_config_config.p_dms[dm_index]._influ
110 """ Returns the lower left coordinates of the influ function support in the ipupil coord system
113 dm_index : (int) : index of the DM
116 coords : (tuple) : (i, j)
118 i1 = self.
_config_config.p_dms[dm_index]._i1
119 j1 = self.
_config_config.p_dms[dm_index]._j1
120 ii1 = i1 + self.
_config_config.p_dms[dm_index]._n1
121 jj1 = j1 + self.
_config_config.p_dms[dm_index]._n1
124 def reset_dm(self, dm_index: int = -1) ->
None:
125 """ Reset the specified DM or all DMs if dm_index is -1
128 dm_index : (int) : Index of the DM to reset
129 Default is -1, i.e. all DMs are reset
132 for dm
in self.
_dms_dms.d_dms:
135 self.
_dms_dms.d_dms[dm_index].reset_shape()
138 """ Return the current phase shape of the selected DM
141 indx : (int) : Index of the DM
144 dm_shape : (np.ndarray) : DM phase screen
147 return np.array(self.
_dms_dms.d_dms[indx].d_shape)
150 theta : float=
None, G : float=
None) ->
None:
151 """Set the registration parameters for DM #dm_index
154 dm_index : (int) : DM index
157 dx : (float) : X axis registration parameter [meters]. If None, re-use the last one
159 dy : (float) : Y axis registration parameter [meters]. If None, re-use the last one
161 theta : (float) : Rotation angle parameter [rad]. If None, re-use the last one
163 G : (float) : Magnification factor. If None, re-use the last one
166 self.
_config_config.p_dms[dm_index].set_dx(dx)
168 self.
_config_config.p_dms[dm_index].set_dy(dy)
169 if theta
is not None:
170 self.
_config_config.p_dms[dm_index].set_theta(theta)
172 self.
_config_config.p_dms[dm_index].set_G(G)
174 self.
_dms_dms.d_dms[dm_index].set_registration(
175 self.
_config_config.p_dms[dm_index].dx / self.
_config_config.p_geom._pixsize,
176 self.
_config_config.p_dms[dm_index].dy / self.
_config_config.p_geom._pixsize,
177 self.
_config_config.p_dms[dm_index].theta, self.
_config_config.p_dms[dm_index].G)
DM handler for compass simulation.
None reset_dm(self, int dm_index=-1)
Reset the specified DM or all DMs if dm_index is -1.
None set_dm_registration(self, int dm_index, *float dx=None, float dy=None, float theta=None, float G=None)
Set the registration parameters for DM #dm_index.
None set_one_actu(self, int dm_index, int nactu, *float ampli=1)
Push the selected actuator.
np.ndarray get_influ_function(self, int dm_index)
Returns the influence function cube for the given dm.
Tuple[np.ndarray, np.ndarray] get_influ_function_ipupil_coords(self, int dm_index)
Returns the lower left coordinates of the influ function support in the ipupil coord system.
def __init__(self, context, config)
None set_command(self, np.ndarray commands, *int dm_index=None, bool shape_dm=True)
Immediately sets provided command to DMs - does not affect integrator.
np.ndarray get_dm_shape(self, int indx)
Return the current phase shape of the selected DM.
Initialization of a Dms object.