COMPASS  5.0.0
End-to-end AO simulation tool using GPU acceleration
PGEOM.py
1 
37 
38 from . import config_setter_utils as csu
39 import numpy as np
40 
41 
42 
45 class Param_geom:
46 
47  def __init__(self):
48  """ Private members were initialized yet """
49  self.__is_init = False
50  """ linear size of full image (in pixels)."""
51  self.__ssize = 0
52  """ observations zenith angle (in deg)."""
53  self.__zenithangle = 0.
54  """ boolean for apodizer"""
55  self.__apod = False
56  """ File to load an apodizer from """
57  self.__apod_file = None
58  """ linear size of total pupil (in pixels)."""
59  self.__pupdiam = 0
60  """ central point of the simulation."""
61  self.__cent = 0.
62  """ Pixel size of the simulation [meters]."""
63  self.__pixsize = 0.
64 
65  # Internals
66  self.__ipupil = None # total pupil (include full guard band)
67  self.__mpupil = None # medium pupil (part of the guard band)
68  self.__spupil = None # small pupil (without guard band)
69  self.__phase_ab_M1 = None # Phase aberration in the pupil (small size)
70  # Phase aberration in the pupil (medium size)
71  self.__phase_ab_M1_m = None
72  self.__apodizer = None # apodizer (same size as small pupil)
73  self.__p1 = 0 # min x,y for valid points in mpupil
74  self.__p2 = 0 # max x,y for valid points in mpupil
75  self.__n = 0 # linear size of mpupil
76  self.__n1 = 0 # min x,y for valid points in ipupil
77  self.__n2 = 0 # max x,y for valid points in ipupil
78 
79  def get_is_init(self):
80  """ Get the is_init flag
81 
82  :return: (bool) : is_init flag
83  """
84  return self.__is_init
85 
86  def set_is_init(self, i):
87  """ set the is_init flag
88 
89  :param i: (bool) : is_init flag
90  """
91  self.__is_init = csu.enforce_or_cast_bool(i)
92 
93  is_init = property(get_is_init, set_is_init)
94 
95  def get_ipupil(self):
96  """ Get the pupil in the biggest support
97 
98  :return: (np.ndarray[ndim=2, dtype=np.float32]) : pupil
99  """
100  return self.__ipupil
101 
102  def set_ipupil(self, s):
103  """ Set the pupil in the biggest support
104 
105  :param s: (np.ndarray[ndim=2, dtype=np.float32]) : pupil
106  """
107  self.__ipupil = csu.enforce_arrayMultiDim(s.copy(), s.shape, dtype=np.float32)
108 
109  _ipupil = property(get_ipupil, set_ipupil)
110 
111  def get_mpupil(self):
112  """ Get the pupil in the middle support
113 
114  :return: (np.ndarray[ndim=2, dtype=np.float32]) : pupil
115  """
116  return self.__mpupil
117 
118  def set_mpupil(self, s):
119  """ Set the pupil in the middle support
120 
121  :param s: (np.ndarray[ndim=2, dtype=np.float32]) : pupil
122  """
123  self.__mpupil = csu.enforce_arrayMultiDim(s.copy(), s.shape, dtype=np.float32)
124 
125  _mpupil = property(get_mpupil, set_mpupil)
126 
127  def get_spupil(self):
128  """ Get the pupil in the smallest support
129 
130  :return: (np.ndarray[ndim=2, dtype=np.float32]) : pupil
131  """
132  return self.__spupil
133 
134  def set_spupil(self, s):
135  """ Set the pupil in the smallest support
136 
137  :param s: (np.ndarray[ndim=2, dtype=np.float32]) : pupil
138  """
139  self.__spupil = csu.enforce_arrayMultiDim(s.copy(), s.shape, dtype=np.float32)
140 
141  _spupil = property(get_spupil, set_spupil)
142 
143  def get_phase_ab_M1(self):
144  """ Get the phase aberration of the M1 defined in spupil support
145 
146  :return: (np.ndarray[ndim=2, dtype=np.float32]) : phase aberrations
147  """
148  return self.__phase_ab_M1
149 
150  def set_phase_ab_M1(self, s):
151  """ Set the phase aberration of the M1 defined in spupil support
152 
153  :param s: (np.ndarray[ndim=2, dtype=np.float32]) : phase aberrations
154  """
155  self.__phase_ab_M1 = csu.enforce_arrayMultiDim(s.copy(), self.__spupil.shape,
156  dtype=np.float32)
157 
158  _phase_ab_M1 = property(get_phase_ab_M1, set_phase_ab_M1)
159 
160  def get_phase_ab_M1_m(self):
161  """ Get the phase aberration of the M1 defined in mpupil support
162 
163  :return: (np.ndarray[ndim=2, dtype=np.float32]) : phase aberrations
164  """
165  return self.__phase_ab_M1_m
166 
167  def set_phase_ab_M1_m(self, s):
168  """ Set the phase aberration of the M1 defined in mpupil support
169 
170  :param s: (np.ndarray[ndim=2, dtype=np.float32]) : phase aberrations
171  """
172  self.__phase_ab_M1_m = csu.enforce_arrayMultiDim(s.copy(), self.__mpupil.shape,
173  dtype=np.float32)
174 
175  _phase_ab_M1_m = property(get_phase_ab_M1_m, set_phase_ab_M1_m)
176 
177  def get_apodizer(self):
178  """ Get the apodizer defined in spupil support
179 
180  :return: (np.ndarray[ndim=2, dtype=np.float32]) : apodizer
181  """
182  return self.__apodizer
183 
184  def set_apodizer(self, s):
185  """ Set the apodizer defined in spupil support
186 
187  :param s: (np.ndarray[ndim=2, dtype=np.float32]) : apodizer
188  """
189  self.__apodizer = csu.enforce_arrayMultiDim(s.copy(), self.__spupil.shape,
190  dtype=np.float32)
191 
192  _apodizer = property(get_apodizer, set_apodizer)
193 
194  def get_ssize(self):
195  """ Get linear size of full image
196 
197  :return: (long) : linear size of full image (in pixels).
198  """
199  return self.__ssize
200 
201  def set_ssize(self, s):
202  """ Set linear size of full image
203 
204  :param s: (long) : linear size of full image (in pixels).
205  """
206  self.__ssize = csu.enforce_int(s)
207 
208  ssize = property(get_ssize, set_ssize)
209 
210  def get_n(self):
211  """ Get the linear size of mpupil
212 
213  :return: (long) : coordinate (same in x and y) [pixel]
214  """
215  return self.__n
216 
217  def set_n(self, s):
218  """ Set the linear size of mpupil
219 
220  :param s: (long) : coordinate (same in x and y) [pixel]
221  """
222  self.__n = csu.enforce_int(s)
223 
224  _n = property(get_n, set_n)
225 
226  def get_n1(self):
227  """ Get the bottom-left corner coordinates of the pupil in the ipupil support
228 
229  :return: (long) : coordinate (same in x and y) [pixel]
230  """
231  return self.__n1
232 
233  def set_n1(self, s):
234  """ Set the bottom-left corner coordinates of the pupil in the ipupil support
235 
236  :param s: (long) : coordinate (same in x and y) [pixel]
237  """
238  self.__n1 = csu.enforce_int(s)
239 
240  _n1 = property(get_n1, set_n1)
241 
242  def get_n2(self):
243  """ Get the upper-right corner coordinates of the pupil in the ipupil support
244 
245  :return: (long) : coordinate (same in x and y) [pixel]
246  """
247  return self.__n2
248 
249  def set_n2(self, s):
250  """ Set the upper-right corner coordinates of the pupil in the ipupil support
251 
252  :param s: (long) : coordinate (same in x and y) [pixel]
253  """
254  self.__n2 = csu.enforce_int(s)
255 
256  _n2 = property(get_n2, set_n2)
257 
258  def get_p2(self):
259  """ Get the upper-right corner coordinates of the pupil in the mpupil support
260 
261  :return: (long) : coordinate (same in x and y) [pixel]
262  """
263  return self.__p2
264 
265  def set_p2(self, s):
266  """ Set the upper-right corner coordinates of the pupil in the mpupil support
267 
268  :param s: (long) : coordinate (same in x and y) [pixel]
269  """
270  self.__p2 = csu.enforce_int(s)
271 
272  _p2 = property(get_p2, set_p2)
273 
274  def get_p1(self):
275  """ Get the bottom-left corner coordinates of the pupil in the mpupil support
276 
277  :return: (long) : coordinate (same in x and y) [pixel]
278  """
279  return self.__p1
280 
281  def set_p1(self, s):
282  """ Set the bottom-left corner coordinates of the pupil in the mpupil support
283 
284  :param s: (long) : coordinate (same in x and y) [pixel]
285  """
286  self.__p1 = csu.enforce_int(s)
287 
288  _p1 = property(get_p1, set_p1)
289 
290  def get_zenithangle(self):
291  """ Get observations zenith angle
292 
293  :return: (float) : observations zenith angle (in deg).
294  """
295  return self.__zenithangle
296 
297  def set_zenithangle(self, z):
298  """ Set observations zenith angle
299 
300  :param z: (float) : observations zenith angle (in deg).
301  """
302  self.__zenithangle = csu.enforce_float(z)
303 
304  zenithangle = property(get_zenithangle, set_zenithangle)
305 
306  def get_pupdiam(self):
307  """ Get the linear size of total pupil
308 
309  :return: (long) : linear size of total pupil (in pixels).
310  """
311  return self.__pupdiam
312 
313  def set_pupdiam(self, p):
314  """ Set the linear size of total pupil
315 
316  :param p: (long) : linear size of total pupil (in pixels).
317  """
318  self.__pupdiam = csu.enforce_int(p)
319 
320  pupdiam = property(get_pupdiam, set_pupdiam)
321 
322  def get_cent(self):
323  """ Get the central point of the simulation
324 
325  :return: (float) : central point of the simulation.
326  """
327  return self.__cent
328 
329  def set_cent(self, c):
330  """ Set the central point of the simulation
331 
332  :param c: (float) : central point of the simulation.
333  """
334  self.__cent = csu.enforce_float(c)
335 
336  cent = property(get_cent, set_cent)
337 
338  def get_apod(self):
339  """ Gells if the apodizer is used
340  The apodizer is used if a is not 0
341 
342  :return: (int) boolean for apodizer
343  """
344  return self.__apod
345 
346  def set_apod(self, a):
347  """ Tells if the apodizer is used
348  The apodizer is used if a is not 0
349 
350  :param a: (int) boolean for apodizer
351  """
352  self.__apod = csu.enforce_or_cast_bool(a)
353 
354  apod = property(get_apod, set_apod)
355 
356  def get_apod_file(self):
357  """ Get the path of apodizer file
358 
359  :return: (str) : apodizer file name
360  """
361  return self.__apod_file
362 
363  def set_apod_file(self, f):
364  """ Set the path of apodizer file
365 
366  :param filename: (str) : apodizer file name
367  """
368  self.__apod_file = f
369 
370  apod_file = property(get_apod_file, set_apod_file)
371 
372  def get_pixsize(self):
373  """ Get the pixsizeral point of the simulation
374 
375  :return: (float) : pixsizeral point of the simulation.
376  """
377  return self.__pixsize
378 
379  def set_pixsize(self, c):
380  """ Set the pixel size of the simulation
381 
382  :param c: (float) : pixel size of the simulation.
383  """
384  self.__pixsize = csu.enforce_float(c)
385 
386  _pixsize = property(get_pixsize, set_pixsize)
shesha.config.PGEOM.Param_geom.get_phase_ab_M1
def get_phase_ab_M1(self)
Get the phase aberration of the M1 defined in spupil support.
Definition: PGEOM.py:156
shesha.config.PGEOM.Param_geom.set_phase_ab_M1_m
def set_phase_ab_M1_m(self, s)
Set the phase aberration of the M1 defined in mpupil support.
Definition: PGEOM.py:183
shesha.config.PGEOM.Param_geom.__ssize
__ssize
Definition: PGEOM.py:51
shesha.config.PGEOM.Param_geom.set_pupdiam
def set_pupdiam(self, p)
Set the linear size of total pupil.
Definition: PGEOM.py:350
shesha.config.PGEOM.Param_geom.__init__
def __init__(self)
Private members were initialized yet.
Definition: PGEOM.py:48
shesha.config.PGEOM.Param_geom.__apodizer
__apodizer
Definition: PGEOM.py:72
shesha.config.PGEOM.Param_geom.set_apod
def set_apod(self, a)
Tells if the apodizer is used The apodizer is used if a is not 0.
Definition: PGEOM.py:384
shesha.config.PGEOM.Param_geom.get_cent
def get_cent(self)
Get the central point of the simulation.
Definition: PGEOM.py:359
shesha.config.PGEOM.Param_geom.__p1
__p1
Definition: PGEOM.py:73
shesha.config.PGEOM.Param_geom.__n2
__n2
Definition: PGEOM.py:77
shesha.config.PGEOM.Param_geom.get_pixsize
def get_pixsize(self)
Get the pixsizeral point of the simulation.
Definition: PGEOM.py:409
shesha.config.PGEOM.Param_geom.get_is_init
def get_is_init(self)
Get the is_init flag.
Definition: PGEOM.py:83
shesha.config.PGEOM.Param_geom.set_pixsize
def set_pixsize(self, c)
Set the pixel size of the simulation.
Definition: PGEOM.py:416
shesha.config.PGEOM.Param_geom.get_ipupil
def get_ipupil(self)
Get the pupil in the biggest support.
Definition: PGEOM.py:99
shesha.config.PGEOM.Param_geom.__ipupil
__ipupil
Definition: PGEOM.py:66
shesha.config.PGEOM.Param_geom.get_apod_file
def get_apod_file(self)
Get the path of apodizer file.
Definition: PGEOM.py:393
shesha.config.PGEOM.Param_geom.get_n
def get_n(self)
Get the linear size of mpupil.
Definition: PGEOM.py:232
shesha.config.PGEOM.Param_geom.set_cent
def set_cent(self, c)
Set the central point of the simulation.
Definition: PGEOM.py:366
shesha.config.PGEOM.Param_geom.__apod_file
__apod_file
Definition: PGEOM.py:57
shesha.config.PGEOM.Param_geom.__spupil
__spupil
Definition: PGEOM.py:68
shesha.config.PGEOM.Param_geom.__zenithangle
__zenithangle
Definition: PGEOM.py:53
shesha.config.PGEOM.Param_geom
P-Class (parametres) Param_geom.
Definition: PGEOM.py:45
shesha.config.PGEOM.Param_geom.__apod
__apod
Definition: PGEOM.py:55
shesha.config.PGEOM.Param_geom.__phase_ab_M1
__phase_ab_M1
Definition: PGEOM.py:69
shesha.config.PGEOM.Param_geom.get_zenithangle
def get_zenithangle(self)
Get observations zenith angle.
Definition: PGEOM.py:327
shesha.config.PGEOM.Param_geom.get_n2
def get_n2(self)
Get the upper-right corner coordinates of the pupil in the ipupil support.
Definition: PGEOM.py:270
shesha.config.PGEOM.Param_geom.get_p2
def get_p2(self)
Get the upper-right corner coordinates of the pupil in the mpupil support.
Definition: PGEOM.py:289
shesha.config.PGEOM.Param_geom.__cent
__cent
Definition: PGEOM.py:61
shesha.config.PGEOM.Param_geom.__pixsize
__pixsize
Definition: PGEOM.py:63
shesha.config.PGEOM.Param_geom.get_apodizer
def get_apodizer(self)
Get the apodizer defined in spupil support.
Definition: PGEOM.py:196
shesha.config.PGEOM.Param_geom.__is_init
__is_init
Definition: PGEOM.py:49
shesha.config.PGEOM.Param_geom.__p2
__p2
Definition: PGEOM.py:74
shesha.config.PGEOM.Param_geom.set_zenithangle
def set_zenithangle(self, z)
Set observations zenith angle.
Definition: PGEOM.py:334
shesha.config.PGEOM.Param_geom.set_ssize
def set_ssize(self, s)
Set linear size of full image.
Definition: PGEOM.py:223
shesha.config.PGEOM.Param_geom.get_ssize
def get_ssize(self)
Get linear size of full image.
Definition: PGEOM.py:216
shesha.config.PGEOM.Param_geom.set_phase_ab_M1
def set_phase_ab_M1(self, s)
Set the phase aberration of the M1 defined in spupil support.
Definition: PGEOM.py:163
shesha.config.PGEOM.Param_geom.set_spupil
def set_spupil(self, s)
Set the pupil in the smallest support.
Definition: PGEOM.py:144
shesha.config.PGEOM.Param_geom.get_spupil
def get_spupil(self)
Get the pupil in the smallest support.
Definition: PGEOM.py:137
shesha.config.PGEOM.Param_geom.__phase_ab_M1_m
__phase_ab_M1_m
Definition: PGEOM.py:71
shesha.config.PGEOM.Param_geom.set_apod_file
def set_apod_file(self, f)
Set the path of apodizer file.
Definition: PGEOM.py:400
shesha.config.PGEOM.Param_geom.set_n1
def set_n1(self, s)
Set the bottom-left corner coordinates of the pupil in the ipupil support.
Definition: PGEOM.py:258
shesha.config.PGEOM.Param_geom.get_p1
def get_p1(self)
Get the bottom-left corner coordinates of the pupil in the mpupil support.
Definition: PGEOM.py:308
shesha.config.PGEOM.Param_geom.get_n1
def get_n1(self)
Get the bottom-left corner coordinates of the pupil in the ipupil support.
Definition: PGEOM.py:251
shesha.config.PGEOM.Param_geom.__n1
__n1
Definition: PGEOM.py:76
shesha.config.PGEOM.Param_geom.set_apodizer
def set_apodizer(self, s)
Set the apodizer defined in spupil support.
Definition: PGEOM.py:203
shesha.config.PGEOM.Param_geom.get_mpupil
def get_mpupil(self)
Get the pupil in the middle support.
Definition: PGEOM.py:118
shesha.config.PGEOM.Param_geom.get_phase_ab_M1_m
def get_phase_ab_M1_m(self)
Get the phase aberration of the M1 defined in mpupil support.
Definition: PGEOM.py:176
shesha.config.PGEOM.Param_geom.set_p2
def set_p2(self, s)
Set the upper-right corner coordinates of the pupil in the mpupil support.
Definition: PGEOM.py:296
shesha.config.PGEOM.Param_geom.__mpupil
__mpupil
Definition: PGEOM.py:67
shesha.config.PGEOM.Param_geom.set_n
def set_n(self, s)
Set the linear size of mpupil.
Definition: PGEOM.py:239
shesha.config.PGEOM.Param_geom.set_ipupil
def set_ipupil(self, s)
Set the pupil in the biggest support.
Definition: PGEOM.py:106
shesha.config.PGEOM.Param_geom.set_n2
def set_n2(self, s)
Set the upper-right corner coordinates of the pupil in the ipupil support.
Definition: PGEOM.py:277
shesha.config.PGEOM.Param_geom.set_is_init
def set_is_init(self, i)
set the is_init flag
Definition: PGEOM.py:90
shesha.config.PGEOM.Param_geom.get_apod
def get_apod(self)
Gells if the apodizer is used The apodizer is used if a is not 0.
Definition: PGEOM.py:376
shesha.config.PGEOM.Param_geom.__pupdiam
__pupdiam
Definition: PGEOM.py:59
shesha.config.PGEOM.Param_geom.__n
__n
Definition: PGEOM.py:75
shesha.config.PGEOM.Param_geom.get_pupdiam
def get_pupdiam(self)
Get the linear size of total pupil.
Definition: PGEOM.py:343
shesha.config.PGEOM.Param_geom.set_p1
def set_p1(self, s)
Set the bottom-left corner coordinates of the pupil in the mpupil support.
Definition: PGEOM.py:315
shesha.config.PGEOM.Param_geom.set_mpupil
def set_mpupil(self, s)
Set the pupil in the middle support.
Definition: PGEOM.py:125