class mla_gui.ErrPanel(parent)

Class for having a panel around the error status field. This way we can set the background color and flash it.

class mla_gui.IMPStatusBar(parent)
class mla_gui.ImGUI(parent, settings, id=-1, title='', pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=675290688)

This class contains the menu bar and handles the panels.



The panels are not closed, only hidden. When a panel is shown again, it will look the same as before it was hidden.


>>> main.gui.hide_all_panels()
set_docksize(panel, size)

A dock can contain one or more docked panels. This function sets the size of the dock that contains a specified panel.

  • panel – panel
  • size – integer size of the dock in pixels


>>>  main.gui.set_docksize(main.message_log, 300)
>>>  main.gui.set_docksize(, main.gui.GetSize()[0]/2) #Use half the horizontal window size
show_panel(panel, pos=None)
  • panel – panel to show
  • pos – string or list of strings that specify the position. The string should represent a member function call of a AuiPaneInfo object. See the examples and the link under References.


>>> main.gui.show_panel(main.scopepanel)
>>> main.gui.show_panel(
>>> main.gui.show_panel(main.scriptpanel)
>>> main.gui.show_panel(, pos='Left()')
>>> main.gui.show_panel(main.message_log, pos='Bottom().Dock()')
>>> main.gui.show_panel(main.lockinpanel)
>>> main.gui.show_panel(main.lockin_setup_panel)
>>> main.gui.show_panel(main.frequency_count_panel)
>>> main.gui.show_panel(main.fsweeppanel)
>>> main.gui.show_panel(main.message_log, pos=('Dock()', 'Bottom()', 'Layer(1)'))


class mla_gui.MyAuiManager(*args, **keys)

Destroys or hides the pane depending on its flags.

Parameters:pane_info – a AuiPaneInfo instance.

Override because ClosePane will dock a floating pane for some reason, and we don’t want that. So we let ClosePane do its thing, and then we set the pane as floating again. Possibly there’s a better way… //Riccardo 2018-04-11

Script panel

class scriptpanel.ScriptPanel(parent, mla, shell, scriptplot, id=-1, stdout=None, stderr=None)

The ScriptPanel contains a text editor and a toolbar to open, save and execute scripts.


Open a file in the script editor. The file will not be executed.

Parameters:filename – Full path, or path relative to the system ‘mla_scripts’ folder.


When a script runs, the path to the current script is stored in the variable __scriptfile__.


If a file is already opened it will be closed without saving.


>>> main.scriptpanel.open_file('')
>>> main.scriptpanel.open_file('built-in')
>>> main.scriptpanel.open_file('c:\myscripts\')
>>> main.scriptpanel.open_file(__scriptfile__)

Scripting utilities

This module collects various utility functions that can be useful in the script editor in the MLA software.

scriptutils.generate_filename(foldername_format='%Y-%m-%d', filename_format='%H_%M_%S')

Generate the complete path to a new file in the user data folder containing the data as folder name and time as filename. New subfolders are created if necessary.

  • foldername_format – string, will be passed to time.strftime() to generate the folder name
  • filename_format – string, will be passed to time.strftime() to generate the file name

The full path to a new file.

Return type:



>>> scriptutils.generate_filename() + '.png'
'C:\IMP Sessions and Settings\sessions\2015-09-04\08_45_30.png'
>>> scriptutils.generate_filename(foldername_format='sample_1', filename_format=rig2_%Y-%m-%d__%H_%M_%S) + '.txt'
'C:\IMP Sessions and Settings\sessions\sample_1\rig2_2015-09-04__08_56_37.txt'

LockinPlotPanel object

class lockin_plotpanel.LockinPlotPanel(parent, eh, name, position, layer, n_channels, id=-1)

Shell panel

class impgui.ShellPanel(parent, id=-1)

Panel that contains a python shell.


Adds a text to the prompt of the python shell. The text command is not executed.

Parameters:txt – string


impgui.flash_color(widget, color='yes', time=0.8, reset_color='#FFFFFF')

Change background color of a wx widget for a certain amount of time

  • widget (a wx window object (e.g. ex.TextCtrl)) –
  • color (string) – ‘yes’ (default) for a green color ‘no’ for red or any argument accepted by widget.SetBackgroundColour
  • time (float) – Time in seconds before resetting color
  • reset_color (color) – Color which will be set after time (default: “#FFFFFFF”)

Lockin setup panel

class lockin_setup_panel.LockinMonitor(parent, eh, tone_idx, id=-1)
Destroy(self) → bool
class lockin_setup_panel.LockinMonitorPlot(parent, eh, id=-1)
class lockin_setup_panel.LockinSetupPanel(parent, eh, id=-1)

Panel for setting up amplitudes and frequencies of the Multifrequency Lockin

Destroy(self) → bool

Read current values from FPGA into the GUI


Load all the set up parameters from the mla.lockin object and write them out to the lockin setup panel GUI. This is not done automatically when a parameter is changed because the user may not want the typed in values to be overwritten.


>>> main.lockin_setup_panel.load_from_mla_lockin()

Calculate n-values from frequency list (in Hz) and self._spp


Read values from GUI and set the properties in the FPGA

Oscilloscope panel

class scopepanel.PlotPanel(parent, eh, name, position, layer, n_channels, n_lockin_ports, id=-1)

Class for the Oscilloscope plot panel with time and spectrim plots.

set_limits(x1_min, x1_max, y1_min, y1_max, x2_min, x2_max, y2_min, y2_max)

Set the axes limits of the time and freqeuncy plots.

  • x1_min – float [ms]
  • x1_max – float [ms]
  • y1_min – float [V]
  • y1_max – float [V]
  • x2_min – float [kHz]
  • x2_max – float [kHz]
  • y2_min – float [dBV]
  • y2_max – float [dBV]


>>> main.scopepanel.set_limits(0, 0.1, -1, 1, 0, 200, -140, 10)

Lockin plot panel

class lockin_plotpanel.Frequency_counting_panel(parent, eh, name, position, layer, n_channels, id=-1)
set_subplot_layout(nr, nc)

Set how many rows and columns of subplots the panel should have.

  • nrows – integer number of rows
  • ncols – integer number of columns


>>> main.lockinpanel.set_subplot_layout(nrows=2, ncols=2)
class lockin_plotpanel.LockinPlotPanel(parent, eh, name, position, layer, n_channels, id=-1)
class lockin_plotpanel.PlotPanel(parent, eh, name, position, layer, n_channels, id=-1)

Class for handling lockin plots

set_axis_properties(row, col, tone_indices=None, quantity='Amplitude', yscale_type='Linear', ymin=None, ymax=None, legend_pos=-1, history_length=30, title='')

Set the properies of one of the subplots in the plot panel.

  • row – integer, identifies which subplot to configure
  • col – integer, identifies which subplot to configure
  • tone_indices – list of integers, set which tones to plot
  • quantity – “Amplitude”, “Phase”, “I” or “Q”, see table below
  • yscale_type – “Linear”, Log” or “Wrap”, see table below
  • ymin – float, minimum value of the y-axis
  • ymax – float, maximum value of the y-axis
  • legend_pos – integer -1-10, position of the legend, see table below
  • history_length – float [seconds], how long history to plot (i.e. the scale of the x-axis)
quantity Description
Amplitude amplitude
Phase phase
I In-phase component
Q Quadrature-phase component
yscale_type Description
Linear Linear
Log Logarithmic
Wrap Wrap at limits
legend_pos Description
-1 No legend
0 best
1 upper right
2 upper left
3 lower left
4 lower right
5 right
6 center left
7 center right
8 lower center
9 upper center
10 center


>>> main.lockinpanel.set_axis_properties(row=0, col=0,
        tone_indices = [1, 3, 7],
        quantity = "Amplitude",
        yscale_type = "Log",
        ymin = 1e-6,
        ymax = 10,
        legend_pos = 1)
set_subplot_layout(nrows=None, ncols=None)

Set how many rows and columns of subplots the panel should have.

  • nrows – integer number of rows
  • ncols – integer number of columns


>>> main.lockinpanel.set_subplot_layout(nrows=2, ncols=2)
class lockin_plotpanel.PlotPanelBase(parent, eh, name, position, layer, id=-1)
class lockin_plotpanel.UserPlotPanel(parent, eh, name, position, layer, id=-1)

Line colors

The colors in the “Lockin history” plot are selected from a predefined list to ensure maximal color contrast between each line. However, depending on the physical or logical topology of the measurement setup other color schemes may be desired. To edit the colors, set the mla_globals.lockin_colors variable from the shell or a script. Below are a few examples:

# Cycle the colors red, green, blue, cyan, magenta, yellow, white
mla_globals.lockin_colors = 'rgbcmyw'

# Cycle the colors red, green, blue
mla_globals.lockin_colors = ('#ff0000','#00ff00', '#0000ff')

# Cycle the colors cyan, magenta, yellow
mla_globals.lockin_colors = ((0, 1, 1), (1, 0, 1), (1, 1, 0))

# Get a unique color for each frequency from the jet colormap. See all available colormaps here:
mla_globals.lockin_colors =,1,mla.lockin.nr_input_freq))