\documentclass[a4paper,11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} % LY1 also works
\usepackage[margin=1in]{geometry}

%% Font settings suggested by fbb documentation.
\usepackage{textcomp} % to get the right copyright, etc.
\usepackage[lining,tabular]{fbb} % so math uses tabular lining figures
\usepackage[scaled=.95,type1]{cabin} % sans serif in style of Gill Sans
\usepackage[varqu,varl]{zi4}% inconsolata typewriter
\useosf % change normal text to use proportional oldstyle figures
%\usetosf would provide tabular oldstyle figures in text

\usepackage{microtype}
\usepackage{siunitx}
\DeclareSIUnit{\belmilliwatt}{Bm}
\DeclareSIUnit{\dBm}{\deci\belmilliwatt}
\sisetup{range-phrase=--, range-units=single, binary-units = true}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{svg}
%\usepackage{hyperref}
\usetikzlibrary{arrows, shadows}
\tikzset{%
  cascaded/.style = {%
    general shadow = {%
      shadow scale = 1,
      shadow xshift = -1ex,
      shadow yshift = 1ex,
      draw,
      thick,
      fill = white},
    general shadow = {%
      shadow scale = 1,
      shadow xshift = -.5ex,
      shadow yshift = .5ex,
      draw,
      thick,
      fill = white},
    fill = white, 
    draw,
    thick,
    minimum width = 1.5cm,
    minimum height = 2cm}}
    
