Commit 9e469705 authored by Doerr, Kevin's avatar Doerr, Kevin
Browse files

Merged draw_ellipse functions into one overall function

parent f26d29ff
......@@ -90,8 +90,7 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
replace with your routine for beam ellipse drawing.
"""
try:
self.draw_ellipse_x()
self.draw_ellipse_y()
self.draw_ellipse
except NotImplementedError:
self.draw_envelope()
......@@ -120,36 +119,28 @@ class MyAppWindow(BaseAppForm, Ui_MainWindow):
)
self.matplotlibbaseWidget.update_figure()
def draw_ellipse_x(self):
def draw_ellipse(self):
#raise NotImplementedError
"""Draw beam ellipse onto the figure area.
"""Draw x and y beam ellipse onto the figure area.
"""
ARIS_LAT.sync_settings()
_, fm = ARIS_LAT.run()
r, s = fm.run(monitor='all')
keys = [i.format(u='x') for i in ('{u}_cen', '{u}p_cen', '{u}_rms', '{u}p_rms', 'emit_{u}', 'emitn_{u}','alpha_{u}', 'beta_{u}', 'gamma_{u}', 'total_intensity')]
vals = (s.xcen, s.xpcen, s.xrms, s.xprms, s.xemittance, s.xnemittance,
keys_x = [i.format(u='x') for i in ('{u}_cen', '{u}p_cen', '{u}_rms', '{u}p_rms', 'emit_{u}', 'emitn_{u}','alpha_{u}', 'beta_{u}', 'gamma_{u}', 'total_intensity')]
vals_x = (s.xcen, s.xpcen, s.xrms, s.xprms, s.xemittance, s.xnemittance,
s.xtwiss_alpha, s.xtwiss_beta, (s.xtwiss_alpha**2+1)/s.xtwiss_beta, 1)
params = dict(zip(keys, vals))
params_x = dict(zip(keys_x, vals_x))
self.matplotlibbaseWidget.clear_figure()
draw_beam_ellipse_with_params(params, color='b', factor=4, ax=self.matplotlibbaseWidget.axes, xoy='x', fill='g', anote=False)
draw_beam_ellipse_with_params(params_x, color='b', factor=4, ax=self.matplotlibbaseWidget.axes, xoy='x', fill='g', anote=False)
self.matplotlibbaseWidget.update_figure()
def draw_ellipse_y(self):
#raise NotImplementedError
"""Draw beam ellipse onto the figure area.
"""
ARIS_LAT.sync_settings()
_, fm = ARIS_LAT.run()
r, s = fm.run(monitor='all')
keys = [i.format(u='y') for i in ('{u}_cen', '{u}p_cen', '{u}_rms', '{u}p_rms', 'emit_{u}', 'emitn_{u}','alpha_{u}', 'beta_{u}', 'gamma_{u}', 'total_intensity')]
vals = (s.ycen, s.ypcen, s.yrms, s.yprms, s.yemittance, s.ynemittance,
keys_y = [i.format(u='y') for i in ('{u}_cen', '{u}p_cen', '{u}_rms', '{u}p_rms', 'emit_{u}', 'emitn_{u}','alpha_{u}', 'beta_{u}', 'gamma_{u}', 'total_intensity')]
vals_y = (s.ycen, s.ypcen, s.yrms, s.yprms, s.yemittance, s.ynemittance,
s.ytwiss_alpha, s.ytwiss_beta, (s.ytwiss_alpha**2+1)/s.ytwiss_beta, 1)
params = dict(zip(keys, vals))
params_y = dict(zip(keys_y, vals_y))
self.matplotlibbaseWidget_1.clear_figure()
draw_beam_ellipse_with_params(params, color='b', factor=4, ax=self.matplotlibbaseWidget_1.axes, xoy='y', fill='g', anote=True)
draw_beam_ellipse_with_params(params_y, color='b', factor=4, ax=self.matplotlibbaseWidget_1.axes, xoy='y', fill='g', anote=True)
self.matplotlibbaseWidget_1.update_figure()
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment