|
Online documentation - Terminal functions
Terminal functions (also called terminal commands) are defined in /usr/lib/mezurit2/mezurit2control.py and ~/.config/mezurit2/terminal.py (see Installed files).
For more information on adding new functions, go here.
Many terminal functions are similar to compute (channel or trigger) functions and vice versa.
Equivalent or related functions are noted where appropriate.
All standard terminal functions are detailed here except for utility and demonstration functions.
Note:
Several functions expose features that are not present in the GUI, including gpib(), request_pulse(), fire_scope_pulse(), sweep_link(), and set_follower().
Table of Contents
General functions
xleep (delta_t)
delta_t | float | Time in seconds to pause before continuing |
return value | bool | True on success, False on failure |
see also: wait()
gpib (brd, pad, msg, eos=0x0, expect_reply=True)
brd | int | Index of GPIB board: 0 or 1 for physical boards, 2 for virtual board |
pad | int | Primary address of the instrument: 1 ... 31 |
msg | str | GPIB message to send |
eos | int | (Optional) End-of-string byte to use for the instrument, default: 0x0 |
expect_reply | bool | (Optional) Whether Mezurit 2 should wait for a reply from the instrument, default: True |
return value | str | Reply (if applicable) |
set_panel (pid)
pid | int | Index of desired page (-1 for Setup, 0 or 1 for Panels) |
return value | bool | True on success, False on failure |
get_panel ()
return value | int | Index of the current panel, e.g. 0 for Panel 0 (-1 for Setup) |
see also: panel()
Configuration functions
Note: Config files may be saved at any time, but loaded in setup mode only.
save_config_file (filename) load_config_file (filename)
filename | str | Relative or absolute path to config file |
return value | bool | True on success, False on failure |
save_user_default ()
return value | bool | True on success, False on failure |
effect: Save the current configuration to ~/.config/mezurit2/default.mcf (see Installed files).
load_user_default () load_system_default () load_internal_default ()
return value | bool | True on success, False on failure |
effect: Load a default configuration.
load_last_config ()
return value | bool | True on success, False on failure |
effect: Load the configuration present on last shutdown.
set_var (line)
line | str | Setting in the form 'variable=value' (see any MCF file for a complete list of possible variables) |
return value | bool | True on success, False on failure |
get_var (var)
var | str | Setting to query, i.e. the variable in 'variable=value' |
return value | str | Value as a string if the variable was found, otherwise ''. |
get_sweep_id (channel)
channel | int | Index of virtual channel |
return value | int | Associated sweep id (-1 if not invertible, -2 if argument error) |
This function is needed to determine the config string for a sweep setting, as explained here.
Acquisition functions
set_recording (on)
on | bool | True to start, False to stop recording data |
return value | bool | True on success, False on failure |
see also: set_recording()
gpib_pause (paused)
paused | bool | True to cease, False to resume updating GPIB channel functions |
return value | bool | True on success, False on failure |
get_time ()
return value | float | Time in seconds since the current panel was first started or its timer was reset |
see also: time()
channel_value (channel)
channel | int | Index of virtual channel, i.e. 2 for X2 |
return value | float | Current value of Xchannel, if known, otherwise 0 |
see also: ch()
channel_known (channel)
channel | int | Index of virtual channel, i.e. 2 for X2 |
return value | bool | True if the value of Xchannel is known, otherwise False |
DAC control functions
set_dac (channel, target)
channel | int | Index of virtual channel to set (e.g. 2 for X2), must be invertible |
target | float | Target value in scaled units (e.g. mV) |
return value | bool | True on success, False on failure |
see also: set_dac()
sweep_up (channel) sweep_down (channel) sweep_stop (channel)
catch_sweep (event, channel)
event | str | Event to catch: 'zerostop', 'min', 'max', 'min_posthold', 'max_posthold' |
channel | int | Index of virtual channel |
return value | bool | True on success, False on failure |
effect: Wait until the specified event occurs while sweeping Xchannel.
sweep_link (channel1, channel2)
channel1 | int | Index of virtual channel to link |
channel2 | int | Index of virtual channel to link |
return value | bool | True on success, False on failure |
effect: Links sweeping of Xchannel1 with sweeping of Xchannel2 and vice versa - they will start and stop together.
sweep_link_clear ()
return value | bool | True on success, False on failure |
effect: Unlinks all sweeps on the current panel.
Note:
Sweep linking is deprecated in favor of the more general method offered by set_follower().
set_follower (leader, follower, expr)
leader | int | Index of leader virtual channel (must be invertible) |
follower | int | Index of follower virtual channel (must be invertible) |
expr | str | Python expression used to compute the follower target based on the leader value, as function of x |
return value | bool | True on success, False on failure |
effect: The follower channel will be set automatically whenever the leader channel is set. More information here.
remove_follower (leader)
leader | int | Index of leader virtual channel |
return value | bool | True on success, False on failure |
show_followers ()
return value | bool | True on success, False on failure |
effect: A list of leader-follower arrangements will be printed in the status area.
Scope functions
request_pulse (channel, target)
channel | int | Index of virtual channel to pulse when (and if) scope fires, must be invertible |
target | float | Target value in scaled units (e.g. mV) |
return value | bool | True on success, False on failure |
see also: request_pulse()
cancel_pulse (channel)
channel | int | Index of virtual channel which should not be pulsed |
return value | bool | True on success, False on failure |
see also: cancel_pulse()
fire_scope () cancel_scope ()
fire_scope_pulse (channel, target)
channel | int | Virtual channel to pulse, must be invertible |
target | float | Target value in scaled units (e.g. mV) |
return value | bool | True on success, False on failure |
see also: fire_scope_pulse()
Note:
fire_scope() and fire_scope_pulse() return immediately, i.e. while the scope may still be scanning.
catch_scan_start () catch_scan_finish ()
return value | bool | True on success, False on failure |
effect: Wait until scope starts or finishes (successfully or prematurely).
Trigger functions
arm_trigger (id) disarm_trigger (id)
id | int | Index of trigger to arm or disarm, range: 0 ... 7 |
return value | bool | True on success, False on failure |
see also: arm_trigger(), disarm_trigger()
force_trigger (id) cancel_trigger (id)
id | int | Index of trigger to start (force) or stop, range: 0 ... 7 |
return value | bool | True on success, False on failure |
see also: force_trigger(), cancel_trigger()
catch_signal (signal)
signal | str | Text signal to catch |
return value | bool | True on success, False on failure |
see also: emit_signal()
Note:
catch_signal() will not return until the specified signal is received.
Buffer functions
new_set ()
return value | bool | True on success, False on failure |
see also: new_set()
t_zero ()
return value | bool | True on success, False on failure |
effect: Reset the current panel timer
see also: t_zero()
save_data (filename)
filename | str | Relative or absolute filename to which to save data (if already existing, data will be appended) |
return value | bool | True on success, False on failure |
see also: save_data()
clear_buffer (confirm, tzero)
confirm | bool | Whether to confirm clearing of unsaved data using a dialog box |
tzero | bool | Whether to simultaneously reset the panel timer |
return value | str | Reply indicating whether the buffer was actually cleared |
Autosweep functions
megasweep_estimate (sweep_ch, N_step)
sweep_ch | int | Index of virtual channel to be swept |
N_step | int | Proposed number of steps (sweeps) |
return value | float | Estimated time in hours |
improved in version 0.81
megasweep_up (sweep_ch, step_ch, V_start, V_end, N_step, filename) megasweep_down (sweep_ch, step_ch, V_start, V_end, N_step, filename)
sweep_ch | int | Index of virtual channel to sweep |
step_ch | int | Index of virtual channel to step between sweeps |
V_start | float | Starting "voltage" for Xstep_ch |
V_end | float | Ending "voltage" for Xstep_ch |
N_step | int | Number of segments between V_start and V_end |
filename | str | Relative or absolute filename to which to save data |
return value | | none |
effect: The sweep will be repeated N_step+1 times (to include both endpoints), saving data on either up or down sweeps
minisweep_up (sweep_ch, N_step, filename) minisweep_down (sweep_ch, N_step, filename)
sweep_ch | int | Index of virtual channel to sweep |
N_step | int | Number of steps (sweeps) |
filename | str | Relative or absolute filename to which to save data |
return value | | none |
effect: The sweep will be repeated exactly N_step times, saving data on either up or down sweeps
|