7 import matplotlib
as mpl
9 from bokeh.plotting
import figure
10 from bokeh.models
import ColumnDataSource, Range1d
11 from bokeh.models.widgets
import Panel, TextInput, Slider, CheckboxButtonGroup, DataTable, TableColumn, Tabs, Button, RadioButtonGroup, Select, DataTable, DateFormatter, TableColumn, PreText
12 from bokeh.layouts
import layout, widgetbox
13 from bokeh.io
import curdoc, output_file, show
15 from guardians
import gamora, groot
24 self.
files = [f.split(
'/')[-1]
for f
in glob(self.
datapath +
"roket_*.h5")]
26 self.
files = [
"No hdf5 files"]
32 self.
url =
"http://" + os.uname()[1] +
".obspm.fr/~" + os.getlogin(
39 self.
pretext = PreText(text=
""" """, width=500, height=75)
40 self.
SRcompass = TextInput(value=
" ", title=
"SR compass:")
41 self.
SRVii = TextInput(value=
" ", title=
"SR Vii:")
43 self.
button_psf = Button(label=
"PSF !", button_type=
"success")
44 self.
button_roll = Button(label=
"Roll", button_type=
"primary")
47 title=
"Datapath", value=self.
dataroot,
51 self.
xdr = Range1d(start=0, end=1024)
52 self.
ydr = Range1d(start=1024, end=0)
54 x_axis_location=
"above", title=
"PSF COMPASS")
57 x_axis_location=
"above", title=
"PSF ROKET")
58 self.
plot_psf_cuts = figure(plot_height=600, plot_width=800, y_range=[1e-9, 1],
64 self.
image_compass.image_url(url=[], x=0, y=0, w=1024, h=1024)
65 self.
image_Vii.image_url(url=[], x=0, y=0, w=1024, h=1024)
66 self.
plot_psf_cuts.line(x=
"x", y=
"y", legend=
"COMPASS", color=
"red",
68 self.
plot_psf_cuts.line(x=
"x", y=
"y", legend=
"Vii", color=
"blue",
91 Update the attributes based on the new selected filename
97 self.
Btt = self.
f[
"Btt"][:]
98 self.
P = self.
f[
"P"][:]
102 Update the select_files options following the current datapath
106 f.split(
'/')[-1]
for f
in glob(self.
datapath +
"roket_*.h5")
109 self.
files = [
"No hdf5 files"]
116 Update the PSF by ensquaring them
120 time = str(datetime.datetime.now().strftime(
'%Y-%m-%d_%H_%M_%f'))
121 self.
old =
"/home/" + os.getlogin() +
"/public_html/roket_display" + time +
".png"
122 mpl.image.imsave(self.
old, np.log10(np.abs(psfc)))
124 url=dict(value=self.
url + time +
".png"), x=0, y=0, w=psfc.shape[0],
126 self.
image_compass.x_range.update(start=0, end=psfc.shape[0])
127 self.
image_compass.y_range.update(start=psfc.shape[0], end=0)
134 time = str(datetime.datetime.now().strftime(
'%Y-%m-%d_%H_%M_%f'))
135 self.
old =
"/home/" + os.getlogin(
136 ) +
"/public_html/roket_display" + time +
".png"
137 mpl.image.imsave(self.
old, np.log10(np.abs(psfv)))
139 url=dict(value=self.
url + time +
".png"), x=0, y=0, w=psfc.shape[0],
158 Compute the PSF using the Vii functions and display it
160 self.
pretext.text =
""" Computing PSF using Vii... Please wait"""
171 Roll the COMPASS PSF (for retro-compatibility with old ROKET files)