Console commands
Console is a text command based interface that can directly interact with Spectrometer and Devices.
Script is a sequence of Console commands that performs some task.
Scripts can be used to enhance GUI, program GUI elements and plugins and alter program environment at run-time.
Commands can be issued from the Log Window and Status Bar tabs.
Console is under development and not all functions are available and can be used. Here are some ideas which may work.
Syntax:
expression - show result of the expression expression; - do not show expression result
Comments:
Introduced in version 3.8.7
Console uses the same comment syntax as PPL — see Comments.
%% the rest of the line is ignored a = 35; %% trailing comment a = %this is ignored% 35;
Inline comments %...% may only contain letters, digits, spaces and underscores. Because % is also the modulo operator, avoid writing two modulo operations in one line without brackets (a % b % c) — write (a % b) % c instead.
Supported functions:
- clear(var) - clear() clears all variables; clear('var') clears variable 'var'
- help(function) - help on functions
- iff(condition,expression) - conditional assignment, iff evaluate string _expression if _contion is true
- sleep(delay_ms) - delay in ms
- whos(var) - list variable(s) type and value, var - name of variable or nothing
Simple math:
a = 35; b = 45; c = 'hello'; d = ' world!'; a+b c+d
Devices:
.spec.dev.list %% list of devices
Properties:
.spec.System.prop.list %% list properties .spec.System.prop.Wait = 10 %% set property (wait 10 sec) s = .spec.AP.Sampling; %% get property
Interfaces:
.spec.intf.list %% list of interfaces .spec.intf.TCPIP.list %% list of sessions .spec.intf.NIVISA.session0.help %% help on commands .spec.intf.delete='NIVISA' %% delete interface (if not used) .spec.intf.NIVISA.session0.query='*IDN?' %% send GPIB command and read
Pulse configuration:
.spec.puls.softsync=1; %% software synchronization options .spec.puls.rtpos=0; %% repetition time position (0 - no repetition time) .puls.comm.mwpulse.phase.ch1.use=0; %% -- experimental syntax -- .puls.awg.shape.MATLAB='px=1:100; p=[sin(px/100),cos(px/100)];'
Pulse shape of an analog (AWG) pattern:
Introduced in version 3.8.7
The waveform, its expression and its pattern file are the fields the pulse configuration dialog edits on its Shape tab. They are addressed as .puls.<command>.<pattern>.<property> and a console change is applied exactly like a change made in the dialog.
.puls.awg.shape.help %% commands of the pattern .puls.awg.shape.shapes %% names accepted by .shape .puls.awg.shape.shape %% current waveform, e.g. 'psSechTanh' .puls.awg.shape.shape='psSechTanh' %% set the waveform by name .puls.awg.shape.shape='SechTanh' %% the bare name works as well .puls.awg.shape.expression='amp*exp(-t^2/par1^2)' %% psEXPRESS waveform .puls.awg.shape.source='mypattern.dat' %% pattern file of psPattern...
Here awg is the pulse command and shape is the pattern inside it. The waveform can also be set by its index (.shape=11), the name is the recommended form. Digital and bitwise patterns have no waveform — setting one reports an error.

