Script to automate plots

68 views
Skip to first unread message

cbac...@emc-testcenter.com

unread,
Dec 6, 2021, 9:15:22 AM12/6/21
to VNA Tools
Hi Michael,
I have a Folder with 30 similar measurements. For each of them I have to make the same 5 Plots.
For example:
VSWR of port1, show S1,1 only, Y Scale from 0 to 2, X Scale from 0 to 12 GHz, Format: magnitude only, incluiding U95
VSWR of port2, show S2,2 only, Y Scale from 0 to 2, X Scale from 0 to 12 GHz, Format: magnitude only, incluiding U95
Impedance of port1, show S1,1 only, Y Scale from 30 to 80 Ohms,  X Scale from 0 to 12 GHz, Format: Mag Phase,  incluiding U95
Impedance of port2, show S2,2 only, Y Scale from 30 to 80 Ohms, X Scale from 0 to 12 GHz, Format: Mag Phase,  incluiding U95
S21, Format: Mag Phase,  in Mag log and Phase unwrap, Y Scale from 0 to -20 dB ,Freq log. X Scale from 0 to 12 GHz, Format: magnitude only, incluiding U95

If I do this by hand, it is very time consuming and also a source of errors and incosistencies. As I have to select always the same settings and also the folder to save the Image each time. So I would like to write a script where I can set all the fixed parameters for each plot and save the plot afterwards in a given path.

How can I set the conversion, format and X and Y scales in a script?

Thanks and regards
Cecile


Michael Wollensack METAS

unread,
Dec 6, 2021, 10:54:48 AM12/6/21
to VNA Tools
Hi,

you could use graph settings (VNA Tools / Data Explorer / Setup / Open or Save Settings) and generate a gset-files for each plot.

> VSWR of port1, show S1,1 only, Y Scale from 0 to 2, X Scale from 0 to 12 GHz, Format: magnitude only, incluiding U95

So the gset-File for the above example would look like this:

<?xml version="1.0"?>
  <NRows>1</NRows>
  <NColumns>1</NColumns>
  <Parameters>
    <VnaParameter>
      <NumRcv>b</NumRcv>
      <NumPort>1</NumPort>
      <DenRcv>a</DenRcv>
      <DenPort>1</DenPort>
      <SrcPort>1</SrcPort>
    </VnaParameter>
  </Parameters>
  <Conv>None</Conv>
  <MonteCarlo>false</MonteCarlo>
  <Format>Mag</Format>
  <AutoScaleX>false</AutoScaleX>
  <AutoScaleY>false</AutoScaleY>
  <FreqLog>false</FreqLog>
  <Magnitude>VSWR__lin</Magnitude>
  <Phase>Phase_180</Phase>
  <TimeDomainMode>Band_Pass_Impulse</TimeDomainMode>
  <TimeDomainWindow>Normal_Kaiser</TimeDomainWindow>
  <UncFormat>U95</UncFormat>
  <InteractionMode>None</InteractionMode>
  <Cursor1>false</Cursor1>
  <Cursor2>false</Cursor2>
  <NormMode>Value</NormMode>
  <XScaleMin>
    <double>0</double>
  </XScaleMin>
  <XScaleMax>
    <double>12000000000</double>
  </XScaleMax>
  <YScaleMin>
    <double>0</double>
  </YScaleMin>
  <YScaleMax>
    <double>2</double>
  </YScaleMax>
</VnaGraphSettings>

or you generate your plot using for example MATLAB and load and plot the data there.

>> d = LoadSParamDataAsStruct('Example_01.sdatb')

d = 

  struct with fields:

               Frequency: [1×667 double]
                   Ports: {'1'}
                  PortZr: [1×1 LinProp]
    FrequencyConversions: {[1×1 struct]}
                    Data: [667×1×1 LinProp]

>> plot(d.Frequency, get_value(abs(d.Data(:,1,1))))

Hope this helps.

Regards
Michael

cbac...@emc-testcenter.com

unread,
Dec 17, 2021, 3:34:53 AM12/17/21
to VNA Tools
Hi Michael,
Thanks, in the gSet File is there a possibility to set the "Norm:" field to "Mean" when I have several curves in one plot? Unfortunately this is not saved when I hit "save Settings". I tried to write "Mean" instead of "Value" in the XML of the gSet file, but I get error when opening it.  The other way around when I have "Mean" set in the "Norm:" field and I open an gSet file where I had set "None" before it does not change back eighter. So it seems it just doesn't load any value for the "Norm:" field. Is there a way to fix it?

Thanks and Regards
Cecile

Michael Wollensack METAS

unread,
Dec 17, 2021, 3:46:45 AM12/17/21
to VNA Tools
Hi,

at the moment in the gset-file the norm is not saved and there is no workaround. 
The reason for it is that the number of norm items changes based on the selected data.

Regards
Michael
Reply all
Reply to author
Forward
0 new messages