COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
PCORONO.py
1 
37 
38 import numpy as np
39 from . import config_setter_utils as csu
40 import shesha.constants as scons
41 
42 
43 
47 
48  def __init__(self):
49  self.__type__type = None # 'custom', 'SPHERE_APLC', or 'perfect'
50  """ Type of coronograph """
51 
52  self.__asterix_parfile__asterix_parfile = None
53  """ ASTERIX parameter file path """
54  self.__asterix_datadir__asterix_datadir = None
55  """ ASTERIX data directory path """
56 
57  self.__wavelength_0__wavelength_0 = None
58  """ Central wavelength in the coronagraph """
59  self.__delta_wav__delta_wav = 0 # optional
60  """ Spectral bandwidth """
61  self.__nb_wav__nb_wav = 1 # optional
62  """ Number of simulated wavelength in the spectral bandwidth """
63  self.__wav_vec__wav_vec = None # unsettable
64  """ Array of simulated wavelengths """
65 
66  self.__apodizer__apodizer = None
67  """ Apodizer pupil """
68  self.__apodizer_name__apodizer_name = None # optional : 'SPHERE_APLC_apodizer_APO1' or 'user_path'
69  """ Apodizer string name or user path """
70 
71  self.__focal_plane_mask__focal_plane_mask = None
72  """ Focal plane mask complex amplitudes """
73  self.__focal_plane_mask_name__focal_plane_mask_name = None # 'classical_Lyot', 'user_path' or 'SPHERE_APLC_fpm_ALC1' (or ALC2 or ALC3)
74  """ Focal plane mask string name or user path """
75  self.__fpm_sampling__fpm_sampling = None # optional
76  """ Size of lambda / D in the fpm plane, in pixel unit """
77  self.__lyot_fpm_radius__lyot_fpm_radius = None
78  """ Focal plane mask radius in lamda / D unit, for a classical Lyot fpm only """
79  self.__dim_fpm__dim_fpm = None
80  """ Size of the focal plane mask in pixel """
81  self.__babinet_trick__babinet_trick = False
82  """ Flag for using Babinet's trick """
83 
84  self.__lyot_stop__lyot_stop = None
85  """ Lyot pupil """
86  self.__lyot_stop_name__lyot_stop_name = None # optional : 'SPHERE_APLC_Lyot_stop' or 'user_path'
87  """ Lyot stop string name or user path """
88 
89  self.__dim_image__dim_image = None
90  """ Size of the science image in pixel """
91  self.__image_sampling__image_sampling = None
92  """ Size of lambda / D in the image plane, in pixel unit """
93 
94 
95  def get_type(self):
96  """ Get the coronograph type
97 
98  :return: (str) : coronograph type
99  """
100  return self.__type__type
101 
102  def set_type(self, t):
103  """ Set the coronograph type
104 
105  Args:
106  t: (str) : coronograph type
107  """
108  self.__type__type = scons.check_enum(scons.CoronoType, t)
109 
110  _type = property(get_type, set_type)
111 
112  def get_asterix_parfile(self):
113  """ Get the path of asterix parfile
114 
115  :return: (str) : asterix parfile path
116  """
117  return self.__asterix_parfile__asterix_parfile
118 
119  def set_asterix_parfile(self, f):
120  """ set the path of asterix parfile
121 
122  :f: (str) : asterix parfile path
123  """
124  self.__asterix_parfile__asterix_parfile = f
125 
126  _asterix_parfile = property(get_asterix_parfile, set_asterix_parfile)
127 
128  def get_asterix_datadir(self):
129  """ Get the path of asterix datadir
130 
131  :return: (str) : asterix datadir path
132  """
133  return self.__asterix_datadir__asterix_datadir
134 
135  def set_asterix_datadir(self, f):
136  """ set the path of asterix datadir
137 
138  :f: (str) : asterix datadir path
139  """
140  self.__asterix_datadir__asterix_datadir = f
141 
142  _asterix_datadir = property(get_asterix_datadir, set_asterix_datadir)
143 
144  def get_wavelength_0(self):
145  """ Get the central wavelength in the coronagraph
146 
147  :return: (float) : central wavelength
148  """
149  return self.__wavelength_0__wavelength_0
150 
151  def set_wavelength_0(self, w):
152  """ Set the central wavelength in the coronagraph
153 
154  :param w: central wavelength
155  """
156  self.__wavelength_0__wavelength_0 = w
157 
158  _wavelength_0 = property(get_wavelength_0, set_wavelength_0)
159 
160  def get_delta_wav(self):
161  """ Get the spectral bandwith
162 
163  :return: (float) : bandwidth
164  """
165  return self.__delta_wav__delta_wav
166 
167  def set_delta_wav(self, w):
168  """ Set the spectral bandwidth
169 
170  :param w: (float) : spectral bandwidth
171  """
172  self.__delta_wav__delta_wav = w
173 
174  _delta_wav = property(get_delta_wav, set_delta_wav)
175 
176  def get_nb_wav(self):
177  """ Get the number of simulated wavelength in the spectral bandwidth
178 
179  :return: (int) : number of wavelengths
180  """
181  return self.__nb_wav__nb_wav
182 
183  def set_nb_wav(self, n):
184  """ Set the number of simulated wavelength in the spectral bandwidth
185 
186  :param n: (int) : number of wavelengths
187  """
188  self.__nb_wav__nb_wav = csu.enforce_int(n)
189 
190  _nb_wav = property(get_nb_wav, set_nb_wav)
191 
192  def get_wav_vec(self):
193  """ Get the wavelengths array
194 
195  :return: (np.ndarray) : wavelengths array
196  """
197  return self.__wav_vec__wav_vec
198 
199  def set_wav_vec(self, w):
200  """ Set the wavelengths array
201 
202  :param w: (np.ndarray) : wavelengths array
203  """
204  self.__wav_vec__wav_vec = w
205 
206  _wav_vec = property(get_wav_vec, set_wav_vec)
207 
208  def get_apodizer(self):
209  """ Get the apodizer pupil
210 
211  :return: (np.ndarray) : apodizer
212  """
213  return self.__apodizer__apodizer
214 
215  def set_apodizer(self, apod):
216  """ Set the apodizer pupil
217 
218  :param apod: (np.ndarray) : apodizer
219  """
220  self.__apodizer__apodizer = apod
221 
222  _apodizer = property(get_apodizer, set_apodizer)
223 
224  def get_apodizer_name(self):
225  """ Get the apodizer keyword or user path
226 
227  :return: (str) : apodizer keyword or path
228  """
229  return self.__apodizer_name__apodizer_name
230 
231  def set_apodizer_name(self, apod):
232  """ Set the apodizer keyword or user path
233 
234  :param apod: (str) : apodizer keyword or path
235  """
236  self.__apodizer_name__apodizer_name = apod
237 
238  _apodizer_name = property(get_apodizer_name, set_apodizer_name)
239 
241  """ Get the focal plane mask complex amplitudes
242 
243  :return: (list of np.ndarray) : focal plane mask
244  """
245  return self.__focal_plane_mask__focal_plane_mask
246 
247  def set_focal_plane_mask(self, fpm):
248  """ Set the focal plane complex amplitudes
249 
250  :param fpm: (list of np.ndarray) : focal plane mask
251  """
252  self.__focal_plane_mask__focal_plane_mask = fpm
253 
254  _focal_plane_mask = property(get_focal_plane_mask, set_focal_plane_mask)
255 
256  def get_focal_plane_mask_name(self):
257  """ Get the focal plane mask keyword or user path
258 
259  :return: (str) : focal plane mask keyword or path
260  """
261  return self.__focal_plane_mask_name__focal_plane_mask_name
262 
263  def set_focal_plane_mask_name(self, fpm):
264  """ Set the focal plane mask keyword or user path
265 
266  :param fpm: (str) : focal plane mask keyword or path
267  """
268  self.__focal_plane_mask_name__focal_plane_mask_name = fpm
269 
270  _focal_plane_mask_name = property(get_focal_plane_mask_name, set_focal_plane_mask_name)
271 
272  def get_fpm_sampling(self):
273  """ Get the sampling in the focal plane mask
274  sampling = size of lambda / D in pixel units
275 
276  :return: (float) : focal plane mask sampling
277  """
278  return self.__fpm_sampling__fpm_sampling
279 
280  def set_fpm_sampling(self, sp):
281  """ Set the sampling in the focal plane mask
282  sampling = size of lambda / D in pixel units
283 
284  :param sp: (float) : focal plane mask sampling
285  """
286  self.__fpm_sampling__fpm_sampling = sp
287 
288  _fpm_sampling = property(get_fpm_sampling, set_fpm_sampling)
289 
291  """ Get the radius of the classical Lyot focal plane mask
292  in lambda / D units
293 
294  :return: (float) : classical Lyot fpm radius
295  """
296  return self.__lyot_fpm_radius__lyot_fpm_radius
297 
298  def set_lyot_fpm_radius(self, r):
299  """ Set the radius of the classical Lyot focal plane mask
300  in lambda / D units
301 
302  :param r: (float) : classical Lyot fpm radius
303  """
304  self.__lyot_fpm_radius__lyot_fpm_radius = r
305 
306  _lyot_fpm_radius = property(get_lyot_fpm_radius, set_lyot_fpm_radius)
307 
308  def get_dim_fpm(self):
309  """ Get the size of the focal plane mask support in pixel units
310 
311  :return: (int) : fpm support size in pixel
312  """
313  return self.__dim_fpm__dim_fpm
314 
315  def set_dim_fpm(self, n):
316  """ Set the size of the focal plane mask support in pixel units
317 
318  :param n: (int) : fpm support size in pixel
319  """
320  self.__dim_fpm__dim_fpm = csu.enforce_int(n)
321 
322  _dim_fpm = property(get_dim_fpm, set_dim_fpm)
323 
324  def get_babinet_trick(self):
325  """ Get the Babinet's trick flag
326 
327  :return: (bool) : Babinet's trick flag
328  """
329  return self.__babinet_trick__babinet_trick
330 
331  def set_babinet_trick(self, b):
332  """ Set the Babinet's trick flag
333 
334  :param b: (bool) : Babinet's trick flag
335  """
336  self.__babinet_trick__babinet_trick = csu.enforce_or_cast_bool(b)
337 
338  _babinet_trick = property(get_babinet_trick, set_babinet_trick)
339 
340  def get_lyot_stop(self):
341  """ Get the Lyot stop pupil
342 
343  :return: (np.ndarray) : Lyot stop pupil
344  """
345  return self.__lyot_stop__lyot_stop
346 
347  def set_lyot_stop(self, ls):
348  """ Set the Lyot stop pupil
349 
350  :param ls: (np.ndarray) : Lyot stop pupil
351  """
352  self.__lyot_stop__lyot_stop = ls
353 
354  _lyot_stop = property(get_lyot_stop, set_lyot_stop)
355 
356  def get_lyot_stop_name(self):
357  """ Get the Lyot stop keyword or user path
358 
359  :return: (str) : Lyot stop keyword or path
360  """
361  return self.__lyot_stop_name__lyot_stop_name
362 
363  def set_lyot_stop_name(self, ls):
364  """ Set the Lyot stop keyword or user path
365 
366  :param ls: (str) : Lyot stop keyword or path
367  """
368  self.__lyot_stop_name__lyot_stop_name = ls
369 
370  _lyot_stop_name = property(get_lyot_stop_name, set_lyot_stop_name)
371 
372  def get_dim_image(self):
373  """ Get the size of the science image in pixel
374 
375  :return: (int) : image size in pixel
376  """
377  return self.__dim_image__dim_image
378 
379  def set_dim_image(self, n):
380  """ Set the size of the science image in pixel
381 
382  :param n: (int) : image size in pixel
383  """
384  self.__dim_image__dim_image = csu.enforce_int(n)
385 
386  _dim_image = property(get_dim_image, set_dim_image)
387 
388  def get_image_sampling(self):
389  """ Get the sampling in the image
390  sampling = size of lambda / D in pixel units
391 
392  :return: (float) : image sampling
393  """
394  return self.__image_sampling__image_sampling
395 
396  def set_image_sampling(self, sp):
397  """ Set the sampling in the image
398  sampling = size of lambda / D in pixel units
399 
400  :param sp: (float) : image sampling
401  """
402  self.__image_sampling__image_sampling = sp
403 
404  _image_sampling = property(get_image_sampling, set_image_sampling)
P-Class (parametres) Param_corono.
Definition: PCORONO.py:46
def get_delta_wav(self)
Get the spectral bandwith.
Definition: PCORONO.py:176
def set_type(self, t)
Set the coronograph type.
Definition: PCORONO.py:107
def set_apodizer_name(self, apod)
Set the apodizer keyword or user path.
Definition: PCORONO.py:259
def set_lyot_stop(self, ls)
Set the Lyot stop pupil.
Definition: PCORONO.py:396
def set_delta_wav(self, w)
Set the spectral bandwidth.
Definition: PCORONO.py:183
def set_apodizer(self, apod)
Set the apodizer pupil.
Definition: PCORONO.py:240
def set_dim_image(self, n)
Set the size of the science image in pixel.
Definition: PCORONO.py:434
def set_lyot_stop_name(self, ls)
Set the Lyot stop keyword or user path.
Definition: PCORONO.py:415
def get_lyot_stop_name(self)
Get the Lyot stop keyword or user path.
Definition: PCORONO.py:408
def set_asterix_datadir(self, f)
set the path of asterix datadir
Definition: PCORONO.py:145
def set_focal_plane_mask(self, fpm)
Set the focal plane complex amplitudes.
Definition: PCORONO.py:278
def get_babinet_trick(self)
Get the Babinet's trick flag.
Definition: PCORONO.py:370
def set_wav_vec(self, w)
Set the wavelengths array.
Definition: PCORONO.py:221
def get_lyot_stop(self)
Get the Lyot stop pupil.
Definition: PCORONO.py:389
def get_focal_plane_mask(self)
Get the focal plane mask complex amplitudes.
Definition: PCORONO.py:271
def get_nb_wav(self)
Get the number of simulated wavelength in the spectral bandwidth.
Definition: PCORONO.py:195
def get_asterix_parfile(self)
Get the path of asterix parfile.
Definition: PCORONO.py:119
def set_fpm_sampling(self, sp)
Set the sampling in the focal plane mask sampling = size of lambda / D in pixel units.
Definition: PCORONO.py:318
def get_fpm_sampling(self)
Get the sampling in the focal plane mask sampling = size of lambda / D in pixel units.
Definition: PCORONO.py:310
def get_dim_image(self)
Get the size of the science image in pixel.
Definition: PCORONO.py:427
def set_focal_plane_mask_name(self, fpm)
Set the focal plane mask keyword or user path.
Definition: PCORONO.py:297
def get_asterix_datadir(self)
Get the path of asterix datadir.
Definition: PCORONO.py:138
def get_focal_plane_mask_name(self)
Get the focal plane mask keyword or user path.
Definition: PCORONO.py:290
def get_type(self)
Get the coronograph type.
Definition: PCORONO.py:99
def set_wavelength_0(self, w)
Set the central wavelength in the coronagraph.
Definition: PCORONO.py:164
def set_babinet_trick(self, b)
Set the Babinet's trick flag.
Definition: PCORONO.py:377
def get_wav_vec(self)
Get the wavelengths array.
Definition: PCORONO.py:214
def get_apodizer_name(self)
Get the apodizer keyword or user path.
Definition: PCORONO.py:252
def get_dim_fpm(self)
Get the size of the focal plane mask support in pixel units.
Definition: PCORONO.py:351
def set_nb_wav(self, n)
Set the number of simulated wavelength in the spectral bandwidth.
Definition: PCORONO.py:202
def get_lyot_fpm_radius(self)
Get the radius of the classical Lyot focal plane mask in lambda / D units.
Definition: PCORONO.py:331
def set_image_sampling(self, sp)
Set the sampling in the image sampling = size of lambda / D in pixel units.
Definition: PCORONO.py:455
def get_image_sampling(self)
Get the sampling in the image sampling = size of lambda / D in pixel units.
Definition: PCORONO.py:447
def get_wavelength_0(self)
Get the central wavelength in the coronagraph.
Definition: PCORONO.py:157
def get_apodizer(self)
Get the apodizer pupil.
Definition: PCORONO.py:233
def set_asterix_parfile(self, f)
set the path of asterix parfile
Definition: PCORONO.py:126
def set_lyot_fpm_radius(self, r)
Set the radius of the classical Lyot focal plane mask in lambda / D units.
Definition: PCORONO.py:339
def set_dim_fpm(self, n)
Set the size of the focal plane mask support in pixel units.
Definition: PCORONO.py:358
Numerical constants for shesha and config enumerations for safe-typing.
Definition: constants.py:1