COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
shesha.util.make_pupil Namespace Reference

Pupil creation functions. More...

Functions

def make_pupil (dim, pupd, tel, xc=-1, yc=-1, real=0, halfSpider=False)
 Initialize the system pupil. More...
 
def make_pupil_generic (dim, pupd, t_spiders=0.01, spiders_type=SpiderType.SIX, xc=0, yc=0, real=0, cobs=0)
 Initialize the system pupil. More...
 
def make_VLT (dim, pupd, tel)
 Initialize the VLT pupil. More...
 
def make_EELT (dim, pupd, tel, N_seg=-1)
 Initialize the EELT pupil. More...
 
def make_phase_ab (dim, pupd, tel, pup=None, xc=-1, yc=-1, real=0, halfSpider=False)
 Compute the EELT M1 phase aberration. More...
 
def generateEeltPupilMask (npt, dspider, i0, j0, pixscale, gap, rotdegree, D=40.0, cobs=0, centerMark=0, halfSpider=False, pitch=1.244683637214, nseg=33, inner_rad=4.1, outer_rad=15.4, R=95.7853, nominalD=40, half_seg=0.75, refl=None, rotSpiderDegree=None, nmissing=0)
 Generates a boolean pupil mask of the binary EELT pupil on a map of size (npt, npt). More...
 
def fillPolygon (x, y, i0, j0, scale, gap, N, index=0)
 From a list of points defined by their 2 coordinates list x and y, creates a filled polygon with sides joining the points. More...
 
def compute6Segments (pupNoSpiders, N, pixscale, dspider, i0, j0, rot=0)
 
def compute1Spider (nspider, N, dspider, i0, j0, scale, rot)
 Fonction de fab pour creer le slaving. More...
 
def fillSpider (N, nspider, dspider, i0, j0, scale, rot)
 Creates a boolean spider mask on a map of dimensions (N,N) The spider is centred at floating-point coords (i0,j0). More...
 
def fillHalfSpider (N, nspider, dspider, i0, j0, scale, rot)
 
def createHexaPattern (pitch, supportSize)
 Cree une liste de coordonnees qui decrit un maillage hexagonal. More...
 
def generateCoordSegments (D, rot, pitch=1.244683637214, nseg=33, inner_rad=4.1, outer_rad=15.4, R=95.7853, nominalD=40)
 Computes the coordinates of the corners of all the hexagonal segments of M1. More...
 
def gendron ()
 La fonction est appelee quand l'utilisateur a demande une pupille ELT, et renseigne un diametre de telescope different de 40 metres. More...
 
def reorganizeSegmentsOrderESO (x, y)
 Reorganisation des segments facon ESO. More...
 
def getdatatype (truc)
 Returns the data type of a numpy variable, either scalar value or array. More...
 
def generateSegmentProperties (attribute, hx, hy, i0, j0, scale, gap, N, D, softGap=0, nominalD=40, pitch=1.244683637214, half_seg=0.75)
 Builds a 2D image of the pupil with some attributes for each of the segments. More...
 
def centrePourVidal (N, i0, j0, centerMark)
 Renvoie une image de boolens (False) de taille (N,N) avec un point ou une croix (True) centree sur (i0, j0). More...
 

Variables

string EELT_data = os.environ.get('SHESHA_ROOT') + "/data/apertures/"
 

Detailed Description

Pupil creation functions.

Author
COMPASS Team https://github.com/ANR-COMPASS
Version
5.4.4
Date
2022/01/24

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.

Function Documentation

◆ centrePourVidal()

def shesha.util.make_pupil.centrePourVidal (   N,
  i0,
  j0,
  centerMark 
)

Renvoie une image de boolens (False) de taille (N,N) avec un point ou une croix (True) centree sur (i0, j0).

Parameters
Nint taille de l'image de sortie
j0float i0, position du marqueur de sortie
centerMarkint 0 (pour rien), 1 (option point) ou 2 (option croix)

Definition at line 1155 of file make_pupil.py.

Here is the caller graph for this function:

◆ compute1Spider()

def shesha.util.make_pupil.compute1Spider (   nspider,
  N,
  dspider,
  i0,
  j0,
  scale,
  rot 
)

