COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
constants.py
1 
37 
38 import numpy as np
39 from aenum import MultiValueEnum
40 
41 
42 class CONST:
43  RAD2ARCSEC = 3600. * 360. / (2 * np.pi)
44  ARCSEC2RAD = 2. * np.pi / (360. * 3600.)
45  RAD2DEG = 180. / np.pi
46  DEG2RAD = np.pi / 180.
47 
48 
49 def check_enum(cls, name):
50  """
51  Create a safe-type enum instance from bytes contents
52  """
53 
54  if not isinstance(name, str) or \
55  not name in vars(cls).values():
56  raise ValueError("Invalid enumeration value for enum %s, value %s" % (cls, name))
57  return name
58 
59 
60 class DmType:
61  """
62  Types of deformable mirrors
63  """
64 
65  PZT = 'pzt'
66  TT = 'tt'
67  KL = 'kl'
68 
69 
70 class PatternType:
71  """
72  Types of Piezo DM patterns
73  """
74 
75  SQUARE = 'square'
76  HEXA = 'hexa'
77  HEXAM4 = 'hexaM4'
78 
79 
80 class KLType:
81  """
82  Possible KLs for computations
83  """
84 
85  KOLMO = 'kolmo'
86  KARMAN = 'karman'
87 
88 
89 class InfluType:
90  """
91  Influence function types
92  """
93 
94  DEFAULT = 'default'
95  RADIALSCHWARTZ = 'radialSchwartz'
96  SQUARESCHWARTZ = 'squareSchwartz'
97  BLACKNUTT = 'blacknutt'
98  GAUSSIAN = 'gaussian'
99  BESSEL = 'bessel'
100  PETAL = 'petal'
101 
102 
103 class ControllerType:
104  """
105  Controller types
106  """
107 
108  GENERIC = 'generic'
109  GENERIC_LINEAR = 'generic_linear'
110  LS = 'ls'
111  MV = 'mv'
112  CURED = 'cured'
113  GEO = 'geo'
114 
115 
116 class CommandLawType:
117  """
118  Command law types for generic controller only
119  """
120 
121  INTEGRATOR = 'integrator'
122  MODAL_INTEGRATOR = 'modal_integrator'
123  TWO_MATRICES = '2matrices'
124 
125 
126 class CentroiderType:
127  """
128  Centroider types
129  """
130 
131  COG = 'cog'
132  TCOG = 'tcog'
133  WCOG = 'wcog'
134  BPCOG = 'bpcog'
135  CORR = 'corr'
136  PYR = 'pyr'
137  MASKEDPIX = 'maskedpix'
138 
139 
141  MODEL = 'model'
142  GAUSS = 'gauss'
143 
144 
145 class PyrCentroiderMethod:
146  """
147  Pyramid centroider methods
148  Local flux normalization (eq SH quad-cell, ray optics. Ragazzonni 1996)
149  Global flux normalization (Verinaud 2004, most > 2010 Pyr applications)
150  Resulting (A+/-B-/+C-D)/(A+B+C+D) or sin((A+/-B-/+C-D)/(A+B+C+D))
151  ref. code sutra_centroider_pyr.h
152  """
153  NOSINUSGLOBAL = 0
154  SINUSGLOBAL = 1
155  NOSINUSLOCAL = 2
156  SINUSLOCAL = 3
157  OTHER = 4
158 
159 
160 class WFSType:
161  """
162  WFS Types
163  """
164  SH = 'sh'
165  PYRHR = 'pyrhr'
166  PYRLR = 'pyrlr'
167 
168 
169 class TargetImageType:
170  """
171  Target Images
172  """
173 
174  SE = 'se'
175  LE = 'le'
176 
177 
178 class ApertureType:
179  """
180  Telescope apertures
181  """
182  GENERIC = 'Generic'
183  EELT_NOMINAL = 'EELT-Nominal' # Alexis Carlotti method
184  EELT = 'EELT' # E. Gendron method
185  EELT_BP1 = 'EELT-BP1'
186  EELT_BP3 = 'EELT-BP3'
187  EELT_BP5 = 'EELT-BP5'
188  EELT_CUSTOM = 'EELT-Custom'
189  VLT = 'VLT'
190  KECK = 'keck'
191  VLT_NOOBS = 'VLT-NoObs'
192 
193 class SpiderType:
194  """
195  Spiders
196  """
197  FOUR = 'four'
198  SIX = 'six'
199 
200 
201 class ProfType:
202  """
203  Sodium profile for LGS
204  """
205  GAUSS1 = 'Gauss1'
206  GAUSS2 = 'Gauss2'
207  GAUSS3 = 'Gauss3'
208  EXP = 'Exp'
209  MULTIPEAK = 'Multipeak'
210  FILES = dict({
211  GAUSS1: "allProfileNa_withAltitude_1Gaussian.npy",
212  GAUSS2: "allProfileNa_withAltitude_2Gaussian.npy",
213  GAUSS3: "allProfileNa_withAltitude_3Gaussian.npy",
214  EXP: "allProfileNa_withAltitude.npy",
215  MULTIPEAK: "multipeakProfileNa_withAltitude.npy"
216  })
217 
218 
219 class FieldStopType:
220  """
221  WFS field stop
222  """
223  SQUARE = 'square'
224  ROUND = 'round'
225  NONE = 'none'
226 
227 class PupilType(MultiValueEnum):
228  """Compass pupil enumeration
229  """
230  SPUPIL = "spupil", "s"
231  MPUPIL = "mpupil", "m"
232  IPUPIL = "ipupil", "i"
233 
234 class CoronoType:
235  """ Coronograph types
236  """
237  MODULE = "module"
238  PERFECT = "perfect"
239  CUSTOM = "custom"
240  SPHERE_APLC = "SPHERE_APLC"
241 
242 class ApodizerType:
243  """ Apodizer types
244  """
245  SPHERE_APLC_APO1 = "SPHERE_APLC_apodizer_APO1"
246 
247 class FpmType:
248  """ Focal plane mask types
249  """
250  CLASSICAL_LYOT = "classical_Lyot"
251  SPHERE_APLC_fpm_ALC1 = "SPHERE_APLC_fpm_ALC1"
252  SPHERE_APLC_fpm_ALC2 = "SPHERE_APLC_fpm_ALC2"
253  SPHERE_APLC_fpm_ALC3 = "SPHERE_APLC_fpm_ALC3"
254 
255 class LyotStopType:
256  """ Lyot stop types
257  """
258  SPHERE_APLC_LYOT_STOP = "SPHERE_APLC_Lyot_stop"
259 
260 class MftType:
261  """ MFT types
262  """
263  IMG = "img"
264  PSF = "psf"
265  FPM = "fpm"
266  LYOT= "lyot"
267 class ExposureType:
268  """ Exposure type
269  """
270  LE = "le"
271  SE = "se"
Telescope apertures.
Definition: constants.py:181
Command law types for generic controller only.
Definition: constants.py:119
Coronograph types.
Definition: constants.py:236
Types of deformable mirrors.
Definition: constants.py:63
Focal plane mask types.
Definition: constants.py:249
Influence function types.
Definition: constants.py:92
Possible KLs for computations.
Definition: constants.py:83
Types of Piezo DM patterns.
Definition: constants.py:73
Sodium profile for LGS.
Definition: constants.py:204
Compass pupil enumeration.
Definition: constants.py:229
def check_enum(cls, name)
Create a safe-type enum instance from bytes contents.
Definition: constants.py:52