Table Of Contents

Previous topic

terapy.plot package

This Page

terapy.scan package

Submodules

terapy.scan.average module

Average multiple scans class.

class terapy.scan.average.Average(parent=None)

Bases: terapy.scan.base.ScanEvent

Average multiple scans class.

Average multiple scans into one.

get_icon()
get_operation_count()
populate()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.base module

Generic scan event class.

class terapy.scan.base.PropertyNode

Property node class

Differentiate property nodes from other tree items.

class terapy.scan.base.ScanEvent(parent=None)

Generic scan event class.

Properties:
__extname__ - long name (str)
check_validity(data)

Check whether given data can be processed by this event.

Parameters:
data - data array (DataArray) or measurement (Measurement)
Output:
True if yes
create_property_root()

Create property root in host tree structure.

edit_label(event, pos)

Actions triggered by edit tree label event corresponding to given property node.

Parameters:
event - wx.Event pos - property index (int)
get_children()

Get scan event children. Wrapper to TreeCtrl function.

Output:
children as list of ScanEvent
get_icon()

Return scan event icon.

Output:
16x16 icon (wx.Bitmap)
get_operation_count()

Tell how many “operations” this event will generate. Normal events do one operation. Loops do one operation per iteration.

Output:
number of operations (int)
get_property_node(n=-1)

Return item corresponding to given property node index

Parameters:
n - property node index (if n==-1, return property root)
Output:
tree item (wx.TreeItem)
populate()

Populate host tree structure with properties.

refresh()

Refresh scan event.

run(data)

Run scan event.

Parameters:
data - measurement (Measurement)
run_children(data)

Run scan event children.

Parameters:
data - measurement (Measurement)
set(parent=None)

Run scan event configuration procedure.

Parameters:
parent - parent window (wx.Window)
Output:
True if successful
set_property(pos, val)

Set given property to given value.

Parameters:
pos - property index (int) val - value
set_property_nodes(expand=False)

Set property node values.

Parameters:
expand - if True, expand property folder, collapse if False
stop(inst=None)

Stop scan.

Parameters:
inst - pubsub event data

terapy.scan.control module

Scan control widget

class terapy.scan.control.ScanEventList(parent=None)

Bases: wx._windows.Panel

Scan control widget

BuildXMLTree(itm, root=None, doc=None)

Build XML tree out of given TreeCtrl subtree.

Parameters:
itm - TreeCtrl item (wx.TreeItem) root - recipient minidom XML node doc - recipient minidom XML document
CheckValidity(stree, meas)

Check validity of given scan sequence wrt given measurement structure.

Parameters:
stree - scan sequence (SubTree) meas - measurement structure (Measurement)
CreateEventTree(tree, root=None)

Fill in TreeCtrl with given ScanEvent tree.

Parameters:
tree - nested list of ScanEvent root - root tree item (wx.TreeItem, root item if None)
DefaultEvents()

Fill TreeCtrl with default events. Load default events from event_file if present.

InsertItem(ev, root=None, expand=True)

Insert given event in tree.

Parameters:
ev - event to insert (ScanEvent) root - parent item (wx.TreeItem, root item if None) expand - if True, expand parent folder
OnAddEvent(ev, event)

Actions following scan event add request.

Parameters:
ev - scan event to be added (ScanEvent) event - wx.Event
OnButtonDown(event=None)

Actions triggered by Down button press.

Parameters:
event - wx.Event
OnButtonRun(event=None)

Actions triggered by Run/Stop button press.

Parameters:
event - wx.Event
OnButtonUp(event=None)

Actions triggered by Up button press.

Parameters:
event - wx.Event
OnEditTreeLabel(event=None)

Actions triggered by edit label request.

Parameters:
event - wx.Event
OnEnableEvent(itm)

Actions following enable/disable given scan event.

Parameters:
itm - tree item (wx.TreeItem)
OnEndDrag(x, y, data)

Actions following drop on TreeCtrl.

Parameters:

x,y - coordinates of drop action (int) data - dropped data (str)

