6.2. Tomography widgets

Used for displaying or processing results [G1].

6.2.1. Displaying

A basic window capable of displaying a single reconstruction DiagGraphWindow. Can load a sequence of reconstructions and be synchronized with other windows.

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.

6.2.2. Processing

Region of interest analysis widgets

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)
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)

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_contour(*args)

Plots contours to highlight flux locations separating profiled regions.

save_nth()

Saves every nth slice, where n is defined by snvar tk.Stringvar asociated with snsbox tk.Spinbox widget.

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

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)