\usepackage{enumitem}
\usepackage{longtable}
\setitemize{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt}
\setlist{leftmargin=*}
\usepackage{listings}
\definecolor{darkgreen}{RGB}{0,140,0}
\lstset{
	basicstyle=\ttfamily,
	frame=single,
	breaklines=true,
	morecomment=[l][\color{darkgreen}]{\#},
}
\lstnewenvironment{example}{\lstset{
    ,frame=single
    ,xleftmargin=2em
    ,xrightmargin=2em
   % ,backgroundcolor=\color{lightgray}
    ,title=Example
}}{}
\usepackage[os=win]{menukeys}
\renewmenumacro{\keys}[+]{shadowedroundedkeys}

\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{tabularx} 

\usepackage{stackengine}
\usepackage{scalerel}
\usepackage{xcolor,mdframed}
\newcommand\danger[1][5ex]{%
  \renewcommand\stacktype{L}%
  \scaleto{\stackon[1.3pt]{\color{red}$\triangle$}{\tiny !}}{#1}%
}

\newenvironment{important}[1][]{%
   \begin{mdframed}[%
      backgroundcolor={red!15}, hidealllines=true,
      skipabove=0.7\baselineskip, skipbelow=0.7\baselineskip,
      splitbottomskip=2pt, splittopskip=4pt, #1]%
   \makebox[0pt]{% ignore the withd of !
      \smash{% ignor the height of !
         %\fontsize{32pt}{32pt}\selectfont% make the ! bigger
         \hspace*{-45pt}% move ! to the left
         \raisebox{-5pt}{% move ! up a little
            {\danger}% type the bold red !
         }%
      }%
   }%
}{\end{mdframed}}

\newcommand\info[1][5ex]{%
  \renewcommand\stacktype{L}%
  \scaleto{\stackon[1.2pt]{\color{blue}$\bigcirc$}{\raisebox{-1.5pt}{\small i}}}{#1}%
}

\newenvironment{information}[1][]{%
   \begin{mdframed}[%
      backgroundcolor={blue!15}, hidealllines=true,
      skipabove=0.7\baselineskip, skipbelow=0.7\baselineskip,
      splitbottomskip=2pt, splittopskip=4pt, #1]%
   \makebox[0pt]{% ignore the withd of !
      \smash{% ignor the height of !
         %\fontsize{32pt}{32pt}\selectfont% make the ! bigger
         \hspace*{-45pt}% move ! to the left
         \raisebox{-5pt}{% move ! up a little
            {\info}% type the bold red !
         }%
      }%
   }%
}{\end{mdframed}}

\usepackage{makecell}
\usepackage{hyperref}
\usepackage{xifthen}
\newcommand{\vna}{LibreVNA}
\newcommand{\gui}{\vna{}-GUI}

\newcommand{\screenshot}[2]{\begin{center}
\includegraphics[width=#1\textwidth]{Screenshots/#2}
\end{center}}


\newcommand{\event}[3]{
\noindent\textbf{Event:}
\begin{longtable}{p{.15\textwidth} | p{.80\textwidth} } 
\hline
\textbf{Effect:} & #1 \\ \hline
\textbf{Syntax:} & #2 \\ \hline 
\textbf{Parameters:} & \makecell[Xl]{#3} \\ \hline
\end{longtable}
}
\newcommand{\query}[4]{
\noindent\textbf{Query:}
\begin{longtable}{p{.15\textwidth} | p{.80\textwidth} } 
\hline
\textbf{Effect:} & #1 \\ \hline
\textbf{Syntax:} & #2 \\ \hline 
\textbf{Parameters:} & \makecell[tl]{#3} \\ \hline
\textbf{Return value:} & \makecell[tl]{#4} \\ \hline
\end{longtable}
}

\title{\vna{} SCPI Programming Guide}
\begin{document}
\maketitle

\setcounter{tocdepth}{3}
\tableofcontents

\clearpage

\section{Introduction}
The \gui{} contains a TCP server that can be used to control the \vna{} with SCPI commands.
\section{SCPI Server Configuration}
The server is configurable in the preferences: \menu[,]{Window,Preferences,General}
\screenshot{0.3}{serverconfig.png}
If enabled, it will accept any TCP connection at the configured port. Once the connection is established, it can be used to send SCPI commands and receive replies. Only one connection at a time is possible, if a second connection is created, the first one will be closed by the \gui{}. Alternatively, a port can be manually configured by setting the ``port'' argument:
\begin{lstlisting}
./LibreVNA-GUI --port 1234
\end{lstlisting}
This enables the SCPI server at the specified port, regardless of what is configured in the preferences (useful for starting multiple instances at different ports at the same time). If no graphical user interface is required, the \gui{} can be hidden:
\begin{lstlisting}
./LibreVNA-GUI --port 1234 --no-gui
\end{lstlisting}
\section{General Syntax}
The syntax follows the usual SCPI rules:
\begin{itemize}
\item All commands are case insensitive (implicitly converted to uppercase before evaluated)
\item The command tree is organized in branches, separated by a colon:
\begin{lstlisting}
VNA:TRACE:LIST?
\end{lstlisting}
\item Multiple commands can be concatenated in one line using a semicolon:
\begin{lstlisting}
DEVice:CONNECT;:DEVice:INFo:FWRevision?
\end{lstlisting}
\item If a subsequent command starts with a colon it is evaluated from the root branch, otherwise the last used branch is assumed:
\begin{lstlisting}
VNA:FREQuency:START 1000000;STOP 2000000 #No colon, VNA:FREQuency branch was used before
\end{lstlisting}
\item Branches and commands can be abbreviated by using only the uppercase part of their name, the following commands are identical:
\begin{lstlisting}
DEVice:INFo:LIMits:MINFrequency?
DEV:INF:LIM:MINF?
\end{lstlisting}
\item Every query generates a response, terminated with a newline character (exceptions exist for a few queries which return more than one line)
\item Some commands require additional arguments that have to be passed after the command (separated by spaces):
\begin{lstlisting}
DEV:REF:OUT 10
\end{lstlisting}
\item Two types of commands are available:
\begin{itemize}
\item \textbf{Events} change a setting or trigger an action. They have no response
\item \textbf{Queries} request information. They end with a question mark.
\end{itemize}
Some commands are both events and queries, depending on whether the question mark is present:
\begin{lstlisting}
VNA:FREQ:SPAN 50000000 # Set the span
VNA:FREQ:SPAN? # Read the current span
\end{lstlisting}
\end{itemize}
\section{Commands}
\subsection{General Commands}
\subsubsection{*IDN}
\query{Returns the identifications string}{*IDN?}{None}{LibreVNA,LibreVNA-GUI,dummy\_serial,<software version>}
\subsubsection{*RST}
\event{Resets the GUI (and any connected device) to the default state}{*RST}{None}
\subsubsection{*CLS}
\event{Clears the event status register}{*CLI}{None}
\subsubsection{*ESE}
\event{Configures the event status enable register}{*ESE}{<enabled\_bits\_decimal>}
\query{Returns the event status enable register}{*ESE?}{None}{<enabled\_bits\_decimal>}
\subsubsection{*ESR}
\query{Returns the event status register}{*ESR?}{None}{<set\_bits\_decimal>}
The bits are used according to IEEE 488:
\begin{longtable}{p{.1\textwidth} | p{.1\textwidth} | p{.4\textwidth} }
\textbf{Bitvalue} & \textbf{Name} & \textbf{Meaning}\\
\hline
1 & OPC & Operation complete\\
2 & RQC & Request control (not used)\\
4 & QYE & Query error (not used)\\
8 & DDE & Device dependent error (not used)\\
16 & EXE & Execution error (not used)\\
32 & CME & Command error\\
64 & URQ & User request (not used)\\
128 & PON & Power on (not used)\\
\end{longtable}
\subsubsection{*OPC}
\event{Sets the OPC bit in the event status register after all operations are complete}{*OPC}{None}
\query{Returns a 1 after every active operation has completed}{*OPC?}{None}{1}
\subsubsection{*WAI}
\event{Blocks further command parsing until all active operations are complete}{*WAI}{None}
\subsubsection{*LST}
\query{Lists all available commands}{*LST?}{None}{List of commands, separated by newline}
\subsection{Device Commands}
This section contains general device commands, available regardless of the current mode.
\subsubsection{DEVice:DISConnect}
\event{Disconnects from the device}{DEVice:DISConnect}{None}

\subsubsection{DEVice:CONNect}
\event{Connects to a device. If no serialnumber is specified, the connection is made with the first device found}{DEVice:CONNect [<serialnumber>]}{<serialnumber> Serialnumber of the device that should be connected}
\begin{example}
:DEV:CONN 206039903350
\end{example}
\query{Queries the serial number of the connected device}{DEVice:CONNect?}{None}{<serialnumber> or ``Not connected''}
\begin{example}
:DEV:CONN?
206039903350
\end{example}

\subsubsection{DEVice:UPDATE}
\event{Updates the firmware of the connected device}{DEVice:UPDATE <fw\_file>}{<fw\_file> Path to the firmware file}
Important points when saving/loading setup files through SCPI commands:
\begin{itemize}
\item The path must be either absolute or relative to the location of the GUI application.
\item If the LibreVNA-GUI (and thus also the SCPI server) is running on a different machine than the SCPI client, the firmware file must be stored on the machine that runs the GUI.
\end{itemize}

\subsubsection{DEVice:LIST}
\query{Lists all available devices by their serial numbers}{DEVice:LIST?}{None}{List of serialnumbers}
\begin{example}
:DEV:LIST?
206039903350,208939A23350
\end{example}

\subsubsection{DEVice:PREFerences}
This command provides read/write access to the preferences. The recommended way is usually to change the preferences manually in the GUI. But if for some reason that is not an option, this is also possible through the SCPI server. There is no complete documentation for all available preferences, refer to the source code.

\event{Set a preferences entry}{DEVice:PREFerences <name> <value>}{<name> Name of the preferences entry\\ <value> New value for the preferences entry}
\begin{example}
:DEV:PREF Startup.ConnectToFirstDevice false
\end{example}
Most settings take effect immediately but some (such as changing the port for the SCPI server) are only applied when the preferences are saved. Also see command~\ref{DEV:APPLYPREF}.

\query{Returns a preferences entry}{DEVice:PREFerences? <name>}{<name> Name of the preferences entry}{Current value of the preferences entry}

\subsubsection{DEVice:APPLYPREFerences}
\label{DEV:APPLYPREF}
\event{Permanently stores the preferences after a setting has been changed}{DEVice:APPLYPREFerences}{None}

\subsubsection{DEVice:MODE}
\event{Switches the device to the specified mode}{DEVice:MODE <mode>}{<mode>:\\ \hspace{1cm} VNA: set to vector analyzer\\ \hspace{1cm} GEN: set to signal generator\\ \hspace{1cm} SA: set to spectrum analyzer}
\begin{example}
:DEV:MODE VNA
\end{example}
\query{Queries the currently active mode}{DEVice:MODE?}{None}{<mode>:\\ \hspace{1cm} VNA: set to vector analyzer\\ \hspace{1cm} GEN: set to signal generator\\ \hspace{1cm} SA: set to spectrum analyzer}
\begin{example}
:DEV:MODE?
VNA
\end{example}

\subsubsection{DEVice:SETUP:SAVE}
\event{Saves the GUI setup to a file}{DEVice:SETUP:SAVE}{<filename>}
Important points when saving/loading setup files through SCPI commands:
\begin{itemize}
\item Filenames must be either absolute or relative to the location of the GUI application.
\item If the LibreVNA-GUI (and thus also the SCPI server) is running on a different machine than the SCPI client, the setup files will be saved/loaded from the machine that runs the GUI.
\item If no (or a wrong) file ending is specified, ``.setup'' is automatically added to the filename.
\end{itemize}

\subsubsection{DEVice:SETUP:LOAD}
\query{Loads a setup file}{DEVice:SETUP:LOAD?}{<filename>}{TRUE or FALSE}
\begin{itemize}
\item Filenames must be either absolute or relative to the location of the GUI application.
\item The filename must include the file ending ``.setup''.
\end{itemize}

\subsubsection{DEVice:REFerence:OUT}
\event{Sets the reference output frequency}{DEVice:REFerence:OUT <freq>}{<freq> in MHz, either 0 (disabled), 10 or 100}
\query{Queries the reference output frequency}{DEVice:REFerence:OUT?}{None}{Output frequency in MHz}

\subsubsection{DEVice:REFerence:IN}
\event{Set the reference input mode}{DEVice:REFerence:IN <mode>}{<mode>:\\ \hspace{1cm} INT: use internal reference\\ \hspace{1cm} EXT: use external reference\\ \hspace{1cm} AUTO: automatic reference switching}
\query{Queries the reference source}{DEVice:REFerence:IN?}{None}{INT or EXT}

\subsubsection{DEVice:STAtus:UNLOcked}
\query{Queries the PLL lock error flag}{DEVice:STAtus:UNLOcked?}{None}{TRUE or FALSE}

\subsubsection{DEVice:STAtus:ADCOVERload}
\query{Queries the ADC overload error flag}{DEVice:STAtus:ADCOVERload?}{None}{TRUE or FALSE}

\subsubsection{DEVice:STAtus:UNLEVel}
\query{Queries the output level error flag}{DEVice:STAtus:UNLEVel?}{None}{TRUE or FALSE}

\subsubsection{DEVice:INFo:FWREVision}
\query{Returns the firmware revision of the connected device}{DEVice:INFo:FWREVision?}{None}{<mayor>.<minor>.<patch>}
\begin{example}
:DEV:INF:FWREV?
1.0.0
\end{example}
\subsubsection{DEVice:INFo:HWREVision}
\query{Returns the hardware revision of the connected device}{DEVice:INFo:HWREVision?}{None}{<revision>, single char}
\begin{example}
:DEV:INF:HWREV?
B
\end{example}
\subsubsection{DEVice:INFo:TEMPeratures}
\query{Queries the temperatures of certain chips}{DEVice:INFo:TEMPeratures?}{None}{<source>/<1.LO>/<CPU>}
\begin{example}
:DEV:INF:TEMP?
45/51/31
\end{example}

\subsubsection{DEVice:INFo:LIMits:MINFrequency}
\query{Queries the lowest frequency the device can measure}{DEVice:INFo:LIMits:MINFrequency?}{None}{lowest frequency in Hz}

\subsubsection{DEVice:INFo:LIMits:MAXFrequency}
\query{Queries the highest frequency the device can measure}{DEVice:INFo:LIMits:MAXFrequency?}{None}{highest frequency in Hz}

\subsubsection{DEVice:INFo:LIMits:MINIFBW}
\query{Queries the lowest IF bandwidth setting}{DEVice:INFo:LIMits:MINIFBW?}{None}{lowest possible IF bandwidth in Hz}

\subsubsection{DEVice:INFo:LIMits:MAXIFBW}
\query{Queries the highest IF bandwidth setting}{DEVice:INFo:LIMits:MAXIFBW?}{None}{highest possible IF bandwidth in Hz}

\subsubsection{DEVice:INFo:LIMits:MAXPoints}
\query{Queries the maximum number of points per sweep}{DEVice:INFo:LIMits:MAXPoints?}{None}{maximum number of points}

\subsubsection{DEVice:INFo:LIMits:MINPOWer}
\query{Queries the minimum output power}{DEVice:INFo:LIMits:MINPOWer?}{None}{minimum output power in dBm}

\subsubsection{DEVice:INFo:LIMits:MAXPOWer}
\query{Queries the maximum output power}{DEVice:INFo:LIMits:MAXPOWer?}{None}{maximum output power in dBm}

\subsubsection{DEVice:INFo:LIMits:MINRBW}
\query{Queries the lowest resolution bandwidth setting}{DEVice:INFo:LIMits:MINRBW?}{None}{lowest possible resolution bandwidth in Hz}

\subsubsection{DEVice:INFo:LIMits:MAXRBW}
\query{Queries the highest resolution bandwidth setting}{DEVice:INFo:LIMits:MAXRBW?}{None}{highest possible resolution bandwidth in Hz}

\subsubsection{DEVice:INFo:LIMits:MAXHARMonicfrequency}
\query{Queries the (theoretical) maximum frequency when using harmonic mixing in VNA mode}{DEVice:INFo:LIMits:MAXHARMonicfrequency?}{None}{maximum frequency in Hz}

\subsection{VNA Commands}
These commands change or query VNA settings. Although most of them are available regardless of the current device mode, they usually only have an effect once the VNA mode is active (e.g. it is possible to change the span while in signal generator mode but it does not effect the \vna{} until the mode is switched to VNA). Certain commands (like taking a calibration measurement) are only available in VNA mode and will return an error if another mode is active.

\subsubsection{VNA:SWEEP}
\event{Sets the type of the sweep}{VNA:SWEEP}{<type>, either FREQUENCY or POWER}
\query{Queries the currently selected type}{VNA:SWEEP?}{None}{<type>, either FREQUENCY or POWER}

\subsubsection{VNA:FREQuency:SPAN}
\event{Sets the span of the sweep}{VNA:FREQuency:SPAN}{<span>, in Hz}
\query{Queries the currently selected span}{VNA:FREQuency:SPAN?}{None}{span in Hz}

\subsubsection{VNA:FREQuency:START}
\event{Sets the start frequency of the sweep}{VNA:FREQuency:START}{<start frequency>, in Hz}
\query{Queries the currently selected start frequency}{VNA:FREQuency:START?}{None}{start frequency in Hz}

\subsubsection{VNA:FREQuency:CENTer}
\event{Sets the center frequency of the sweep}{VNA:FREQuency:CENTer}{<center frequency>, in Hz}
\query{Queries the currently selected center frequency}{VNA:FREQuency:CENTer?}{None}{center frequency in Hz}

\subsubsection{VNA:FREQuency:STOP}
\event{Sets the stop frequency of the sweep}{VNA:FREQuency:STOP}{<stop frequency>, in Hz}
\query{Queries the currently selected stop frequency}{VNA:FREQuency:STOP?}{None}{stop frequency in Hz}

\subsubsection{VNA:FREQuency:FULL}
\event{Sets the device to the maximum span possible}{VNA:FREQuency:FULL}{None}

\subsubsection{VNA:FREQuency:ZERO}
\event{Sets the device to zero span mode}{VNA:FREQuency:ZERO}{None}

\subsubsection{VNA:POWer:START}
\event{Sets the start power of the power sweep}{VNA:POWer:START}{<start power>, in dBm}
\query{Queries the currently selected start power}{VNA:POWer:START?}{None}{start power in dBm}

\subsubsection{VNA:POWer:STOP}
\event{Sets the stop power of the power sweep}{VNA:POWer:STOP}{<stop power>, in dBm}
\query{Queries the currently selected stop power}{VNA:POWer:STOP?}{None}{stop power in dBm}

\subsubsection{VNA:SWEEPTYPE}
\event{Selects between linear and logarithmic sweeps}{VNA:SWEEPTYPE}{<type>, either ``LIN'' or ``LOG''}
\query{Queries the currently selected sweep type}{VNA:SWEEPTYPE?}{None}{``LIN'' or ``LOG''}

\subsubsection{VNA:ACQuisition:RUN}
\event{Puts the VNA into run mode (sweep active)}{VNA:ACQuisition:RUN}{None}
\query{Queries whether the VNA is in run mode}{VNA:ACQuisition:RUN?}{None}{TRUE or FALSE}

\subsubsection{VNA:ACQuisition:STOP}
\event{Puts the VNA into stop mode (sweep inactive)}{VNA:ACQuisition:STOP}{None}

\subsubsection{VNA:ACQuisition:IFBW}
\event{Sets the IF bandwidth}{VNA:ACQuisition:IFBW}{<IF bandwidth>, in Hz}
\query{Queries the currently selected IF bandwidth}{VNA:ACQuisition:IFBW?}{None}{IF bandwidth in Hz}

\subsubsection{VNA:ACQuisition:POINTS}
\event{Sets the number of points per sweep}{VNA:ACQuisition:POINTS}{<points>}
\query{Queries the currently selected number of points}{VNA:ACQuisition:POINTS?}{None}{points}

\subsubsection{VNA:ACQuisition:AVG}
\event{Sets the number of sweeps over which a moving average is calculated}{VNA:ACQuisition:AVG}{<averaging sweeps>}
\query{Queries the currently configured number of sweeps}{VNA:ACQuisition:AVG?}{None}{<averaging sweeps>}

\subsubsection{VNA:ACQuisition:AVGLEVel}
\query{Queries the number of sweeps that have been acquired by the average function.}{VNA:ACQuisition:AVGLEVel?}{None}{<acquired sweeps>}
<acquired sweeps> resets to zero whenever a setting is changed. It is incremented at the end of each sweep, but will not go above the number of configured sweeps for the averaging.

Example (assuming <averaging sweep> = 3):
\begin{longtable}{p{.2\textwidth} | p{.2\textwidth} }
\textbf{\# of active sweep} & \textbf{<acquired sweeps>}\\
\hline
1 & 0\\
2 & 1\\
3 & 2\\
4 & 3\\
5 & 3\\
\end{longtable}

\subsubsection{VNA:ACQuisition:FINished}
\query{Queries whether the average filter has reached a steady state (that is <acquired sweeps> = <averaging sweeps>)}{VNA:ACQuisition:FINished?}{None}{TRUE or FALSE}

\subsubsection{VNA:ACQuisition:LIMit}
\query{Queries the status of limits that maybe set up on any graph}{VNA:ACQuisition:LIMit?}{None}{PASS or FAIL}

\subsubsection{VNA:ACQuisition:SINGLE}
\event{Configures the VNA for single or continuous sweep}{VNA:ACQuisition:SINGLE}{TRUE or FALSE}
\query{Queries whether the VNA is set up for single sweep}{VNA:ACQuisition:SINGLE?}{None}{TRUE or FALSE}

If single sweep is enabled, the acquisition is stopped when the required number of averages have been reached. There are two ways to trigger a new sweep:
\begin{itemize}
\item Change any sweep setting (e.g. center frequency)
\item Issue the command again (i.e. VNA:ACQ:SINGLE TRUE always triggers a new sweep)
\end{itemize}

\subsubsection{VNA:STIMulus:LVL}
\event{Sets the output power of the stimulus signal when sweep type is frequency}{VNA:STIMulus:LVL}{<power>, in dBm}
\query{Queries the currently selected output power}{VNA:STIMulus:LVL?}{None}{power in dBm}

\subsubsection{VNA:STIMulus:FREQuency}
\event{Sets the frequency of the stimulus signal when sweep type is power}{VNA:STIMulus:FREQuency}{<freq>, in Hz}
\query{Queries the currently selected frequency}{VNA:STIMulus:FREQuency?}{None}{frequency in Hz}

\subsubsection{VNA:TRACe:LIST}
\query{Lists the names of all available traces}{VNA:TRACe:LIST?}{None}{comma-separated list of trace name}
\begin{example}
VNA:TRAC:LIST?
S11,S12,S21,S22
\end{example}

\subsubsection{VNA:TRACe:DATA}
\query{Returns the data of a trace}{VNA:TRACe:DATA?}{<trace>, either by name or by index}{comma-separated list of tuples [x, real(y), imag(y]}
Depending on the sweep and possible confiigured math operations, x may be either frequency, power or time.
\begin{example}
:VNA:TRAC:DATA? S11
[1e+6,0.400172,0.0377869],
[6.67556e+8,-0.0922281,-0.00990373],
[1.33411e+9,-0.0341439,-0.0331184],
[2.00067e+9,0.00750893,0.0490847],
[2.66722e+9,0.0472666,-0.175552],
[3.33378e+9,-0.106545,-0.00952825],
[4.00033e+9,-0.102039,0.0890605],
[4.66689e+9,0.0464292,0.118183],
[5.33344e+9,0.13223,-0.00780554],
[6e+9,-0.0314859,-0.246024]
\end{example}
\vspace{-0.3cm}
\begin{center}
\footnotesize{Note: actual response will not include newlines between data points, only at the end}
\end{center}

\subsubsection{VNA:TRACe:AT}
\query{Returns the data at a specific frequency (possibly interpolated)}{VNA:TRACe:AT?}{<trace>, either by name or by index\\<frequency>, in Hz}{real,imag (or ``NaN,NaN'' if specified frequeny is invalid)}
\begin{example}
:VNA:TRAC:AT? S11 1200000000
-0.0458452,-0.028729
\end{example}

\subsubsection{VNA:TRACe:TOUCHSTONE}
\query{Returns the content of multiple trace according to the touchstone format}{VNA:TRACe:TOUCHSTONE?}{<trace1>,<trace2>,<trace3>,...}{Touchstone file content in ASCII}
Some additional constraints apply:
\begin{itemize}
\item The number of specified traces must be a square number. The number of ports in the touchstone file is inferred from that.
\item Only frequency domain traces are allowed.
\item All traces must have the same number of points and the same start/stop frequency.
\item The order in which the traces are specified matters and depending on its index and each trace must be a reflection or transmission measurement:
\begin{itemize}
\item Assuming that $n$ is the number of ports of the desired touchstone file, the $n*n$ number of traces must be specified in this order:
$$ S_{11}...S_{1n},S_{21}...S_{2n},...,S_{n1}...S_{nn} $$
\item For every trace $S_{ij}$, the trace must contain a reflection measurement if $i=j$ and a transmission measurement if $i\neq j$.
\end{itemize}
\item Traces can be specified either by name or by index.
\item A deviation from any of these points (invalid number of traces, non-existing trace, wrong order, ...) will result in an error being returned.
\end{itemize}
\begin{example}
:VNA:TRACE:TOUCHSTONE? S11 S12 S21 S22
# GHZ S RI R 50
1.000000000000 1.000497817993 0.010679213330 0.000013886895 -0.000054684886 -0.000023392624 -0.000021111371 0.401717424393 0.702864229679
1.002000000000 1.000323534012 0.010577851906 -0.000011075452 -0.000013504875 0.000000477609 -0.000007789199 0.413144201040 0.696514129639
...
\end{example}

\subsubsection{VNA:TRACe:MAXFrequency}
\query{Returns the highest frequency contained in the trace}{VNA:TRACe:MAXFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}

\subsubsection{VNA:TRACe:MINFrequency}
\query{Returns the lowest frequency contained in the trace}{VNA:TRACe:MINFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}

\subsubsection{VNA:TRACe:MAXAmplitude}
\query{Returns the datapoint with the highest amplitude in the trace}{VNA:TRACe:MAXAmplitude?}{<trace>, either by name or by index}{<frequency>,<real>,<imag> of the highest amplitude point}
\begin{example}
:VNA:TRAC:MAXA? S21
5.66406e+9,-6.21766e-5,-0.000795846
\end{example}

\subsubsection{VNA:TRACe:MINAmplitude}
\query{Returns the datapoint with the lowest amplitude in the trace}{VNA:TRACe:MINAmplitude?}{<trace>, either by name or by index}{<frequency>,<real>,<imag> of the lowest amplitude point}

\subsubsection{VNA:TRACe:NEW}
\event{Creates a new trace}{VNA:TRACe:NEW}{<trace name>}

\subsubsection{VNA:TRACe:DELete}
\event{Deletes a trace}{VNA:TRACe:DELete}{<trace>, either by name or by index}

\subsubsection{VNA:TRACe:RENAME}
\event{Changes the name of a trace}{VNA:TRACe:RENAME}{<trace>, either by name or by index\\<new name>}

\subsubsection{VNA:TRACe:PAUSE}
\event{Pauses (freezes) a trace}{VNA:TRACe:PAUSE}{<trace>, either by name or by index}

\subsubsection{VNA:TRACe:RESUME}
\event{Resumes (unfreezes) a trace}{VNA:TRACe:RESUME}{<trace>, either by name or by index}

\subsubsection{VNA:TRACe:PAUSED}
\query{Queries whether a trace is paused}{VNA:TRACe:PAUSED?}{<trace>, either by name or by index}{TRUE or FALSE}

\subsubsection{VNA:TRACe:DEEMBedding:ACTive}
\event{Enables/disables de-embedding on a trace}{VNA:TRACe:DEEMBedding:ACTive}{<trace>, either by name or by index\\<enable>, either TRUE or FALSE}

If no de-embedding is configured for the selected trace, enabling the de-embedding will fail.

\query{Queries whether de-embedding is active for the selected trace}{VNA:TRACe:DEEMBedding:ACTive?}{<trace>, either by name or by index}{TRUE or FALSE}

\subsubsection{VNA:TRACe:DEEMBedding:AVAILable}
\query{Queries whether de-embedding is available for the selected trace}{VNA:TRACe:DEEMBedding:AVAILable?}{<trace>, either by name or by index}{TRUE or FALSE}

\subsubsection{VNA:TRACe:PARAMeter}
\event{Sets the measurement parameter that is stored in the trace}{VNA:TRACe:PARAMeter}{<trace>, either by name or by index\\<parameter>, options are S11, S12, S21 or S22}
\query{Queries the measurement parameter of a trace}{VNA:TRACe:PARAMeter?}{<trace>, either by name or by index}{S11, S12, S21 or S22}

\subsubsection{VNA:TRACe:TYPE}
\event{Sets the storage type of a trace}{VNA:TRACe:TYPE}{<trace>, either by name or by index\\<type>, options are OVERWRITE, MAXHOLD or MINHOLD}
\query{Queries the storage type of a trace}{VNA:TRACe:TYPE?}{<trace>, either by name or by index}{OVERWRITE, MAXHOLD or MINHOLD}

\subsubsection{VNA:CALibration:ACTivate}
\event{Activates a specific calibration. This command fails if the required measurements have not been taken yet}{VNA:CALibration:ACTivate}{<type>}
\query{Queries the currently available calibration types}{VNA:CALibration:ACTivate?}{None}{comma-separated list of available calibration types}

\subsubsection{VNA:CALibration:ACTIVE}
\query{Queries the currently active calibration type}{VNA:CALibration:ACTIVE?}{None}{Currently active calibration type}

\subsubsection{VNA:CALibration:NUMber}
\query{Queries the number of available calibration measurements}{VNA:CALibration:NUMber?}{None}{<number of configured measurements>}

\subsubsection{VNA:CALibration:RESET}
\event{Resets the calibration. Deactivates the calibration and deletes all measurements.}{VNA:CALibration:RESET}{None}

\subsubsection{VNA:CALibration:ADD}
\event{Adds a new empty calibration measurement.}{VNA:CALibration:ADD}{<type> Measurement type, one of:\\
\hspace{1cm}OPEN\\
\hspace{1cm}SHORT\\
\hspace{1cm}LOAD\\
\hspace{1cm}THROUGH\\
\hspace{1cm}ISOLATION\\
{[<standard>]}, calibration kit standard name, optional\\}

\subsubsection{VNA:CALibration:TYPE}
\query{Returns the type of the specified measurement}{VNA:CALibration:TYPE?}{<measurement number>}{Measurement type, one of:\\
\hspace{1cm}OPEN\\
\hspace{1cm}SHORT\\
\hspace{1cm}LOAD\\
\hspace{1cm}THROUGH\\
\hspace{1cm}ISOLATION\\}

\subsubsection{VNA:CALibration:PORT}
\event{Sets the port for the specified measurement}{VNA:CALibration:PORT}{<measurement number> <port number>}
\query{Returns the port for the specified measurement}{VNA:CALibration:PORT?}{<measurement number>}{<port number>}

\subsubsection{VNA:CALibration:STANDARD}
\event{Sets the calibration standard which will be used for the specified measurement}{VNA:CALibration:STANDARD}{<measurement number> <standard name>}
\query{Returns the standard name for the specified measurement}{VNA:CALibration:STANDARD?}{<measurement number>}{Name of used calibration standard (from calibration kit)}

\subsubsection{VNA:CALibration:MEASure}
\event{Starts a calibration measurement. This command fails if no device is connected, the VNA mode is not active or a calibration measurement is already in progress.}{VNA:CALibration:MEASure}{<measurement 1>,<measurement 2>,...}
Any number of measurements can be specified (by their number). These measurements will be taken simultaneously. This only works if they are measuring different ports (e.g. measure SHORT on port 1 and OPEN on port 2). If colliding measurements are specified (e.g. SHORT on port 1 and LOAD on port 1), an error is returned and no measurements are started.

\subsubsection{VNA:CALibration:BUSY}
\query{Queries whether a calibration measurement is ongoing}{VNA:CALibration:BUSY?}{None}{TRUE or FALSE}

\subsubsection{VNA:CALibration:SAVE}
\event{Saves the active calibration to a file}{VNA:CALibration:SAVE}{<filename>}
Important points when saving/loading calibration files through SCPI commands:
\begin{itemize}
\item Filenames must be either absolute or relative to the location of the GUI application.
\item If the LibreVNA-GUI (and thus also the SCPI server) is running on a different machine than the SCPI client, the calibration files will be saved/loaded from the machine that runs the GUI.
\end{itemize}

\subsubsection{VNA:CALibration:LOAD}
\query{Loads a calibration file}{VNA:CALibration:LOAD?}{<filename>}{TRUE or FALSE}

\subsection{Signal Generator Commands}
These commands change or query signal generator settings. Although most of them are available regardless of the current device mode, they usually only have an effect once the generator mode is active.

\subsubsection{GENerator:FREQuency}
\event{Sets the output frequeny}{GENerator:FREQuency}{<frequency>, in Hz}
\query{Queries the selected output frequency}{GENerator:FREQuency?}{None}{frequency in Hz}

\subsubsection{GENerator:LVL}
\event{Sets the output power}{GENerator:LVL}{<output level>, in dBm}
\query{Queries the selected output power}{GENerator:LVL?}{None}{output level in dBm}

\subsubsection{GENerator:PORT}
\event{Sets the active output port}{GENerator:PORT}{<output port>\\
\hspace{1cm}0: output disabled\\
\hspace{1cm}1: output signal at port 1\\
\hspace{1cm}2: output signal at port 2\\}
\query{Queries the selected output}{GENerator:PORT?}{None}{output port}

\subsection{Spectrum Analyzer Commands}
These commands change or query spectrum analyzer settings. Although most of them are available regardless of the current device mode, they usually only have an effect once the spectrum analyzer mode is active.

\subsubsection{SA:FREQuency:SPAN}
\event{Sets the span of the sweep}{SA:FREQuency:SPAN}{<span>, in Hz}
\query{Queries the currently selected span}{SA:FREQuency:SPAN?}{None}{span in Hz}

\subsubsection{SA:FREQuency:START}
\event{Sets the start frequency of the sweep}{SA:FREQuency:START}{<start frequency>, in Hz}
\query{Queries the currently selected start frequency}{SA:FREQuency:START?}{None}{start frequency in Hz}

\subsubsection{SA:FREQuency:CENTer}
\event{Sets the center frequency of the sweep}{SA:FREQuency:CENTer}{<center frequency>, in Hz}
\query{Queries the currently selected center frequency}{SA:FREQuency:CENTer?}{None}{center frequency in Hz}

\subsubsection{SA:FREQuency:STOP}
\event{Sets the stop frequency of the sweep}{SA:FREQuency:STOP}{<stop frequency>, in Hz}
\query{Queries the currently selected stop frequency}{SA:FREQuency:STOP?}{None}{stop frequency in Hz}

\subsubsection{SA:FREQuency:FULL}
\event{Sets the device to the maximum span possible}{SA:FREQuency:FULL}{None}

\subsubsection{SA:FREQuency:ZERO}
\event{Sets the device to zero span mode}{SA:FREQuency:ZERO}{None}

\subsubsection{SA:ACQuisition:RUN}
\event{Puts the spectrum analyzer into run mode (sweep active)}{SA:ACQuisition:RUN}{None}
\query{Queries whether the spectrum analyzer is in run mode}{SA:ACQuisition:RUN?}{None}{TRUE or FALSE}

\subsubsection{SA:ACQuisition:STOP}
\event{Puts the spectrum analyzer into stop mode (sweep inactive)}{SA:ACQuisition:STOP}{None}

\subsubsection{SA:ACQuisition:RBW}
\event{Sets the resolution bandwidth}{SA:ACQuisition:IFBW}{<resolution bandwidth>, in Hz}
\query{Queries the currently selected resolution bandwidth}{SA:ACQuisition:IFBW?}{None}{resolution bandwidth in Hz}

\subsubsection{SA:ACQuisition:WINDow}
\event{Sets the type of window used in the acquisition}{SA:ACQuisition:WINDow}{<windowtype>\\
\hspace{1cm}NONE\\
\hspace{1cm}KAISER\\
\hspace{1cm}HANN\\
\hspace{1cm}FLATTOP\\
}
\query{Queries the currently selected type of window}{SA:ACQuisition:WINDow?}{None}{NONE, KAISER, HANN or FLATTOP}

\subsubsection{SA:ACQuisition:DETector}
\event{Sets the detector type}{SA:ACQuisition:DETector}{<detector>\\
\hspace{1cm}+PEAK\\
\hspace{1cm}-PEAK\\
\hspace{1cm}NORMAL\\
\hspace{1cm}SAMPLE\\
\hspace{1cm}AVERAGE\\
}
\query{Queries the currently selected detector type}{SA:ACQuisition:DETector?}{None}{+PEAK, -PEAK, NORMAL, SAMPLE or AVERAGE}

\subsubsection{SA:ACQuisition:AVG}
\event{Sets the number of sweeps over which a moving average is calculated}{SA:ACQuisition:AVG}{<sweeps>}
\query{Queries the currently configured number of sweeps}{SA:ACQuisition:AVG?}{None}{sweeps}

\subsubsection{SA:ACQuisition:AVGLEVel}
\query{Queries the number of sweeps that have been acquired by the average function.}{SA:ACQuisition:AVGLEVel?}{None}{<acquired sweeps>}
<acquired sweeps> resets to zero whenever a setting is changed. It is incremented at the end of each sweep, but will not go above the number of configured sweeps for the averaging.

Example (assuming <averaging sweep> = 3):
\begin{longtable}{p{.2\textwidth} | p{.2\textwidth} }
\textbf{\# of active sweep} & \textbf{<acquired sweeps>}\\
\hline
1 & 0\\
2 & 1\\
3 & 2\\
4 & 3\\
5 & 3\\
\end{longtable}

\subsubsection{SA:ACQuisition:FINished}
\query{Queries whether the average filter has reached a steady state (that is <acquired sweeps> = <averaging sweeps>)}{SA:ACQuisition:FINished?}{None}{TRUE or FALSE}

\subsubsection{SA:ACQuisition:LIMit}
\query{Queries the status of limits that maybe set up on any graph}{SA:ACQuisition:LIMit?}{None}{PASS or FAIL}

\subsubsection{SA:ACQuisition:SINGLE}
\event{Configures the spectrum analyzer for single or continuous sweep}{SA:ACQuisition:SINGLE}{TRUE or FALSE}
\query{Queries whether the spectrum analyzer is set up for single sweep}{SA:ACQuisition:SINGLE?}{None}{TRUE or FALSE}

If single sweep is enabled, the acquisition is stopped when the required number of averages have been reached. There are two ways to trigger a new sweep:
\begin{itemize}
\item Change any sweep setting (e.g. center frequency)
\item Issue the command again (i.e. SA:ACQ:SINGLE TRUE always triggers a new sweep)
\end{itemize}

\subsubsection{SA:ACQuisition:SIGid}
\event{Enables/disables signal identification}{SA:ACQuisition:SIGid}{<enabled>, option are TRUE, FALSE, 1 or 0}
\query{Queries whether signal identification is enabled}{SA:ACQuisition:SIGid?}{None}{TRUE or FALSE}

\subsubsection{SA:TRACKing:ENable}
\event{Enables/disables the tracking generator}{SA:TRACKing:ENable}{<enabled>, option are TRUE, FALSE, 1 or 0}
\query{Queries whether tracking generator is enabled}{SA:TRACKing:ENable?}{None}{TRUE or FALSE}

\subsubsection{SA:TRACKing:PORT}
\event{Sets the output port of the tracking generator}{SA:TRACKing:PORT}{<port>, either 1 or 2}
\query{Queries the output port of the tracking generator}{SA:TRACKing:PORT?}{None}{1 or 2}

\subsubsection{SA:TRACKing:LVL}
\event{Sets the output power of the tracking generator}{SA:TRACKing:LVL}{<output level>, in dBm}
\query{Queries the selected output power of the tracking generator}{SA:TRACKing:LVL?}{None}{output level in dBm}

\subsubsection{SA:TRACKing:OFFset}
\event{Sets the offset frequency of the tracking generator}{SA:TRACKing:OFFset}{<offset>, in Hz}
\query{Queries the selected offset frequency of the tracking generator}{SA:TRACKing:OFFset?}{None}{offset in Hz}

\subsubsection{SA:TRACKing:NORMalize:ENable}
\event{Enables/disables normalization. If the span has changed since the last active normalization, a normalization measurement is also started.}{SA:TRACKing:NORMalize:ENable}{<enabled>, option are TRUE, FALSE, 1 or 0}
\query{Queries whether tracking generator normalization is enabled}{SA:TRACKing:NORMalize:ENable?}{None}{TRUE or FALSE}

\subsubsection{SA:TRACKing:NORMalize:MEASure}
\event{Triggers a new normalization measurement}{SA:TRACKing:NORMalize:MEASure}{None}

\subsubsection{SA:TRACKing:NORMalize:LVL}
\event{Sets the reference level for the normalization}{SA:TRACKing:NORMalize:LVL}{<normalization level>, in dBm}
\query{Queries the selected reference level for the normalization}{SA:TRACKing:NORMalize:LVL?}{None}{normalization level in dBm}

\subsubsection{SA:TRACe:LIST}
\query{Lists the names of all available traces}{SA:TRACe:LIST?}{None}{comma-separated list of trace name}
\begin{example}
VNA:TRAC:LIST?
Port1,Port2
\end{example}

\subsubsection{SA:TRACe:DATA}
\query{Returns the data of a trace}{SA:TRACe:DATA?}{<trace>, either by name or by index}{comma-separated list of tuples [x, dBm]}
\begin{example}
:SA:TRACE:DATA? PORT1
[9.75e+8,-100.351],
[9.7505e+8,-95.7394],
[9.751e+8,-97.5749],
[9.7515e+8,-96.9667],
[9.752e+8,-96.2391],
[9.7525e+8,-94.8761],
[9.753e+8,-96.0805],
[9.7535e+8,-95.7997],
[9.754e+8,-95.2021],
[9.7545e+8,-96.3472]
\end{example}
\vspace{-0.6cm}
\begin{center}
\footnotesize{Note: actual response will not include newlines between data points, only at the end}\\
\end{center}

\subsubsection{SA:TRACe:AT}
\query{Returns the data at a specific frequency (possibly interpolated)}{SA:TRACe:AT?}{<trace>, either by name or by index\\<frequency>, in Hz}{<dBm> or ``NaN'' if specified frequeny is invalid)}
\begin{example}
:SA:TRAC:AT? Port1 1000000000
-96.424
\end{example}

\subsubsection{SA:TRACe:MAXFrequency}
\query{Returns the highest frequency contained in the trace}{SA:TRACe:MAXFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}

\subsubsection{SA:TRACe:MINFrequency}
\query{Returns the lowest frequency contained in the trace}{SA:TRACe:MINFrequency?}{<trace>, either by name or by index}{maximum frequency in Hz}

\subsubsection{SA:TRACe:MAXAmplitude}
\query{Returns the datapoint with the highest amplitude in the trace}{SA:TRACe:MAXAmplitude?}{<trace>, either by name or by index}{<frequency>,<dBm> of the highest amplitude point}
\begin{example}
:SA:TRAC:MAXA? Port1
9.63e+8,-12.534
\end{example}

\subsubsection{SA:TRACe:MINAmplitude}
\query{Returns the datapoint with the lowest amplitude in the trace}{SA:TRACe:MINAmplitude?}{<trace>, either by name or by index}{<frequency>,<dBm> of the lowest amplitude point}

\subsubsection{SA:TRACe:NEW}
\event{Creates a new trace}{SA:TRACe:NEW}{<trace name>}

\subsubsection{SA:TRACe:DELete}
\event{Deletes a trace}{VNA:TRACe:DELete}{<trace>, either by name or by index}

\subsubsection{SA:TRACe:RENAME}
\event{Changes the name of a trace}{SA:TRACe:RENAME}{<trace>, either by name or by index\\<new name>}

\subsubsection{SA:TRACe:PAUSE}
\event{Pauses (freezes) a trace}{SA:TRACe:PAUSE}{<trace>, either by name or by index}

\subsubsection{SA:TRACe:RESUME}
\event{Resumes (unfreezes) a trace}{SA:TRACe:RESUME}{<trace>, either by name or by index}

\subsubsection{SA:TRACe:PAUSED}
\query{Queries whether a trace is paused}{SA:TRACe:PAUSED?}{<trace>, either by name or by index}{TRUE or FALSE}

\subsubsection{SA:TRACe:PARAMeter}
\event{Sets the measurement parameter that is stored in the trace}{SA:TRACe:PARAMeter}{<trace>, either by name or by index\\<parameter>, options are PORT1 and PORT2}
\query{Queries the measurement parameter of a trace}{SA:TRACe:PARAMeter?}{<trace>, either by name or by index}{PORT1 or PORT2}

\subsubsection{SA:TRACe:TYPE}
\event{Sets the storage type of a trace}{SA:TRACe:TYPE}{<trace>, either by name or by index\\<type>, options are OVERWRITE, MAXHOLD or MINHOLD}
\query{Queries the storage type of a trace}{SA:TRACe:TYPE?}{<trace>, either by name or by index}{OVERWRITE, MAXHOLD or MINHOLD}

\section{Streaming data}
The SCPI server works well for configuring the device and also for reading trace data once an acquition is done. But it isn't very well suited for reading data while the device is capturing it. For some applications (e.g. when running continuous sweeps) it may be beneficial to process the data externally as it getting captured. For this purpose, the LibreVNA-GUI supports streaming the data over dedicated ports.

These streaming servers have to be enbled first. This can be done in \menu[,]{Window,Preferences,Streaming Servers}.

There are a total of 5 streaming servers available. They can all be enabled and used at the same time, although not all servers will output data all the time.

\begin{itemize}
\item \textbf{VNA raw data:} Outputs the raw S-parameters without any calibration applied. This output is always available, even when a calibration is enabled or de-embedding it active. Apart from averaging (if enabled) no processing is done on the data.
\item \textbf{VNA calibrated data:} Outputs the calibrated S-parameters with the calibration applied. This output is only available when a calibration is enabled.
\item \textbf{VNA de-embedded data:} Outputs the de-embedded S-parameters with the de-embbeding and calibration (if enabled) applied. This output is only available when de-embedding is active.
\item \textbf{SA raw data:} Outputs the raw (not normalized) power levels from the spectrum analyzer. This output is always available, even when normalizing is active.
\item \textbf{SA normalized data:} Outputs the normalized power levels from the spectrum analyzer. This output is only available when normalizing is active.
\end{itemize}

\vspace{0.5cm}

All servers output a newline-terminated line of json formatted data for each measurement point in the sweep:

\begin{example}
{"Z0":50.0,"dBm":-20.0,"frequency":42993000.0,"measurements":{"S11_imag":-0.061379313997181856,"S11_real":0.023033630841401063,"S12_imag":0.3205479840477101,"S12_real":-0.5742283570681822,"S21_imag":-0.3746074656570865,"S21_real":0.6126114195570408,"S22_imag":0.06312766256272641,"S22_real":-0.018668561526968372},"pointNum":7}
\end{example}
\begin{example}
{"frequency":2182396.0,"measurements":{"PORT1":7.343487141042715e-06,"PORT2":6.78117066854611e-06},"pointNum":445}
\end{example}

\end{document}