Fonction de fab pour creer le slaving.

La fonction cree un tableau de booleens avec une seule spider. Utilisee par la fonction compute6Segments()

Definition at line 781 of file make_pupil.py.

Here is the caller graph for this function:

◆ compute6Segments()

def shesha.util.make_pupil.compute6Segments (   pupNoSpiders,
  N,
  pixscale,
  dspider,
  i0,
  j0,
  rot = 0 
)
N = p_geom.pupdiam
i0 = j0 = N / 2. - 0.5
D = p_tel.diam
pixscale = D/N
dspider = 0.51

Utilisee dans compass/shesha/shesha/supervisor/canapassSupervisor.py pour le slaving des actus.

Definition at line 748 of file make_pupil.py.

Here is the call graph for this function:

◆ createHexaPattern()

def shesha.util.make_pupil.createHexaPattern (   pitch,
  supportSize 
)

Cree une liste de coordonnees qui decrit un maillage hexagonal.

Retourne un tuple (x,y).

Le maillage est centre sur 0, l'un des points est (0,0). Une des pointes de l'hexagone est dirigee selon l'axe Y, au sens ou le tuple de sortie est (x,y).

Parameters
pitchfloat distance between 2 neighbour points
supportSizeint size of the support that need to be populated

Definition at line 848 of file make_pupil.py.

Here is the caller graph for this function:

◆ fillHalfSpider()

def shesha.util.make_pupil.fillHalfSpider (   N,
  nspider,
  dspider,
  i0,
  j0,
  scale,
  rot 
)

Definition at line 819 of file make_pupil.py.

Here is the caller graph for this function:

◆ fillPolygon()

def shesha.util.make_pupil.fillPolygon (   x,
  y,
  i0,
  j0,
  scale,
  gap,
  N,
  index = 0 
)

From a list of points defined by their 2 coordinates list x and y, creates a filled polygon with sides joining the points.

The polygon is created in an image of size (N, N). The origin (x,y)=(0,0) is mapped at pixel i0, j0 (both can be floating-point values). Arrays x and y are supposed to be in unit U, and scale is the pixel size in U units.

Returns
s filled polygon (N, N), boolean
Parameters
yfloat x, list of points defining the polygon
j0float i0, index of pixels where the pupil should be centred. Can be floating-point indexes.
scalefloat size of a pixel of the image, in same unit as x and y.
Nfloat size of output image.
:Example:
x = np.array([1,-1,-1.5,0,1.1])
y = np.array([1,1.5,-0.2,-2,0])
N = 200
i0 = N/2
j0 = N/2
gap = 0.
scale = 0.03
pol = fillPolygon(x, y, i0, j0, scale, gap, N, index=2)

Definition at line 661 of file make_pupil.py.

Here is the caller graph for this function:

◆ fillSpider()

def shesha.util.make_pupil.fillSpider (   N,
  nspider,
  dspider,
  i0,
  j0,
  scale,
  rot 
)

Creates a boolean spider mask on a map of dimensions (N,N) The spider is centred at floating-point coords (i0,j0).

Returns
s spider image (boolean)
Parameters
Nint size of output image
nspiderint number of spiders
dspiderfloat width of spiders
i0float coord of spiders symmetry centre
j0float coord of spiders symmetry centre
scalefloat size of a pixel in same unit as dspider
rotfloat rotation angle in radians

Definition at line 807 of file make_pupil.py.

Here is the caller graph for this function:

◆ gendron()

def shesha.util.make_pupil.gendron ( )

La fonction est appelee quand l'utilisateur a demande une pupille ELT, et renseigne un diametre de telescope different de 40 metres.

Faut vraiment que je commente ou t'as compris ??

Definition at line 948 of file make_pupil.py.

◆ generateCoordSegments()

def shesha.util.make_pupil.generateCoordSegments (   D,
  rot,
  pitch = 1.244683637214,
  nseg = 33,
  inner_rad = 4.1,
  outer_rad = 15.4,
  R = 95.7853,
  nominalD = 40 
)

Computes the coordinates of the corners of all the hexagonal segments of M1.

Result is a tuple of arrays(6, 798).