Passing drag and drop data in wxpython is incovenient. Alternative used here: data is stored as self.drag_object
OnEndEditTreeLabel(event=None)

Actions following label edition.

Parameters:
event - wx.Event
OnEventDoubleClick(event=None)

Actions triggered by left mouse button double click on tree item.

Parameters:
event - wx.Event
OnEventLeftClick(event=None)

Actions triggered by left mouse button click on tree item.

Parameters:
event - wx.Event
OnEventListRightClick(event=None)

Actions triggered by right mouse button click on tree item.

Parameters:
event - wx.Event
OnLoadSequence(itm)

Actions triggered by load ScanEvent sequence request.

Parameters:
event - wx.Event
OnRemoveEvent(event=None)

Actions following tree item delete request.

Parameters:
event - wx.Event
OnReplaceEvent(old, new, event)

Replace given item by new item.

Parameters:
old - item to replace (ScanEvent) new - item to replace with (ScanEvent) event - wx.Event
OnRunSequence(itm)

Actions initiating a sequence run.

Parameters:
itm - root item for sequence (wx.TreeItem)
OnSaveSequence(itm)

Actions following save sequence request for given item.

Parameters:
itm - tree item (wx.TreeItem)
OnStartDrag(event=None)

Actions following beginning of drag action.

Parameters:
event - wx.Event
OnStopMeasurement(inst=None)

Actions following stop measurement request.

Parameters:
event - wx.Event
ParseXMLFromString(string)

Parse XML tree represented as text string and add result to tree.

Parameters:
string - XML tree in string format (str)
ParseXMLTree(tree)

Parse given XML tree and build ScanEvent structure.

Parameters:
tree - minidom XML document
Output:
nested list of ScanEvent
RefreshEvents(subtree=None)

Refresh given subtree.

Parameters:
subtree - subtree to be refreshed (SubTree, whole tree if None)
ToggleControls(state=True)

Toggle state of widgets.

Parameters:
state - True = idle state, False = scan running
Unfold(lvl=-1, itm=None)

Unfold given tree item.

Parameters:
lvl - number of levels to unfold (int, if -1 unfold all) itm - tree item (wx.TreeItem, root item if None)
UnfoldSequence(n=0)

Unfold given scan sequence.

Parameters:
n - scan sequence index (int)

terapy.scan.move module

Move axis device scan event class

class terapy.scan.move.AxisSelectionDialog(parent=None, title='Move axis device', axlist=[], axis=0, position=0.0, relative=False)

Bases: wx._windows.Dialog

Move axis device scan event configuration dialog

GetValue()

Return dialog values.

Output:
selected axis device index (int), position (float), absolute/relative move (bool)
OnRelativeSelect(event=None)

Actions triggered by relative/absolute checkbox ticking.

class terapy.scan.move.Move(parent=None)

Bases: terapy.scan.base.ScanEvent

Move axis device scan event class

Move selected axis device to given position.

edit_label(event, pos)
get_icon()
onSelectAxis(event=None)
populate()
refresh()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.plot module

Plot scan event class

class terapy.scan.plot.Plot(parent=None)

Bases: terapy.scan.base.ScanEvent

Plot scan event class

Plot given data to available plot canvas.

check_validity(data)
get_icon()
plot(arr)
refresh()
run(data)
set_canvas(inst=None)
set_refresh(inst=None)

terapy.scan.read module

Read scan event base class

class terapy.scan.read.InputSelectionDialog(parent=None, title='Select input', inlist=[], value=0)

Bases: wx._windows.Dialog

Read scan event configuration dialog

GetValue()

Return dialog value.

Output:
selected input device index (int)
class terapy.scan.read.ReadBase(parent=None)

Bases: terapy.scan.base.ScanEvent

Read scan event base class

edit_label(event, pos)
get_icon()
onSelectInput(event=None)
populate()
refresh()
run(data)
set(parent=None)

terapy.scan.readavg module

Read scan event class (average all returned values)

class terapy.scan.readavg.ReadAvg(parent=None)

Bases: terapy.scan.read.ReadBase

Read scan event class (average all returned values)

Read value from selected input device. Stored in provided measurement data structure.

