3 def write_atm(file_name, atm, screen_file, zenithangle):
4 """Write (append) atmospheric parameters to file for YAO use
7 file_name : (str) : name of the file to append the parameter to
9 atm : (Param_atmos) : compass atmospheric parameters. Note that
10 atm.winddir is transformed
12 screen_file : (str) : path to the yao turbulent screen files. Note
13 that the string is passed through raw (without quotes around it)
14 in order to use yorick variables in the path name (e.g., Y_USER).
16 f = open(file_name,
"a+")
17 f.write(
"\n\n//------------------------------")
18 f.write(
"\n//ATM parameters")
19 f.write(
"\n//------------------------------")
21 f.write(
"\nr0 =" + str(atm.r0) +
"; //qt 500 nm")
22 f.write(
"\natm.dr0at05mic = tel.diam/r0;")
25 for i
in range(2, atm.nscreens + 1):
26 indexList +=
',"' + str(i) +
'"'
27 f.write(
"\natm.screen = &(" + screen_file +
"+["+indexList + \
29 f.write(
"\natm.layerspeed = &(" + np.array2string(atm.windspeed / np.cos(np.pi*zenithangle/180), \
30 separator=
',', max_line_width=300) +
");")
31 f.write(
"\natm.layeralt = &(" + np.array2string(atm.alt * np.cos(np.pi*zenithangle/180), \
32 separator=
',', max_line_width=300) +
");")
33 f.write(
"\natm.layerfrac = &(" + np.array2string(atm.frac, \
34 separator=
',', max_line_width=300) +
");")
35 f.write(
"\natm.winddir = &(" + np.array2string(-(atm.winddir+90)%360, \
36 separator=
',', max_line_width=300) +
");")
def write_atm(file_name, atm, screen_file, zenithangle)
Write (append) atmospheric parameters to file for YAO use.