2. tomotok.gui package¶
2.1. Submodules¶
2.2. tomotok.gui.apps module¶
Module with tkinter apps for computing tomography reconstructions.
-
class
tomotok.gui.apps.
AnalyzerApp
(master=None)¶ Bases:
tkinter.ttk.Frame
Methods
-
do
(*args)¶ Loads data from files and creates requested graphs and analytical widgets.
-
expand
(**kw)¶ Executed after main ‘Do’ method. Makes buttons for recreating closed graph windows.
-
get_ctrl
()¶ Checks for existing slave graphical windows and returns them in list
Returns: control : array
Contains all slave graphs widgets.
-
make_bol
()¶ Makes Bolometry graph window or updates data in existing window.
-
make_cnt
()¶ Makes contours graph window or updates data in existing window.
-
make_mc
()¶ Makes Master controls widget for slave graphs.
-
make_mrf
()¶ Makes Merfer graph window or updates data in existing RGB graph window.
-
make_ntr
()¶ Makes neutron graph window or updates data in existing window.
-
make_prf
()¶ Makes profiler graph window or updates data in existing window.
-
make_pwr
()¶ Makes power graph window or updates data in existing window.
-
make_rec
()¶ Makes rectangles graph window or updates data in existing window.
-
make_rgb
()¶ Makes RGB graph window or updates data in existing RGB graph window.
-
make_sxr
()¶ Makes Soft X-Ray graph window or updates data in existing window.
-
-
class
tomotok.gui.apps.
SelectorApp
(master=None)¶ Bases:
tomotok.gui.apps.AnalyzerApp
Manually select hdf files to be used for comparative analysis.
Methods
-
do
(*args, **kwargs)¶
-
make_mrf
()¶
-
select1
()¶
-
select2
()¶
-
select3
()¶
-
selectm
()¶
-
-
tomotok.gui.apps.
launcher
(app=’analyzer’)¶ Launches specified application and ensures stdout.
Parameters: app : string
Specifies which app should be launched. Legal options are and ‘analyzer’, ‘a’. These are not case sensitive.
2.4. tomotok.gui.merfer module¶
MEasured vs RetroFit comparator graphical window widget
-
class
tomotok.gui.merfer.
GraphMerfer
(parent=None, data=None, errors=None, **kw)¶ Bases:
tomotok.gui.widgets.GraphWindow
Widgets for comparing MEasured data with RetroFit
Parameters: parent : TKInter widget
Default is None.
data : dict
Contains data, default is empty dict.
Methods
-
plot
(val, *args)¶
-
save
(fname=’Graphs’)¶
-
update_data
(ndata, err=None, **kw)¶ Loads new data.
Parameters: ndata : dict
New data to be loaded to Graph window
err : np.ndarray
contains errors of measured data with shape (#chnl, #tslices)
-
2.5. tomotok.gui.profiler module¶
Averaging of emissivity in bins shaped according to magnetic flux reconstruction
-
class
tomotok.gui.profiler.
GraphProfiler
(parent=None, **kw)¶ Bases:
tomotok.gui.widgets_tomo.GraphRgb
A window that can calculate power profile in respect to magnetic flux surfaces.
Parameters: parent : TKInter class parent
Default is None.
data : dict
Contains data, default is empty dict.
title : str, optional
Name of window.
Methods
-
compute
(*args)¶ Computes radiated power in given regions.
-
get_levels
(*args)¶ Gets levels from widgets for plotting contours
-
plot
(val, *args)¶
-
plot_contour
(*args)¶ Plots contours to highlight flux locations separating profiled regions.
-
save
(fname=’Graphs/’)¶
-
save_nth
()¶ Saves every nth slice, where n is defined by snvar tk.Stringvar asociated with snsbox tk.Spinbox widget.
-
update_data
(ndata, **kw)¶
-
2.6. tomotok.gui.roi module¶
Region of interest analysis widgets
-
class
tomotok.gui.roi.
GraphContours
(parent=None, **kw)¶ Bases:
tomotok.gui.widgets_tomo.GraphRgb
Based on GraphRgb class. Usefull for observing power in specified areas.
Parameters: parent : TKInter class parent
Default is None.
data : dict
Contains data, default is empty dict.
title : str, optional
Name of window.
Methods
-
add_patch
(contours)¶ Adds collections created by contours to axes
-
clear_patch
(contours)¶ Removes collections representing given cotnours from axes.
-
compute
(*args)¶
-
decrease_pcount
()¶ Variable pcount represents total number of patches. Should be called after removing a new patch.
-
get_levels
(pnum)¶ Gets levels from contour object. If length of levels is one, returns array with zero as minimum.
Parameters: pnum : int
Number of patch
Returns: limits : np.ndarray
Array with minimum and maximum limited by given contours.
-
get_pnum
()¶ Variable pnum represents selected contours, starts from 1.
Returns: out : int
Number of selected contours pair starting from 0.
-
get_predef
()¶ Returns predefined contours. Used for initalization of wondow.
Returns: out : dict
Contains coordinates of predefined rectangles
-
make_patch
(min_=0.5, max_=1, pnum=None)¶ Creates new contours and adds collections to axes.
-
move_limits
(*args)¶
-
plot
(val, *args)¶
-
pselect
(*args)¶ Changes spinbox values to selected contours when selection changes.
-
raise_pcount
()¶ Variable pcount represents total number of patches. Should be called after adding a new patch.
-
remove_patch
()¶ Removes last patch from computing and from axes.
-
save
(fname=None)¶
-
save_nth
()¶ Saves every nth slice, where n is defined by snvar tk.Stringvar asociated with snsbox tk.Spinbox widget.
-
update_data
(ndata, **kw)¶
-
-
class
tomotok.gui.roi.
GraphRectangles
(parent=None, **kw)¶ Bases:
tomotok.gui.widgets_tomo.GraphRgb
Based on GraphRgb class. Usefull for observing power in specified areas.
Parameters: parent : TKInter class parent
Default is None.
data : dict
Contains data, default is empty dict.
title : str, optional
Name of window.
Methods
-
compute
(*args)¶
-
get_pnum
()¶ Variable pnum represents selected patch, starts from 1.
Returns: out : int
Number of selected patch (rectangle) starting from 0. Can be used as idices for Axes.patches array.
-
get_predef
()¶ Predefined rectangles in interesting areas are defined here.
Returns: dict
Contains coordinates of predefined rectangles
-
lower_pcount
()¶ Variable pcount represents total number of patches. Should be called after removing a new patch.
-
make_patch
(x=-1, y=-1, w=-1, h=-1)¶ Creates new patch and adds it to axes.
-
moveh
(*args)¶
-
movew
(*args)¶
-
movex
(*args)¶
-
movey
(*args)¶
-
plot
(val, *args)¶
-
pselect
(*args)¶ Changes spinbox values to selected patch when selection changes.
-
raise_pcount
()¶ Variable pcount represents total number of patches. Should be called after adding a new patch.
-
remove_patch
()¶ Removes last patch from computing and from axes.
-
save
(fname=’Graphs/’)¶
-
save_nth
()¶ Saves every nth slice, where n is defined by snvar Stringvar asociated with snsbox Spinbox widget.
-
update_data
(ndata, **kw)¶
-
2.7. tomotok.gui.widgets module¶
Library of custom tkinter widgets that have not been specially designed for displaying or processing tomography results.
-
class
tomotok.gui.widgets.
ConsoleText
(master=None, cnf=None, **kw)¶ Bases:
tkinter.Frame
A Tkinter Text widget that provides a scrolling display of console stdout.
Methods
-
log_update
()¶
-
set_scrl
()¶
-
start
()¶
-
stop
()¶
-
write
(val)¶
-
-
class
tomotok.gui.widgets.
ConsoleWindow
(parent=None, **kw)¶ Bases:
tkinter.Toplevel
Console text embedded in Toplevel window.
Methods
-
start
()¶
-
stop
()¶
-
-
class
tomotok.gui.widgets.
GraphWindow
(parent=None, **kw)¶ Bases:
tkinter.Toplevel
Basic window prepared for displaing data sequence with use of matplotlib. Contains Figure and Axes for plotting, but no method for plotting or atribute with data. By default it consists of listbox with data sequence, frame for buttons, canvas for plot and slider for navigation.
Parameters: parent : TKInter widget
Default is None. Used in GUI interface to specify hierarchy.
vals : array-like, optional
Contains data from time vector to be shown in listbox and under slider.
slices : int, optional
Number of time steps. Use ether vals or slices. Use if no time vector data are available. Creates vals as range(slices).
slavechbutton : bool, optional
Switches whether slave check button will be created. If True a button is created, that if unchecked will switch off control from master.
Methods
-
bb_row_raise
()¶ Increases bb_row, atribute that describes number of placed buttons in button box frame widget positioned under listbox. Used for automated row placement. Should be called after placing new button to bbox.
-
go_next
(*args)¶
-
go_prev
(*args)¶
-
go_to
(val, *args)¶ Puts slider into position given by ‘val’.
Parameters: val : int
Nunber of slider position.
-
init_datarange
(**kw)¶ Prepares vals or slices for widget construction.
-
lbox_selection
(*args)¶ Executed when selection in listbox was executed.
-
plot
(num)¶ Parameters: num
-
save
(*args)¶
-
set_slices
(**kw)¶ Checks keywords for slices infromation. Sets slices to specified number or 1 if number of slices was not specified.
-
set_vals
(**kw)¶ Rutine to set values for listbox menu and displayed numbers and range of scale widget.
-
slider_move
(*args)¶ Executed when position of slider is changed. Changes label of slider, plots apropirate data and moves in listbox widget.
-
update_data
(ndata, **kw)¶ Loads new data.
Parameters: ndata : data structure
New data to be loaded to Graph window.
-
update_graph
()¶ Plots data slice apropirate to slider position.
-
2.8. tomotok.gui.widgets_tomo module¶
Module with tkinter widgets for basic tomography analysis.
-
class
tomotok.gui.widgets_tomo.
DiagGraphWindow
(parent=None, data=None, **kw)¶ Bases:
tomotok.gui.widgets.GraphWindow
Based on GraphWindow class from widgets.py Used for displaying results of single diagnostic tomography
See documentation of GraphWindow for information about other keyword arguments.
Parameters: parent : TKInter widget
Default is None. Used in GUI interface to specify hierarchy.
data : dict
Contains data, default is empty dict.
**kw
- title : str {‘Bolometry’, ‘Neutrons’, ‘SXR’}
Name of graph window. If dname is not specified, title is used to determin what key from provided data to load.
- dname : str {‘bol’, ‘ntr’, ‘sxr’}
Shorter string to specify diagnostic for graph window. Though not recommended, both title and dname can be used. If so, dname and title should always match to avoid inconsistency of title and data.
See also
GraphWindow
Methods
-
get_mval
(val)¶ Returns index for ploting magnetic data from index of reconstrution. Should not be called if magnetics data are not loaded.
Parameters: val : int
Index of reconstrition.
-
plot
(val, **kw)¶
-
save
(*args)¶
-
update_data
(ndata, **kw)¶ Loads new data.
Parameters: ndata : dict
New data to be loaded to Graph window.
-
class
tomotok.gui.widgets_tomo.
GraphPower
(parent=None, data=None, **kw)¶ Bases:
tomotok.gui.widgets.GraphWindow
Based on GraphWindow class from widgets.py Vals are not time steps for this class but types of diagnotics to plot power emitted or to show correlations of these.
Parameters: parent : TKInter class parent, optional
Default is None.
data : dict, optional
Contains data, default is empty dict.
Methods
-
normalize
(*args, **kw)¶ Switches data to normalized or standard, depending on norvar state. Normalizes data and if no normalized data are available.
-
plot
(val, **kw)¶ Prepares data for matplotlib and draws them onto canvas
Parameters: val : int
number of slice in this case meaning type of analysis
-
save
()¶
-
update_data
(ndata, **kwargs)¶ Updates class data
Parameters: ndata : dict
Dictionary containign new data under keys ‘bol’, ‘ntr’, ‘sxr’.
-
-
class
tomotok.gui.widgets_tomo.
GraphRgb
(parent=None, data=None, **kw)¶ Bases:
tomotok.gui.widgets.GraphWindow
Based on GraphWindow class from widgets.py. Usefull for comparing tomography results from different diagnostics simultaneously.
See documentation of Graf_window for information about other keyword arguments.
Parameters: parent : TKInter class parent
Default is None.
data : dict
Contains data, default is empty dict.
title : str, optional
Name of graph window. Is used for saving. Default is ‘RGB plot’
Methods
-
get_mval
(val)¶ Returns index for ploting magnetic data from index of reconstrution. Should not be called if magnetics data are not loaded.
Parameters: val : int
Index of reconstrition.
-
get_rgbval
(val)¶ Gets indexes for given timeslices. Independent on provided diagnostics.
Returns: numpy.ndarray of ints
Contains indexes of nearest tim vector values to reference diagnostic.
-
plot
(val, *args)¶
-
save
()¶
-
update_data
(ndata, **kw)¶ Loads new data.
Parameters: ndata : dict
New data to be loaded to Graph window.
-