What can you do with scripting in SIGVIEW? 


By using scripting functionality, you can extend SIGVIEW with small script programs to implement new functions, for example support for new file types, new analysis or processing methods or interfaces with other systems.


SIGVIEW uses Julia language for writing scripts. You can find more information about the language itself  here.


Is it something only for software developers?


You need only a very basic know-how in software development. There is no need to write big complex programs. Generally, the program frame is already provided as a template and you just need to write the actual processing part. By using Julia language constructs and available packages, your programs will very often be no longer than 10 lines of code. If you have some experience with MATLAB, Python or R, you will need only a few minutes to start working with Julia.


Script window types 


There are three main use cases, i.e. window types, for using scripts in SIGVIEW:


1. Signal window


These scripts can process input from one or more signal or instrument windows and produce the content of a new signal windows as result.



The resulting window will be just like any other SIGVIEW window, allowing you to zoom, inspect, measure the signal or apply any other SIGVIEW tools to it.


Also, you would use this type of script window if you would only like to process the inputs without generating new result signal, for example to analyse inputs and generate external alert. In that case, you can just provide some status or info text to be displayed in a window.


For further details about creating and using signal scripts, see this chapter.

2. Custom display window


This window type is very similar as the previous one. It also takes any number of input signal or instrument windows, and uses Julia scripting to perform some analysis. But, instead of generating a result signal which would be displayed in a standard SIGVIEW plot, it generates a custom plot by using Julia plotting capabilities and inserts that plot into SIGVIEW's window. The inserting of plot into the SIGVIEW window is completely automatic and fast. You only have to use a predefined function in your script in order to integrate Julia plot into SIGVIEW. For details, see Custom display windows.




Since the resulting window is simply displaying an external bitmap, you can not apply any other SIGVIEW tools to it.


3. Signal source window


These script windows are used for inserting new signals into SIGVIEW, for example by loading from files or acquiring from DAQ devices. These windows do not have parent(source) windows.


For further details about creating and using signal source scripts, see this chapter.



Creating new script windows


Script windows can be created by using corresponding options in main menu, Scripts menu. Signal source script windows can be created anytime, and signal script windows only if another window is currently active. That window will be a parent (source) window for the new created signal script window.


Signal script windows with multiple parent (source) windows can be created from Control Window. See this chapter for details. 


After creating new script window, a source code editor will be opened immediately for the user to write the script. As soon as script source code file is saved from the editor, SIGVIEW will read it, execute it and the result will be displayed in SIGVIEW. You can keep working on the code by editing it and saving again. SIGVIEW will be monitoring the source code file and as soon as any change is detected, the script will be executed again so you will see the results immediately.

In case of an error in the script, a corresponding error message will be displayed in the SIGVIEW's window as a plain text.

Editing scripts


To change the script source code of an existing window, you can use the option Edit script... from the window's context menu or main menu, Scripts/Edit script... option. Just as with creating a new window, SIGVIEW will monitor the changes in a file and each time after the file was changed and saved, it will be executed again.

Code editor


For editing source code, SIGVIEW uses an embedded instance of the Notepad++ editor. You can change the default editor from application settings dialog.

Opening Julia console


You can open Julia console window anytime by using main menu option Scripts/Julia console. You will mostly use the console to install new packages, but you can also use it to test some Julia expressions interactively.


Adding needed packages


SIGVIEW installation includes only a basic set of core Julia functions. For most advanced Julia functions, you will have to add a corresponding package into your Julia installation. For example, to add Plots package, you would open Julia console and type: 


using Pkg; Pkg.add("Plots"); using Plots


Instead of adding the packages one-by-one, you can use a built-in function to add many commonly used packages at once.  This function is located in the main menu, Scripts/Download and install common Julia packages... After selecting this function, a Julia console will be opened and many common signal analysis and plotting packages will be installed:


  • Plots
  • StatsPlots
  • DSP
  • Interpolations
  • SignalAnalysis
  • FourierAnalysis
  • Statistics
  • Images
  • XLSX
  • LibSndFile
  • ContinuousWavelets
  • Wavelets


Download and installation of these packages can last quite long, up to 15-20 minutes.


Also, if SIGVIEW detects that certain package is missing after executing a new script, it will offer you to install it automatically, without manually opening Julia Console and typing "add(...)" commands.