![]() |
COMPASS
5.4.4
End-to-end AO simulation tool using GPU acceleration
|
Utilities function for DM geometry initialization. More...
Functions | |
def | dim_dm_support (float cent, int extent, int ssize) |
Compute the DM support dimensions. More... | |
def | dim_dm_patch (int pupdiam, float diam, bytes type, float alt, List[float] xpos_wfs, List[float] ypos_wfs) |
compute patchDiam for DM More... | |
def | createSquarePattern (float pitch, int nxact) |
Creates a list of M=nxact^2 actuator positions spread over an square grid. More... | |
def | createHexaPattern (float pitch, int supportSize) |
Creates a list of M actuator positions spread over an hexagonal grid. More... | |
def | createDoubleHexaPattern (float pitch, int supportSize, float pupAngleDegree) |
Creates a list of M actuator positions spread over an hexagonal grid. More... | |
np.ndarray | filterActuWithPupil (np.ndarray actuPos, np.ndarray pupil, float threshold) |
Select actuators based on their distance to the nearest pupil pixel The implementation proposed here is easy but limits it precision to an integer roundoff of the threshold. More... | |
def | select_actuators (np.ndarray xc, np.ndarray yc, int nxact, int pitch, float cobs, float margin_in, float margin_out, N=None) |
Select the "valid" actuators according to the system geometry. More... | |
def | make_zernike (int nzer, int size, int diameter, xc=-1., yc=-1., ext=0) |
Compute the zernike modes. More... | |
def | zernumero (int zn) |
Returns the radial degree and the azimuthal number of zernike number zn, according to Noll numbering (Noll, JOSA, 1976) More... | |
def | add_doc_content (*content) |
adds content to a docstring (to be used as decorator) More... | |
def | write_dm_custom_fits (file_name, i1, j1, influ_cube, xpos, ypos, xcenter, ycenter, pixsize, pupm, *pitchm=None) |
Write a custom_dm fits file based on user provided data (see args) More... | |
def | export_custom_dm (file_name, p_dm, p_geom, *p_tel=None) |
Return an HDUList (FITS) with the data required to create a COMPASS custom_dm. More... | |
Utilities function for DM geometry initialization.
This file is part of COMPASS https://anr-compass.github.io/compass/
Copyright (C) 2011-2023 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.util.dm_util.add_doc_content | ( | * | content | ) |
adds content to a docstring (to be used as decorator)
Definition at line 437 of file dm_util.py.
def shesha.util.dm_util.createDoubleHexaPattern | ( | float | pitch, |
int | supportSize, | ||
float | pupAngleDegree | ||
) |
Creates a list of M actuator positions spread over an hexagonal grid.
The number M is the number of points of this grid, it cannot be known before the procedure is called. Coordinates are centred around (0,0). The support of the grid is a square [-supportSize/2,vsupportSize/2].
pitch | (float) : distance in pixels between 2 adjacent actus |
supportSize | (int) : size in pixels of the support over which the coordinate list should be returned. |
pupAngleDegree | (float) : Rotation angle of the DM |
:return:
xy | (np.ndarray(dims=2,dtype=np.float32)) : xy[2,M] list of coodinates |
Definition at line 180 of file dm_util.py.
def shesha.util.dm_util.createHexaPattern | ( | float | pitch, |
int | supportSize | ||
) |
Creates a list of M actuator positions spread over an hexagonal grid.
The number M is the number of points of this grid, it cannot be known before the procedure is called. Coordinates are centred around (0,0). The support that limits the grid is a square [-supportSize/2, supportSize/2].
pitch | (float) : distance in pixels between 2 adjacent actus |
supportSize | (int) : size in pixels of the support over which the coordinate list should be returned. |
:return:
xy | (np.ndarray(dims=2,dtype=np.float32)) : xy[2,M] list of coordinates |
Definition at line 146 of file dm_util.py.
def shesha.util.dm_util.createSquarePattern | ( | float | pitch, |
int | nxact | ||
) |
Creates a list of M=nxact^2 actuator positions spread over an square grid.
Coordinates are centred around (0,0).
pitch | (float) : distance in pixels between 2 adjacent actus |
nxact | (int) : number of actu across the pupil diameter |
:return:
xy | (np.ndarray(dims=2,dtype=np.float32)) : xy[M,2] list of coodinates |
Definition at line 120 of file dm_util.py.
def shesha.util.dm_util.dim_dm_patch | ( | int | pupdiam, |
float | diam, | ||
bytes | type, | ||
float | alt, | ||
List[float] | xpos_wfs, | ||
List[float] | ypos_wfs | ||
) |
compute patchDiam for DM
pupdiam | (int) : pupil diameter |
diam | (float) : telescope diameter |
type | (bytes) : type of dm |
alt | (float) : altitude of dm |
xpos_wfs | (list) : list of wfs xpos |
ypos_wfs | (list) : list of wfs ypos |
Definition at line 86 of file dm_util.py.
def shesha.util.dm_util.dim_dm_support | ( | float | cent, |
int | extent, | ||
int | ssize | ||
) |
Compute the DM support dimensions.
cent | (float): center of the pupil |
extent | (float): size of the DM support |
ssize | (int): size of ipupil support |
Definition at line 59 of file dm_util.py.
def shesha.util.dm_util.export_custom_dm | ( | file_name, | |
p_dm, | |||
p_geom, | |||
* | p_tel = None |
||
) |
Return an HDUList (FITS) with the data required to create a COMPASS custom_dm.
p_dm | (Param_dm) : dm settings |
p_geom | (Param_geom) : geometry settings |
file_name | (string) : if set, the HDU is written to the file specified by this variable |
p_tel | (Param_tel) : telescope settings, used to provide the diameter (if not provided, the default diameter id obtained from the p_geom as pupdiam*pixsize) |
Definition at line 515 of file dm_util.py.
np.ndarray shesha.util.dm_util.filterActuWithPupil | ( | np.ndarray | actuPos, |
np.ndarray | pupil, | ||
float | threshold | ||
) |
Select actuators based on their distance to the nearest pupil pixel The implementation proposed here is easy but limits it precision to an integer roundoff of the threshold.
actuPos 2 x nActu np.array[float]: actuator position list - pupil pixel units pupil nPup x nPup np.ndarray[bool]: pupil mask threshold float: max allowed distance - pupil pixel units
Definition at line 235 of file dm_util.py.
def shesha.util.dm_util.make_zernike | ( | int | nzer, |
int | size, | ||
int | diameter, | ||
xc = -1. , |
|||
yc = -1. , |
|||
ext = 0 |
|||
) |
Compute the zernike modes.
nzer | (int) : number of modes |
size | (int) : size of the screen |
diameter | (int) : pupil diameter |
xc | (float) : (optional) x-position of the center |
yc | (float) : (optional) y-position of the center |
ext | (int) : (optional) extension |
:return:
z | (np.ndarray(ndims=3,dtype=np.float64)) : zernikes modes |
Definition at line 324 of file dm_util.py.
def shesha.util.dm_util.select_actuators | ( | np.ndarray | xc, |
np.ndarray | yc, | ||
int | nxact, | ||
int | pitch, | ||
float | cobs, | ||
float | margin_in, | ||
float | margin_out, | ||
N = None |
|||
) |
Select the "valid" actuators according to the system geometry.
xc | actuators x positions (origine in center of mirror) |
yc | actuators y positions (origine in center of mirror) nxact: pitch: cobs: margin_in: margin_out: |
:return:
liste_fin actuator indice selection for xpos/ypos
Definition at line 276 of file dm_util.py.
def shesha.util.dm_util.write_dm_custom_fits | ( | file_name, | |
i1, | |||
j1, | |||
influ_cube, | |||
xpos, | |||
ypos, | |||
xcenter, | |||
ycenter, | |||
pixsize, | |||
pupm, | |||
* | pitchm = None |
||
) |
Write a custom_dm fits file based on user provided data (see args)
file_name | (string) : name of the custom dm fits file |
i1 | (np.ndarray) : x coordinate of the first pixel for each of the 2D maps |
j1 | (np.ndarray) : y coordinate of the first pixel for each of the 2D maps |
influ_cube | (np.ndarray) : 2D maps of the influence functions |
xpos | (np.ndarray) : x coordinate of the physical location of the actuator |
ypos | (np.ndarray) : y coordinate of the physical location of the actuator |
xcenter | (float) : x coordinate of the centre of the pupil, expressed in pixels |
ycenter | (float) : y coordinate of the centre of the pupil, expressed in pixels |
pixsize | (float) : size of the pixels on the maps in meters |
pupm | (float) : diameter of pupil stop (meters) |
pitchm | (float) : size of the DM pitch in meters. Defaults to None. |
Definition at line 472 of file dm_util.py.
def shesha.util.dm_util.zernumero | ( | int | zn | ) |
Returns the radial degree and the azimuthal number of zernike number zn, according to Noll numbering (Noll, JOSA, 1976)
zn | (int) : zernike number |
:returns:
rd | (int) : radial degrees |
an | (int) : azimuthal numbers |
Definition at line 402 of file dm_util.py.