38 Initialization and execution of a CANAPASS supervisor
41 canapassSupervisor.py <parameters_filename> [options]
43 with 'parameters_filename' the path to the parameters file
46 -h, --help Show this help message and exit
47 -f, --freq freq change the frequency of the loop
48 -d, --delay delay change the delay of the loop
49 -s, --spiders spiders change the spiders size
50 -n, --nxsub nxsub change the number of pixels in subap
51 -p, --pupsep pupsep change the distance between subap center and frame center
52 -g, --gsmag gsmag change guide star magnitude
53 -r, --rmod rmod change modulation radius
54 -x, --offaxis offaxis change all targets position along x axis
55 -r0,--setr0 setr0 change the global r0
60 from subprocess
import Popen, PIPE
76 def __init__(self, config, cacao: bool =
True) ->
None:
77 print(
"switching to a generic controller")
78 config.p_controllers[0].type = scons.ControllerType.GENERIC
79 CompassSupervisor.__init__(self, config, cacao=cacao)
124 if __name__ ==
'__main__':
125 from docopt
import docopt
127 arguments = docopt(__doc__)
128 config =
ParamConfig(arguments[
"<parameters_filename>"])
129 if (arguments[
"--freq"]):
130 print(
"Warning changed frequency loop to: ", arguments[
"--freq"])
131 config.p_loop.set_ittime(1 / float(arguments[
"--freq"]))
132 if (arguments[
"--delay"]):
133 print(
"Warning changed delay loop to: ", arguments[
"--delay"])
134 config.p_controllers[0].set_delay(float(arguments[
"--delay"]))
135 if (arguments[
"--spiders"]):
136 print(
"Warning changed spiders size to: ", arguments[
"--spiders"])
137 config.p_tel.set_t_spiders(float(arguments[
"--spiders"]))
138 if (arguments[
"--nxsub"]):
139 print(
"Warning changed number of pixels per subaperture to: ", arguments[
"--nxsub"])
140 config.p_wfss[0].set_nxsub(int(arguments[
"--nxsub"]))
141 if (arguments[
"--pupsep"]):
142 print(
"Warning changed distance between subaperture center and frame center to: ", arguments[
"--pupsep"])
143 config.p_wfss[0].set_pyr_pup_sep(int(arguments[
"--pupsep"]))
144 if (arguments[
"--gsmag"]):
145 print(
"Warning changed guide star magnitude to: ", arguments[
"--gsmag"])
146 config.p_wfss[0].set_gsmag(float(arguments[
"--gsmag"]))
147 if (arguments[
"--setr0"]):
148 print(
"Warning changed r0 to: ", arguments[
"--setr0"])
149 config.p_atmos.set_r0(float(arguments[
"--setr0"]))
150 if (arguments[
"--rmod"]):
151 print(
"Warning changed modulation radius to: ", arguments[
"--rmod"])
152 rMod = int(arguments[
"--rmod"])
153 nbPtMod = int(np.ceil(int(rMod * 2 * 3.141592653589793) / 4.) * 4)
154 config.p_wfss[0].set_pyr_npts(nbPtMod)
155 config.p_wfss[0].set_pyr_ampl(rMod)
156 if (arguments[
"--offaxis"]):
157 print(
"Warning changed target x position: ", arguments[
"--offaxis"])
158 config.p_targets[0].set_xpos(float(arguments[
"--offaxis"]))
159 config.p_targets[1].set_xpos(float(arguments[
"--offaxis"]))
160 config.p_targets[2].set_xpos(float(arguments[
"--offaxis"]))
165 from subprocess
import Popen, PIPE
166 from hraa.server.pyroServer
import PyroServer
168 Pyro4.config.REQUIRE_EXPOSE =
False
169 p = Popen(
"whoami", shell=
True, stdout=PIPE, stderr=PIPE)
170 out, err = p.communicate()
173 raise Exception(
"ERROR CANNOT RECOGNIZE USER")
175 user = out.split(b
"\n")[0].decode(
"utf-8")
176 print(
"User is " + user)
177 if (supervisor.corono ==
None):
181 coro2pyro = supervisor.corono
183 supervisor, supervisor.rtc, supervisor.wfs, supervisor.target,
184 supervisor.tel, supervisor.basis, supervisor.calibration,
185 supervisor.atmos, supervisor.dms, supervisor.config, supervisor.modalgains, coro2pyro
188 "supervisor",
"supervisor_rtc",
"supervisor_wfs",
"supervisor_target",
189 "supervisor_tel",
"supervisor_basis",
"supervisor_calibration",
190 "supervisor_atmos",
"supervisor_dms",
"supervisor_config",
"supervisor_modalgains",
"supervisor_corono",
194 nname.append(name +
"_" + user)
195 server = PyroServer(listDevices=devices, listNames=nname)
199 raise EnvironmentError(
200 "Missing dependencies (code HRAA or Pyro4 or Dill Serializer)")
Shesha parameters configuration class.
None __init__(self, config, bool cacao=True)
This class implements generic supervisor to handle compass simulation.
This file is here only to avoid pyro server crash when a coronograph class is not in the pramam file.
Python package for AO operations on COMPASS simulation.
Parameter classes for COMPASS.
Numerical constants for shesha and config enumerations for safe-typing.
Initialization and execution of a COMPASS supervisor.