run(data)

terapy.scan.readg module

Read scan event class

class terapy.scan.readg.Read(parent=None)

Bases: terapy.scan.read.ReadBase

Read scan event class

edit_label(event, pos)
onSelectIndex(event=None)
onSelectInput(event=None)
populate()
refresh()
run(data)
set(parent=None)
class terapy.scan.readg.ReadEventDialog(parent=None, title='Select measurement source', inlist=[], value=0, index=0)

Bases: wx._windows.Dialog

Read scan event configuration dialog

GetValue()

Return dialog value.

Output:
selected input device index (int), selected quantity index (int)

terapy.scan.repeat module

Repeat measurement scan event class

class terapy.scan.repeat.Repeat(parent=None)

Bases: terapy.scan.base.ScanEvent

Repeat measurement scan event class

Repeat measurement multiple times and store results separately.

get_icon()
get_operation_count()
populate()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.reset module

Reset device scan event class

class terapy.scan.reset.InstrumentSelectionDialog(parent=None, title='Reset instrument', instrlist=[], instr=0)

Bases: wx._windows.Dialog

Reset device scan event configuration dialog

GetValue()

Return dialog value.

Output:
index of selected device (int)
class terapy.scan.reset.Reset(parent=None)

Bases: terapy.scan.base.ScanEvent

Reset device scan event class

Trigger reset for selected device.

edit_label(event, pos)
get_icon()
onSelectInstr(event=None)
populate()
refresh()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.save module

Save scan event base class

class terapy.scan.save.FileSelectionDialog(parent=None, title='Select output file', fname='', wildcard='', autoname=True)

Bases: wx._windows.Dialog

Save scan event configuration dialog

GetValue()

Return dialog values.

Output:
file name (str), auto name (bool)
OnAutonameCheck(event=None)

Actions following ticking autoname checkbox.

Parameters:
event - wx.Event
OnFilenameButton(event=None)

Actions triggered by ”...” button press.

Parameters:
event - wx.Event
OnKillFocus(event=None)

Actions after file name text box loses focus.

Parameters:
event - wx.Event
OnSetFocus(event=None)

Actions on file name text box focusing.

Parameters:
event - wx.Event
class terapy.scan.save.SaveBase(parent=None)

Bases: terapy.scan.base.ScanEvent

Save scan event base class

edit_label(event, pos)
get_icon()
get_wildcard()
make_filename()
populate()
refresh()
run(data)
set(parent=None)

terapy.scan.save_h5 module

Save to HDF5 scan event class

class terapy.scan.save_h5.Save_H5(parent=None)

Bases: terapy.scan.save.SaveBase

Save to HDF5 scan event class

run(data)

terapy.scan.save_txt module

Save to text file scan event class

class terapy.scan.save_txt.Save_TXT(parent=None)

Bases: terapy.scan.save.SaveBase

Save to text file scan event class

check_validity(data)
run(data)

terapy.scan.save_xls module

Save to Excel spreadsheet scan event class

class terapy.scan.save_xls.Save_XLS(parent=None)

Bases: terapy.scan.save.SaveBase

Save to Excel spreadsheet scan event class

check_validity(data)
run(data)

terapy.scan.scan_l module

List scan event class

class terapy.scan.scan_l.ListLoopSettingsDialog(parent=None, title='Loop properties', axlist=[], axis=0, dlist=[0.0])

Bases: wx._windows.Dialog

List scan event configuration dialog

GetValue()

Return dialog values.

Output:
index of selected axis device (int), list of points (float)
OnAdd(event=None)

Actions triggered when Add button is pressed.

Parameters:
event - wx.Event
OnRemove(event=None)

Actions triggered when Remove button is pressed.

Parameters:
event - wx.Event
OnSelectSheetCell(event)

Actions triggered by cell selection in list.

Parameters:
event - wx.Event
OnSelectSheetRange(event)

Actions triggered by cell range selection in list.

Parameters:
event - wx.Event
OnSheetCopy(event=None)

Actions triggered by copy action on list.

Parameters:
event - wx.Event
OnSheetPaste(event=None)