Parameters
D(float) : pupil diameter in meters (it must be set to 40.0 m for the ELT)
rot(float) : pupil rotation angle in radians
pitch(float): Segment pitch [meters]
nseg(int) : number of segments across the diameter
inner_rad(float): Inner radius [meters]
outer_rad(float): Outer radius [meters]
R(float): Curvature radius of the M1
nominalD(float): diameter for nominal pupil

Definition at line 885 of file make_pupil.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateEeltPupilMask()

def shesha.util.make_pupil.generateEeltPupilMask (   npt,
  dspider,
  i0,
  j0,
  pixscale,
  gap,
  rotdegree,
  D = 40.0,
  cobs = 0,
  centerMark = 0,
  halfSpider = False,
  pitch = 1.244683637214,
  nseg = 33,
  inner_rad = 4.1,
  outer_rad = 15.4,
  R = 95.7853,
  nominalD = 40,
  half_seg = 0.75,
  refl = None,
  rotSpiderDegree = None,
  nmissing = 0 
)

Generates a boolean pupil mask of the binary EELT pupil on a map of size (npt, npt).

Returns
s pupil image (npt, npt), boolean
Parameters
nptint size of the output array
dspiderfloat width of spiders in meters
j0float i0, index of pixels where the pupil should be centred = p_geom.pupdiam / 2. - 0.5 Can be floating-point indexes.
pixscalefloat size of a pixel of the image, in meters = ptel.diam/(p_geom.pupdiam / 2. - 0.5)
gapfloat gap between 2 segments in metres
rotdegreefloat rotation angle of the pupil, in degrees.
Dfloat diameter of the pupil. For the nominal EELT, D shall be set to 40.0
centerMarkint when centerMark!=0, a pixel is added at the centre of symmetry of the pupil in order to debug things using compass. centerMark==1 draws a point centerMark==2 draws 2 lines
halfSpiderbool half Spider computation flag
pitchfloat segment pitch
nsegint number of segments across the diameter
inner_radfloat Inner radius [meters]
outter_radfloat outter radius [meters]
Rfloat M1 curvature radius
nominalDfloat diameter needed to get nominal aperture after projection
half_segfloat segment half size
reflfloat std of the reflectivity of each segment
:Example:
npt = p_geom.pupdiam
D = p_tel.diam
i0 = npt / 2. - 0.5
j0 = npt / 2. - 0.5
rotdegree = 0.
pixscale = D/(npt / 2. - 0.5)
dspider = 0.51
gap = 0.0
pup = generateEeltPupilMask(npt, dspider, i0, j0, pixscale, gap, rotdegree)

Definition at line 552 of file make_pupil.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateSegmentProperties()

def shesha.util.make_pupil.generateSegmentProperties (   attribute,
  hx,
  hy,
  i0,
  j0,
  scale,
  gap,
  N,
  D,
  softGap = 0,
  nominalD = 40,
  pitch = 1.244683637214,
  half_seg = 0.75 
)

Builds a 2D image of the pupil with some attributes for each of the segments.

Those segments are described from arguments hx and hy, that are produced by the function generateCoordSegments(D, rot).

When attribute is a phase, then it must be a float array of dimension [3, 798] with the dimension 3 being piston, tip, and tilt. Units of phase is xxx rms, and the output of the procedure will be in units of xxx.

Returns
s pupil image (N, N), with the same type of input argument attribute
Parameters
attributefloat/int/bool scalar value or 1D-array of the reflectivity of the segments or 2D array of phase If attribute is scalar, the value will be replicated for all segments. If attribute is a 1D array, then it shall contain the reflectivities of all segments. If attribute is a 2D array then it shall contain the piston, tip and tilt of the segments. The array shall be of dimension [3, 798] that contains [piston, tip, tilt] On output, the data type of the pupil map will be the same as attribute.
hyfloat hx, arrays [6,:] describing the segment shapes. They are generated using generateCoordSegments()
dspiderfloat width of spiders in meters
j0float i0, index of pixels where the pupil should be centred. Can be floating-point indexes.
scalefloat size of a pixel of the image, in meters.
gapfloat half-space between segments in meters
Nint size of the output array (N,N)
Dfloat diameter of the pupil. For the nominal EELT, D shall be set to 40.0
softGapbool if False, the gap between segments is binary 0/1 depending if the pixel is within the gap or not. If True, the gap is a smooth region of a fwhm of 2 pixels with a depth related to the gap width.
nominalDfloat diameter needed to get nominal pupil aperture
pitchfloat segment pitch
half_segfloat segment half size
attribute = np.ones(798)+np.random.randn(798)/20.
N = 800
i0 = N/2
j0 = N/2
rotdegree = 0.0
scale = 41./N
gap = 0.03

