|
| def | do_tomo_matrices (int ncontrol, Rtc rtc, List[conf.Param_wfs] p_wfss, Dms dms, Atmos atmos, Sensors wfs, conf.Param_controller p_controller, conf.Param_geom p_geom, list p_dms, conf.Param_tel p_tel, conf.Param_atmos p_atmos) |
| | Compute Cmm and Cphim matrices for the MV controller on GPU. More...
|
| |
| def | selectDMforLayers (conf.Param_atmos p_atmos, conf.Param_controller p_controller, list p_dms) |
| | For each atmos layer, select the DM which have to handle it in the Cphim computation for MV controller. More...
|
| |
| def | create_nact_geom (conf.Param_dm p_dm) |
| | Compute the DM coupling matrix. More...
|
| |
| def | create_piston_filter (conf.Param_dm p_dm) |
| | Create the piston filter matrix. More...
|
| |
Computation of tomographic reconstructor.
- Author
- COMPASS Team https://github.com/ANR-COMPASS
- Version
- 5.0.0
- Date
- 2020/05/18
- Copyright
- GNU Lesser General Public License
This file is part of COMPASS https://anr-compass.github.io/compass/
Copyright (C) 2011-2019 COMPASS Team https://github.com/ANR-COMPASS All rights reserved. Distributed under GNU - LGPL
COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
COMPASS: End-to-end AO simulation tool using GPU acceleration The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.
The final product includes a software package for simulating all the critical subcomponents of AO, particularly in the context of the ELT and a real-time core based on several control approaches, with performances consistent with its integration into an instrument. Taking advantage of the specific hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to conduct large simulation campaigns called to the ELT.
The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and various systems configurations such as multi-conjugate AO.
COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with COMPASS. If not, see https://www.gnu.org/licenses/lgpl-3.0.txt.
| def shesha.ao.tomo.do_tomo_matrices |
( |
int |
ncontrol, |
|
|
Rtc |
rtc, |
|
|
List[conf.Param_wfs] |
p_wfss, |
|
|
Dms |
dms, |
|
|
Atmos |
atmos, |
|
|
Sensors |
wfs, |
|
|
conf.Param_controller |
p_controller, |
|
|
conf.Param_geom |
p_geom, |
|
|
list |
p_dms, |
|
|
conf.Param_tel |
p_tel, |
|
|
conf.Param_atmos |
p_atmos |
|
) |
| |
Compute Cmm and Cphim matrices for the MV controller on GPU.
:parameters:
ncontrol (int): controller index
rtc (Rtc) : rtc object
p_wfss (list of Param_wfs) : wfs settings
dms (Dms) : Dms object
atmos (Atmos) : Atmos object
wfs (Sensors) : Sensors object
p_controller (Param_controller): controller settings
p_geom (Param_geom) : geom settings
p_dms (list of Param_dms) : dms settings
p_tel (Param_tel) : telescope settings
p_atmos (Param_atmos) : atmos settings
Definition at line 75 of file tomo.py.
75 p_tel: (Param_tel) : telescope settings
77 p_atmos: (Param_atmos) : atmos settings
79 nvalidperwfs = np.array([o._nvalid for o in p_wfss], dtype=np.int64)
80 # Bring bottom left corner of valid subapertures in ipupil
83 s2ipup = (ipup.shape[0] - spup.shape[0]) / 2.
84 # Total number of subapertures
85 nvalid = sum([nvalidperwfs[j] for j in p_controller.nwfs])
87 # X-position of the bottom left corner of each valid subaperture
88 X = np.zeros(nvalid, dtype=np.float64)
89 # Y-position of the bottom left corner of each subaperture
90 Y = np.zeros(nvalid, dtype=np.float64)
92 for k in p_controller.nwfs:
93 posx = p_wfss[k]._validpuppixx + s2ipup
94 # X-position of the bottom left corner of each valid subaperture
95 # bring the origin in the center of ipupil and 0-index it
96 posx = posx - ipup.shape[0] / 2 - 1
97 posy = p_wfss[k]._validpuppixy + s2ipup
98 posy = posy.T - ipup.shape[0] / 2 - 1
99 p2m = (p_tel.diam / p_wfss[k].nxsub) / \
100 p_wfss[k]._pdiam # Size of one pixel in meters
101 posx *= p2m # Positions in meters
103 X[ind:ind + p_wfss[k]._nvalid] = posx
104 Y[ind:ind + p_wfss[k]._nvalid] = posy
105 ind += p_wfss[k]._nvalid
107 # Get the total number of pzt DM and actuators to control
110 for k in p_controller.ndm:
111 if (p_dms[k].type == scons.DmType.PZT):
112 nactu += p_dms[k]._ntotact
115 Xactu = np.zeros(nactu, dtype=np.float64) # X-position actuators in ipupil
116 Yactu = np.zeros(nactu, dtype=np.float64) # Y-position actuators in ipupil
117 k2 = np.zeros(npzt, dtype=np.float64) # k2 factors for computation
118 pitch = np.zeros(npzt, dtype=np.float64)
119 alt_DM = np.zeros(npzt, dtype=np.float64)
122 for k in p_controller.ndm:
123 if (p_dms[k].type == scons.DmType.PZT):
124 p2m = p_tel.diam / p_geom.pupdiam
125 # Conversion in meters in the center of ipupil
126 actu_x = (p_dms[k]._xpos - ipup.shape[0] / 2) * p2m
127 actu_y = (p_dms[k]._ypos - ipup.shape[0] / 2) * p2m
128 pitch[indk] = actu_x[1] - actu_x[0]
129 k2[indk] = p_wfss[0].Lambda / 2. / np.pi / p_dms[k].unitpervolt
130 alt_DM[indk] = p_dms[k].alt
131 Xactu[ind:ind + p_dms[k]._ntotact] = actu_x
132 Yactu[ind:ind + p_dms[k]._ntotact] = actu_y
134 ind += p_dms[k]._ntotact
137 # Select a DM for each layer of atmos
138 NlayersDM = np.zeros(npzt, dtype=np.int64) # Useless for now
139 indlayersDM = selectDMforLayers(p_atmos, p_controller, p_dms)
140 # print("indlayer = ",indlayersDM)
143 # conf.RAD2ARCSEC = 180.0/np.pi * 3600.
144 wfs_distance = np.zeros(len(p_controller.nwfs), dtype=np.float64)
146 for k in p_controller.nwfs:
147 wfs_distance[ind] = np.sqrt(p_wfss[k].xpos**2 + p_wfss[k].ypos**2)
149 FoV = np.max(wfs_distance) / CONST.RAD2ARCSEC
151 # WFS postions in rad
152 alphaX = np.zeros(len(p_controller.nwfs))
153 alphaY = np.zeros(len(p_controller.nwfs))
156 for k in p_controller.nwfs:
157 alphaX[ind] = p_wfss[k].xpos / CONST.RAD2ARCSEC
158 alphaY[ind] = p_wfss[k].ypos / CONST.RAD2ARCSEC
161 L0_d = np.copy(p_atmos.L0).astype(np.float64)
162 frac_d = np.copy(p_atmos.frac * (p_atmos.r0**(-5.0 / 3.0))).astype(np.float64)
164 print("Computing Cphim...")
165 rtc.d_control[ncontrol].compute_Cphim(atmos, wfs, dms, L0_d, frac_d, alphaX, alphaY,
166 X, Y, Xactu, Yactu, p_tel.diam, k2, NlayersDM,
167 indlayersDM, FoV, pitch,
168 alt_DM.astype(np.float64))
171 print("Computing Cmm...")
172 rtc.d_control[ncontrol].compute_Cmm(atmos, wfs, L0_d, frac_d, alphaX, alphaY,
173 p_tel.diam, p_tel.cobs)
176 Nact = np.zeros([nactu, nactu], dtype=np.float32)
177 F = np.zeros([nactu, nactu], dtype=np.float32)
179 for k in range(len(p_controller.ndm)):
180 if (p_dms[k].type == "pzt"):
181 Nact[ind:ind + p_dms[k]._ntotact, ind:ind +
182 p_dms[k]._ntotact] = create_nact_geom(p_dms[k])
183 F[ind:ind + p_dms[k]._ntotact, ind:ind +
184 p_dms[k]._ntotact] = create_piston_filter(p_dms[k])
185 ind += p_dms[k]._ntotact
186 rtc.d_control[ncontrol].filter_cphim(F, Nact)
| def shesha.ao.tomo.selectDMforLayers |
( |
conf.Param_atmos |
p_atmos, |
|
|
conf.Param_controller |
p_controller, |
|
|
list |
p_dms |
|
) |
| |
For each atmos layer, select the DM which have to handle it in the Cphim computation for MV controller.
:parameters:
p_atmos (Param_atmos) : atmos parameters
p_controller (Param_controller) : controller parameters
p_dms :(list of Param_dm) : dms parameters
:return:
indlayersDM (np.array(dtype=np.int32)) : for each atmos layer, the Dm number corresponding to it
Definition at line 203 of file tomo.py.
203 indlayersDM : (np.array(dtype=np.int32)) :
for each atmos layer, the Dm number corresponding to it
205 indlayersDM = np.zeros(p_atmos.nscreens, dtype=np.int64)
206 for i in range(p_atmos.nscreens):
208 for j in p_controller.ndm:
209 alt_diff = np.abs(p_dms[j].alt - p_atmos.alt[i])
210 if (alt_diff < mindif):