Actions triggered by paste action on list.

Parameters:
event - wx.Event
class terapy.scan.scan_l.PointList(title='', data=[0.0])

Bases: wx.grid.PyGridTableBase

Table base class for point list

DeleteRows(pos, num=0)

Delete given row.

Parameters:
pos - position (int) num - not used, only here to satisfy class specs
Output:
True if successful
GetColLabelValue(col)

Return column label for given index.

Parameters:
col - column index (int)
Output:
column label (str)
GetNumberCols()

Return number of columns.

Output:
number of columns (int)
GetNumberRows()

Return number of rows.

Output:
number of rows (int)
GetValue(row, col)

Return value for given row and column index.

Parameters:
row - row index (int) col - column index (int)
Output:
value (float)
InsertRows(pos, num)

Insert given number of empty rows at given position.

Parameters:
pos - position (int) num - number of new rows (int)
SetValue(row, col, val)

Set value of given row and column index.

Parameters:
row - row index (int) col - column index (int) value - value (float)
class terapy.scan.scan_l.Scan_L(parent=None)

Bases: terapy.scan.scan_s.Scan

List scan event class

Scan given axis device following given list of values.

populate()
refresh()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.scan_lf module

List scan from file event class

class terapy.scan.scan_lf.ListFileSelectionDialog(parent=None, title='Select output file', axlist=[], axis=0, fname='')

Bases: wx._windows.Dialog

List scan from file configuration dialog

GetValue()

Return dialog values.

Output:
index of selected device (int), file name (str)
onFilenameButton(event=None)

Actions triggered by ”...” button press.

Parameters:
event - wx.Event
onKillFocus(event=None)

Actions after file name text box loses focus.

Parameters:
event - wx.Event
onSetFocus(event=None)

Actions on file name text box focusing.

Parameters:
event - wx.Event
class terapy.scan.scan_lf.Scan_LF(parent=None)

Bases: terapy.scan.scan_s.Scan

List scan from file event class

Scan given axis device following list of values taken from given file.

edit_label(event, pos)
parse_list()
populate()
refresh()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.scan_s module

Linear straight scan event class

class terapy.scan.scan_s.LoopSettingsDialog(parent=None, title='Loop properties', axlist=[], axis=0, vmin=0.0, vmax=25.6, N=257, dv=0.1)

Bases: wx._windows.Dialog

Loop scan event configuration dialog

GetValue()

Return dialog values.

Output:
selected axis device index, start value (float), end value (float), number of steps (int), step size (float)
OnValueChange(pos, event=None)

Actions triggered by value change in one of the text boxes.

Parameters:
pos - index of changed element (int) event - wx.Event
class terapy.scan.scan_s.Scan(parent=None)

Bases: terapy.scan.base.ScanEvent

Linear straight scan event class

Scan given axis device between two values in a given number of steps.

edit_label(event, pos)
get_icon()
get_operation_count()
onSelectAxis(event=None)
populate()
refresh()
run(data)
set(parent=None)
set_property(pos, val)

terapy.scan.scan_zz module

Linear zig-zag scan event class

class terapy.scan.scan_zz.Scan_ZZ(parent=None)

Bases: terapy.scan.scan_s.Scan

Linear zig-zag scan event class

Scan given axis device between two values in a given number of steps.

refresh()
run(data)

terapy.scan.sequence module

Sequence scan event class

class terapy.scan.sequence.Sequence(parent=None)

Bases: terapy.scan.base.ScanEvent

Sequence scan event class

Scan event sequence.

get_icon()
run(data)

terapy.scan.wait module

Wait scan event class

class terapy.scan.wait.Wait(parent=None)

Bases: terapy.scan.base.ScanEvent

Wait scan event class

Wait for specified amount of time.

get_icon()
populate()
run(data)
set(parent=None)
set_property(pos, val)

Module contents

Functions and classes to handle scan procedures and events.

Properties:
modules - list of available scan events

Each scan function must be implemented as a ScanEvent class (see base.py). ScanEvent classes contained in Python scripts within this folder will be automatically recognized and added to scan event list.