Definition at line 1073 of file make_pupil.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdatatype()

def shesha.util.make_pupil.getdatatype (   truc)

Returns the data type of a numpy variable, either scalar value or array.

Definition at line 1013 of file make_pupil.py.

Here is the caller graph for this function:

◆ make_EELT()

def shesha.util.make_pupil.make_EELT (   dim,
  pupd,
  tel,
  N_seg = -1 
)

Initialize the EELT pupil.

Parameters
dim(long) : linear size of ???
pupd(long) : linear size of total pupil
tel(Param_tel) : Telescope structure
N_seg(int)
TODOcomplete
TODOadd force rescal pup elt

Definition at line 265 of file make_pupil.py.

Here is the caller graph for this function:

◆ make_phase_ab()

def shesha.util.make_pupil.make_phase_ab (   dim,
  pupd,
  tel,
  pup = None,
  xc = -1,
  yc = -1,
  real = 0,
  halfSpider = False 
)

Compute the EELT M1 phase aberration.

Parameters
dim(long) : linear size of ???
pupd(long) : linear size of total pupil
tel(Param_tel) : Telescope structure
pup(?)
TODOcomplete

Definition at line 386 of file make_pupil.py.

Here is the call graph for this function:

◆ make_pupil()

def shesha.util.make_pupil.make_pupil (   dim,
  pupd,
  tel,
  xc = -1,
  yc = -1,
  real = 0,
  halfSpider = False 
)

Initialize the system pupil.

Parameters
dim(long) : = p_geom.pupdiam
pupd(long) : linear size of total pupil = p_geom.pupdiam
tel(Param_tel) : Telescope structure
xc(int) = p_geom.pupdiam / 2. - 0.5
yc(int) = p_geom.pupdiam / 2. - 0.5
real(int)
TODOcomplete

Definition at line 68 of file make_pupil.py.

Here is the call graph for this function:

◆ make_pupil_generic()

def shesha.util.make_pupil.make_pupil_generic (   dim,
  pupd,
  t_spiders = 0.01,
  spiders_type = SpiderType.SIX,
  xc = 0,
  yc = 0,
  real = 0,
  cobs = 0 
)

Initialize the system pupil.

Parameters
dim(long) : linear size of ???
pupd(long) : linear size of total pupil
t_spiders(float) : secondary supports ratio.
spiders_type(str) : secondary supports type: "four" or "six".
xc(int)
yc(int)
real(int)
cobs(float) : central obstruction ratio.
TODOcomplete

Definition at line 147 of file make_pupil.py.

Here is the caller graph for this function:

◆ make_VLT()

def shesha.util.make_pupil.make_VLT (   dim,
  pupd,
  tel 
)

Initialize the VLT pupil.

Parameters
dim(long) : linear size of ???
pupd(long) : linear size of total pupil
tel(Param_tel) : Telescope structure

Definition at line 218 of file make_pupil.py.

Here is the caller graph for this function:

◆ reorganizeSegmentsOrderESO()

def shesha.util.make_pupil.reorganizeSegmentsOrderESO (   x,
  y 
)

Reorganisation des segments facon ESO.

Voir ESO-193058 Standard Coordinate System and Basic Conventions

Parameters
xfloat tableau des centres X des segments
yfloat idem Y
Returns
tuple (x,y) meme tuple que les arguments d'entree, mais tries.

Definition at line 989 of file make_pupil.py.

Here is the caller graph for this function:

Variable Documentation

◆ EELT_data

string shesha.util.make_pupil.EELT_data = os.environ.get('SHESHA_ROOT') + "/data/apertures/"

Definition at line 47 of file make_pupil.py.