|
def | __init__ (self, SR=np.zeros((0, 0)), radius=0, wl=0, NGS=None, LGS=None, TS=None, AOtype="AO", sup=None, filename=None) |
| SR_map class. More...
|
|
def | setNGS (self, NGS, NGSy=None) |
|
def | setLGS (self, LGS, LGSy=None) |
|
def | setTS (self, TS, TSy=None) |
|
def | setWaveLength (self, wl) |
|
def | plot (self, title=False, GS=False, WFS=False, LGS=False, NGS=False, TS=False) |
|
def | save (self, name="") |
|
def | read (self, name) |
|
Definition at line 45 of file psfMap.py.
◆ __init__()
def shesha.util.psfMap.PSF_map.__init__ |
( |
|
self, |
|
|
|
SR = np.zeros((0, 0)) , |
|
|
|
radius = 0 , |
|
|
|
wl = 0 , |
|
|
|
NGS = None , |
|
|
|
LGS = None , |
|
|
|
TS = None , |
|
|
|
AOtype = "AO" , |
|
|
|
sup = None , |
|
|
|
filename = None |
|
) |
| |
SR_map class.
SR np.ndarray : array of strehl (organised by position) radius float : radius of the map (in arcsec) wl float : wavelength of observation (in nm) NGS np.ndarray : position (arcsec) of the NGS (1st line:x axis, 2nd:y axis) LGS np.ndarray : position (arcsec) of the LGS (1st line:x axis, 2nd:y axis) TS np.ndarray : position (arcsec) of the TS (1st line:x axis, 2nd:y axis) sup shesha.supervisor : shesha supervisor to retrieve all data from filename str : filename to read the psf map from
- Warning
- using 'sup' will take only the supervisor into consideration using 'filename' will overide previous values of the psf map (unless called with sup)
Definition at line 63 of file psfMap.py.
74 self._Rngs = max((self.NGSx.max(), self.NGSy.max()))
76 self.NGSx = np.zeros((0))
77 self.NGSy = np.zeros((0))
82 self._Rlgs = max(self.LGSx.max(), self.LGSy.max())
84 self.LGSx = np.zeros((0))
85 self.LGSy = np.zeros((0))
90 self._Rts = max(self.TSx.max(), self.TSy.max())
92 self.TSx = np.zeros((0))
93 self.TSy = np.zeros((0))
99 self.NGSx = np.array([t.xpos for t in sup.config.p_wfs_ngs[:-1]])
100 self.NGSy = np.array([t.ypos for t in sup.config.p_wfs_ngs[:-1]])
101 self._Rngs = max((self.NGSx.max(), self.NGSy.max()))
102 self.LGSx = np.array([t.xpos for t in sup.config.p_wfs_lgs])
103 self.LGSy = np.array([t.ypos for t in sup.config.p_wfs_lgs])
104 self._Rlgs = max(self.LGSx.max(), self.LGSy.max())
105 self.TSx = np.array([t.xpos for t in sup.config.p_wfs_ts])
106 self.TSy = np.array([t.ypos for t in sup.config.p_wfs_ts])
107 self._Rts = max(self.TSx.max(), self.TSy.max())
108 self.wavelength = sup.config.p_targets[0].Lambda
109 NTAR = len(sup.config.p_targets)
110 NTAR_side = int(np.sqrt(NTAR))
111 if (NTAR != NTAR_side**2):
112 raise ValueError("not a square nb of targets")
113 self.map = np.zeros((NTAR_side, NTAR_side))
114 for i in range(NTAR):
115 #self.map.itemset(i,sup._sim.get_strehl(i)[1])
116 self.map.itemset(i, sup._sim.get_strehl(i)[0])
117 tar = sup._sim.tar.d_targets[i]
118 self._Rtar = max(self._Rtar, tar.posx, tar.posy)
120 elif (filename is not None):
◆ plot()
def shesha.util.psfMap.PSF_map.plot |
( |
|
self, |
|
|
|
title = False , |
|
|
|
GS = False , |
|
|
|
WFS = False , |
|
|
|
LGS = False , |
|
|
|
NGS = False , |
|
|
|
TS = False |
|
) |
| |
Definition at line 153 of file psfMap.py.
153 def plot(self, title=False, GS=False, WFS=False, LGS=False, NGS=False, TS=False):
154 if (self.map.shape[0] > 0
and self.map.shape[1] > 0):
155 plt.matshow(self.map,
156 extent=[-self._Rtar, self._Rtar, -self._Rtar, self._Rtar])
158 if (GS
or WFS
or LGS):
159 plt.scatter(self.LGSy, self.LGSx, color=
"red")
160 if (GS
or WFS
or NGS):
161 plt.scatter(self.NGSy, self.NGSx, color=
"blue")
163 plt.scatter(self.TSy, self.TSx, color=
"yellow", s=1)
165 t = self.type +
" Strehl"
166 if (self.wavelength > 0):
167 t +=
" @ {:.3f} nm".format(self.wavelength)
170 t +=
", {:.2f}".format(self._Rts) +
" arcsec ring optim"
◆ read()
def shesha.util.psfMap.PSF_map.read |
( |
|
self, |
|
|
|
name |
|
) |
| |
Definition at line 202 of file psfMap.py.
202 def read(self, name):
203 hdu_map = fits.open(name)
204 self.type = hdu_map[0].header[
"TYPE"]
205 self.wavelength = hdu_map[0].header[
"LAMBDA"]
206 self._Rtar = hdu_map[0].header[
"RTAR"]
207 self._Rlgs = hdu_map[0].header[
"RLGS"]
208 self._Rngs = hdu_map[0].header[
"RNGS"]
209 self._Rts = hdu_map[0].header[
"RTS"]
210 self.map = hdu_map[0].data
211 self.LGSx = hdu_map[
"LGSx"].data
212 self.LGSy = hdu_map[
"LGSy"].data
213 self.NGSx = hdu_map[
"NGSx"].data
214 self.NGSy = hdu_map[
"NGSy"].data
215 self.TSx = hdu_map[
"TSx"].data
216 self.TSy = hdu_map[
"TSy"].data
◆ save()
def shesha.util.psfMap.PSF_map.save |
( |
|
self, |
|
|
|
name = "" |
|
) |
| |
Definition at line 174 of file psfMap.py.
174 def save(self, name=""):
175 hdu_map = fits.PrimaryHDU(self.map)
176 hdu_map.header[
"TYPE"] = self.type
177 hdu_map.header[
"LAMBDA"] = self.wavelength
178 hdu_map.header[
"RTAR"] = self._Rtar
179 hdu_map.header[
"RLGS"] = self._Rlgs
180 hdu_map.header[
"RNGS"] = self._Rngs
181 hdu_map.header[
"RTS"] = self._Rts
182 hdu_LGSX = fits.ImageHDU(self.LGSx, name=
"LGSX")
183 hdu_LGSY = fits.ImageHDU(self.LGSy, name=
"LGSY")
184 hdu_NGSX = fits.ImageHDU(self.NGSx, name=
"NGSX")
185 hdu_NGSY = fits.ImageHDU(self.NGSy, name=
"NGSY")
186 hdu_TSX = fits.ImageHDU(self.TSx, name=
"TSX")
187 hdu_TSY = fits.ImageHDU(self.TSy, name=
"TSY")
189 hdul = fits.HDUList([
190 hdu_map, hdu_LGSX, hdu_LGSY, hdu_NGSX, hdu_NGSY, hdu_TSX, hdu_TSY
192 t = self.type +
"_StrehlMap"
193 if (self.wavelength > 0):
194 t +=
"_{:.3f}nm".format(self.wavelength)
196 t +=
"_{:.2f}arcsec".format(self._Rts)
200 hdul.writeto(name, overwrite=1)
◆ setLGS()
def shesha.util.psfMap.PSF_map.setLGS |
( |
|
self, |
|
|
|
LGS, |
|
|
|
LGSy = None |
|
) |
| |
Definition at line 132 of file psfMap.py.
132 def setLGS(self, LGS, LGSy=None):
139 self._Rlgs = max(self.LGSx.max(), self.LGSy.max())
◆ setNGS()
def shesha.util.psfMap.PSF_map.setNGS |
( |
|
self, |
|
|
|
NGS, |
|
|
|
NGSy = None |
|
) |
| |
Definition at line 123 of file psfMap.py.
123 def setNGS(self, NGS, NGSy=None):
130 self._Rngs = max((self.NGSx.max(), self.NGSy.max()))
◆ setTS()
def shesha.util.psfMap.PSF_map.setTS |
( |
|
self, |
|
|
|
TS, |
|
|
|
TSy = None |
|
) |
| |
Definition at line 141 of file psfMap.py.
141 def setTS(self, TS, TSy=None):
148 self._Rts = max(self.TSx.max(), self.TSy.max())
◆ setWaveLength()
def shesha.util.psfMap.PSF_map.setWaveLength |
( |
|
self, |
|
|
|
wl |
|
) |
| |
Definition at line 150 of file psfMap.py.
150 def setWaveLength(self, wl):
◆ LGS
shesha.util.psfMap.PSF_map.LGS |
◆ LGSx
shesha.util.psfMap.PSF_map.LGSx |
◆ LGSy
shesha.util.psfMap.PSF_map.LGSy |
◆ map
shesha.util.psfMap.PSF_map.map |
◆ NGS
shesha.util.psfMap.PSF_map.NGS |
◆ NGSx
shesha.util.psfMap.PSF_map.NGSx |
◆ NGSy
shesha.util.psfMap.PSF_map.NGSy |
◆ TS
shesha.util.psfMap.PSF_map.TS |
◆ TSx
shesha.util.psfMap.PSF_map.TSx |
◆ TSy
shesha.util.psfMap.PSF_map.TSy |
◆ type
shesha.util.psfMap.PSF_map.type |
◆ wavelength
shesha.util.psfMap.PSF_map.wavelength |
The documentation for this class was generated from the following file: