5 """Return the coordinates of the valid subapertures of a given WFS
7 these coordinates are given in pixels
10 wfs : Param_wfs : wfs to get the subapertures position from
13 valid_X : (np.ndarray[ndim=1, dtype=np.float64]) : subapertures positions along axis x
15 valid_Y : (np.ndarray[ndim=1, dtype=np.float64]) : subapertures positions along axis y
18 return wfs._validpuppixx-2 , wfs._validpuppixy-2
22 """Return the coordinates of the valid subapertures of a given WFS
24 these coordinates are given in meters and centered
27 sup : (compassSupervisor) : supervisor
29 wfs_id : (int) : index of the WFS
32 valid_X : (np.ndarray[ndim=1, dtype=np.float64]) : subapertures positions along axis x
34 valid_Y : (np.ndarray[ndim=1, dtype=np.float64]) : subapertures positions along axis y
38 wfs = config.p_wfss[wfs_id]
41 total = geom.pupdiam/wfs.nxsub*(wfs.nxsub-1)
42 valid_X = (valid_X-total/2)*geom.get_pixsize()
43 valid_Y = (valid_Y-total/2)*geom.get_pixsize()
44 return valid_X, valid_Y
47 def wfs_to_json(wfs, geom, type, *, x_pos=None, y_pos=None):
48 """return a json description of a wfs
51 wfs : (Param_wfs) : wfs to represent as json
53 geom : (Param_geom) : geom settings
55 type : (string) : wfs type ("lgs", "ngs" "target" or "ts")
58 x_pos : (list(float)) : x coordinates of the targets ()
60 y_pos : (list(float)) : y coordinates of the targets ()
62 types = [
"lgs",
"ngs",
"target",
"ts"]
63 if(type
not in types):
64 ValueError(
"type must be one of "+str(types))
70 "nssp" : wfs[0].get_nxsub(),
71 "alphaX_as" : [w.get_xpos()
for w
in wfs],
72 "alphaY_as" : [w.get_ypos()
for w
in wfs]
75 elif(type ==
"target"):
76 if(x_pos
is None or len(x_pos) != len(y_pos)):
77 ValueError(
"pointing direction of WFS target must be provided (x_pos, y_pos)")
79 "nssp" : wfs.get_nxsub(),
89 "nssp" : wfs.get_nxsub(),
90 "alphaX_as" : wfs.get_xpos(),
91 "alphaY_as" : wfs.get_ypos(),
92 "XPup" : wfs.get_dx() * geom.get_pixsize(),
93 "YPup" : wfs.get_dy() * geom.get_pixsize(),
94 "thetaML" : wfs.get_thetaML() ,
97 "pixSize" : wfs.get_pixsize(),
98 "lambdaWFS" : wfs.get_Lambda() ,
100 "throughput" : wfs.get_optthroughput() ,
101 "RON" : wfs.get_noise()
104 if(wfs.get_gsalt()>0):
106 ValueError(
"wfs is not a NGS (gsalt > 0)")
108 wfs_json[
"lgsAlt"] = wfs.get_gsalt()
109 wfs_json[
"lgsDepth"] = lgs_depth
110 wfs_json[
"lgsFlux"] = wfs.lgsreturnperwatt * wfs.laserpower * \
111 wfs.optthroughput * 10**4
112 wfs_json[
"spotWidth"] = wfs.get_beamsize()
113 wfs_json[
"lgsCst"] = lgs_cst
117 ValueError(
"wfs is not a LGS (gsalt == 0) ")
118 wfs_json[
"magnitude"] = wfs.get_gsmag()
123 """Return the notice of the wfs json representation
126 type : (string) : wfs type ("lgs", "ngs" or "target")
128 if(type !=
"lgs" and type !=
"ngs" and type !=
"target"):
129 ValueError(
"type must be either \"lgs\", \"ngs\" or \"target\"")
130 if(type ==
"target"):
132 "nssp" :
" : number of subapertures along the diameter",
133 "alphaX_as" :
" arcsec : list of pointing direction of the wfs (on x axis)",
134 "alphaY_as" :
" arcsec : list of pointing direction of the wfs (on y axis)",
138 "nssp" :
" : number of subapertures along the diameter",
139 "alphaX_as" :
" arcsec : pointing direction of the wfs (on x axis)",
140 "alphaY_as" :
" arcsec : pointing direction of the wfs (on y axis)",
141 "XPup" :
" meter : pupil shift of the WFS (on axis x)",
142 "YPup" :
" meter : pupil shift of the WFS (on axis y)",
143 "thetaML" :
" radian : rotation of the camera",
144 "thetaCam" :
" radian : rotation of the microlenses",
145 "sensitivity" :
" : sensitivity coeff of this WFS",
146 "pixSize" :
" arcsec : WFS pixel size",
147 "lambdaWFS" :
" meter : WFS wavelength",
148 "bandwidth" :
" meter : WFS bandwidth",
149 "throughput" :
" percent : transmission for the GS",
150 "RON" :
" nb of e- : Read Out Noise",
153 notice[
"lgsAlt"] =
" meter : laser guide star altitude"
154 notice[
"lgsDepth"] =
" meter : laser guide star depth"
155 notice[
"lgsFlux"] =
" (ph/m2/s) : LGS photon return at M1"
156 notice[
"spotWidth"] =
" arcsec : lazer width"
157 notice[
"lgsCst"] =
" : constant on lgs (simulate that LGS cannot measure tip-tilt and focus, for Linear Algebra purpose)"
159 notice[
"magnitude"] =
" : guide stars magnitude"
def wfs_json_notice(type)
Return the notice of the wfs json representation.
def get_subap_pos_pixel(wfs)
Return the coordinates of the valid subapertures of a given WFS.
def wfs_to_json(wfs, geom, type, *x_pos=None, y_pos=None)
return a json description of a wfs
def get_subap_pos_meter(sup, wfs_id)
Return the coordinates of the valid subapertures of a given WFS.