diff --git a/Documentation/UserManual/ProgrammingGuide.pdf b/Documentation/UserManual/ProgrammingGuide.pdf index 6123e79..e13bded 100644 Binary files a/Documentation/UserManual/ProgrammingGuide.pdf and b/Documentation/UserManual/ProgrammingGuide.pdf differ diff --git a/Documentation/UserManual/ProgrammingGuide.tex b/Documentation/UserManual/ProgrammingGuide.tex index bd44ead..d0faf8d 100644 --- a/Documentation/UserManual/ProgrammingGuide.tex +++ b/Documentation/UserManual/ProgrammingGuide.tex @@ -552,33 +552,31 @@ Port1,Port2 \end{example} \subsubsection{SA:TRACe:DATA} -\query{Returns the data of a trace}{SA:TRACe:DATA?}{, either by name or by index}{comma-separated list of tuples [x, real(y), imag(y]} +\query{Returns the data of a trace}{SA:TRACe:DATA?}{, either by name or by index}{comma-separated list of tuples [x, dBm]} \begin{example} :SA:TRACE:DATA? PORT1 -[9.5e+8,1.56378e-5,0], -[9.501e+8,1.66861e-5,0], -[9.502e+8,1.89638e-5,0], -[9.503e+8,1.87195e-5,0], -[9.504e+8,1.47292e-5,0], -[9.505e+8,1.40006e-5,0], -[9.506e+8,1.65665e-5,0], -[9.507e+8,1.48342e-5,0], -[9.508e+8,1.83062e-5,0], -[9.509e+8,1.66752e-5,0] +[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 1: actual response will not include newlines between data points, only at the end}\\ -\footnotesize{Note 2: although the imaginary part is zero for all values, it is still included in the response}\\ +\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?}{, either by name or by index\\, in Hz}{real,imag (or ``NaN,NaN'' if specified frequeny is invalid)} +\query{Returns the data at a specific frequency (possibly interpolated)}{SA:TRACe:AT?}{, either by name or by index\\, in Hz}{ or ``NaN'' if specified frequeny is invalid)} \begin{example} :SA:TRAC:AT? Port1 1000000000 --0.0458452,-0.028729 +-96.424 \end{example} -\footnotesize{Note: although the imaginary part is always zero, it is still included in the response}\\ \subsubsection{SA:TRACe:MAXFrequency} \query{Returns the highest frequency contained in the trace}{SA:TRACe:MAXFrequency?}{, either by name or by index}{maximum frequency in Hz} @@ -587,15 +585,14 @@ Port1,Port2 \query{Returns the lowest frequency contained in the trace}{SA:TRACe:MINFrequency?}{, 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?}{, either by name or by index}{,, of the highest amplitude point} +\query{Returns the datapoint with the highest amplitude in the trace}{SA:TRACe:MAXAmplitude?}{, either by name or by index}{, of the highest amplitude point} \begin{example} :SA:TRAC:MAXA? Port1 -9.63e+8,4.05022e-5,0 +9.63e+8,-12.534 \end{example} -\footnotesize{Note: although the imaginary part is always zero, it is still included in the response}\\ \subsubsection{SA:TRACe:MINAmplitude} -\query{Returns the datapoint with the lowest amplitude in the trace}{SA:TRACe:MINAmplitude?}{, either by name or by index}{,, of the lowest amplitude point} +\query{Returns the datapoint with the lowest amplitude in the trace}{SA:TRACe:MINAmplitude?}{, either by name or by index}{, of the lowest amplitude point} \subsubsection{SA:TRACe:NEW} \event{Creates a new trace}{SA:TRACe:NEW}{} diff --git a/Software/PC_Application/Traces/tracewidget.cpp b/Software/PC_Application/Traces/tracewidget.cpp index b7ee867..d0b9acf 100644 --- a/Software/PC_Application/Traces/tracewidget.cpp +++ b/Software/PC_Application/Traces/tracewidget.cpp @@ -164,6 +164,21 @@ void TraceWidget::SetupSCPI() return nullptr; } }; + + auto createStringFromData = [](Trace *t, const Trace::Data &d) -> QString { + if(Trace::isSAParamater(t->liveParameter())) { + if(std::isnan(d.x)) { + return "NaN"; + } + return QString::number(20*log10(d.y.real())); + } else { + if(std::isnan(d.x)) { + return "NaN,NaN"; + } + return QString::number(d.y.real())+","+QString::number(d.y.imag()); + } + }; + add(new SCPICommand("LIST", nullptr, [=](QStringList){ QString ret; for(auto t : model.getTraces()) { @@ -180,7 +195,7 @@ void TraceWidget::SetupSCPI() QString ret; for(unsigned int i=0;isize();i++) { auto d = t->sample(i); - ret += "["+QString::number(d.x)+","+QString::number(d.y.real())+","+QString::number(d.y.imag())+"],"; + ret += "["+QString::number(d.x)+","+createStringFromData(t, d)+"],"; } ret.chop(1); return ret; @@ -198,7 +213,7 @@ void TraceWidget::SetupSCPI() if(std::isnan(d.x)) { return "NaN,NaN"; } else { - return QString::number(d.y.real())+","+QString::number(d.y.imag()); + return createStringFromData(t, d); } } })); @@ -222,7 +237,7 @@ void TraceWidget::SetupSCPI() return "ERROR"; } auto d = t->interpolatedSample(t->findExtremumFreq(true)); - return QString::number(d.x)+","+QString::number(d.y.real())+","+QString::number(d.y.imag()); + return QString::number(d.x)+","+createStringFromData(t, d); })); add(new SCPICommand("MINAmplitude", nullptr, [=](QStringList params) -> QString { auto t = findTrace(params); @@ -230,7 +245,7 @@ void TraceWidget::SetupSCPI() return "ERROR"; } auto d = t->interpolatedSample(t->findExtremumFreq(false)); - return QString::number(d.x)+","+QString::number(d.y.real())+","+QString::number(d.y.imag()); + return QString::number(d.x)+","+createStringFromData(t, d); })); add(new SCPICommand("NEW", [=](QStringList params) -> QString { if(params.size() != 1) {