Conversion to VDF via Script

53 views
Skip to first unread message

wickli...@gmail.com

unread,
Jul 25, 2022, 4:27:03 PM7/25/22
to VNA Tools
Hello

I am trying to convert my S Parameter Data to the VDF using the Script function.

(VDF = |1+S11|/|S21|)

By searching this forum and using the help I was able to plot the VDF with it's uncertainty. However, I would like to save the VDF data somehow but I don't know how I am able to do this. 

What I got so far:

# VDF - WiP - 25.07.2022

import math
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('Metas.UncLib.Core')
clr.AddReference('Metas.UncLib.LinProp')
clr.AddReference('Metas.Vna.Data')
clr.AddReference('Metas.Vna.Tools')
from System import Array
from System import Double
from System.Threading import Thread
from System.Windows.Forms import DockStyle
from System.Windows.Forms import MessageBox
from System.Windows.Forms import Form
from Metas.UncLib.Core import Complex
from Metas.UncLib.Core import Math as UMath
from Metas.UncLib.LinProp import UncNumber
from Metas.Vna.Data.Gui import GuiXYPlot
from Metas.Vna.Tools import Script

s = Script(RootPath)

d = s.LoadSParamData('Test.sdatb')

nfreq = d.NFreq

t1 = Complex[UncNumber](UncNumber(1.0))

VDF = [UMath.Abs[UncNumber]((t1+d[i, 0, 0])/(d[i, 1, 0])) for i in range(0, nfreq)]

VDF_Value = Array[Double]([VDF[i].Value for i in range(0, nfreq)])
VDF_unc = Array[Double]([2.0*VDF[i].StdUnc for i in range(0, nfreq)])


plot = GuiXYPlot()
plot.PlotXY(d.Frequency, VDF_Value, VDF_unc)
plot.XLabel = 'Frequency (Hz)'
plot.YLabel = 'VDF (dB)'
plot.Dock = DockStyle.Fill
form = Form()
form.Controls.Add(plot)
form.ShowDialog()


How am I able to export the data?

Michael Wollensack METAS

unread,
Aug 2, 2022, 4:07:56 AM8/2/22
to VNA Tools
Hi,

you could write a text file with 3 columns (frequency, value and uncertainty), see


or a csv-file, see


Hope this helps.

Regards
Michael
Reply all
Reply to author
Forward
0 new messages