# -*-Python-*-
# Created by bgrierson at 20 Dec 2016 13:53
# This is a more complex GUI that reforms allowing the user to
# add and remove time points from a workflow desiged to control
# a tokamak discharge history.
# All data associated with this demo will go in the TUTORIAL module ['INPUTS']['GUIS_reform2']
# Set default OMFIT trees for I/O
root['INPUTS'].setdefault('GUIS_shot_designer', OMFITtree())
# Location of variables
loc = "root['INPUTS']['GUIS_shot_designer']"
# Create the main GUI
OMFITx.TitleGUI('Shot Designer')
# Shot number
OMFITx.Entry(loc + "['shot']", 'Shot', default=99999)
# Start time
OMFITx.Entry(loc + "['tinit']", 'Start Time (s)', default=1.0)
# End time
OMFITx.Entry(loc + "['ftime']", 'End Time (s)', default=5.0)
OMFITx.Tab('EQ Ref')
# Reference equilibrium shape
OMFITx.Entry(loc + "['ref_eq_shot']", 'Shot', default=12345)
OMFITx.Entry(loc + "['ref_eq_time']", 'Time (s)', default=1.2)
OMFITx.Entry(loc + "['ref_eq_tree']", 'MDS+ Tree', default='EFIT01')
def fetch_eq():
printi('Fetching shot:{}, tree:{}, time:{}'.format('x', 'y', 'z'))
OMFITx.Button('Fetch Equilibrium', fetch_eq)
OMFITx.Tab('EQ Hist')
OMFITx.CompoundGUI(root['GUIS']['shot_designer_eq'])
OMFITx.Tab('Profiles')
OMFITx.CompoundGUI(root['GUIS']['shot_designer_prof'])