Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector Network Analyzer Sweep Power Measurement,and create the network! #903

Open
AceYoung938 opened this issue Apr 27, 2023 · 7 comments
Labels
Feature Request Wished Feature Question Touchstone concerning Touchstone formats reading/writing

Comments

@AceYoung938
Copy link

AceYoung938 commented Apr 27, 2023

VNA_POW.txt
I use a program-controlled VNA to perform power sweep measurements. I set the software to measure S-parameters from 0 to -20dbm at a frequency of 2GHZ, with a total of 201 points.
The data format read by the software is an array of real and imaginary parts. Now I want to turn these data into network objects through the Scikit-rf library. How to do it? And these data are uncalibrated, how to calibrate?
Another question I have is how to use the scikit-rf library function to create a network object from the above type of file and draw its image. This file is the result file of sweep power measurement with a vector network analyzer in my laboratory. It is at 2GHZ frequency, the power range is -25dbm to 5dbm, the sweep power measurement result of the amplifier.
please help me

@cafeclimber
Copy link
Contributor

Just to make sure I understand, you have already generated your .sNp files?

@AceYoung938
Copy link
Author

No,Only the real part and imaginary part of the S parameter, each power point corresponds to an array.

@cafeclimber
Copy link
Contributor

Oh sorry, just saw the upload txt file. Looking at that file, it IS indeed a .sNp file. Trying to load it myself, it looks like scikit-rf doesn't currently support Network objects with a power sweep instead of a frequency sweep.

A possible feature request @jhillairet

@AceYoung938
Copy link
Author

thanks for your answer

@jhillairet
Copy link
Member

jhillairet commented Apr 30, 2023

I use a program-controlled VNA to perform power sweep measurements. I set the software to measure S-parameters from 0 to -20dbm at a frequency of 2GHZ, with a total of 201 points.
The data format read by the software is an array of real and imaginary parts. Now I want to turn these data into network objects through the Scikit-rf library. How to do it?

A Network is by definition a frequency-dependant data container as mentionned by @cafeclimber.

It is however possible to represent a power sweep dataset using a NetworkSet parametrized with the power values. Here is an example:

import numpy as np
import matplotlib.pyplot as plt
import skrf as rf

#%% Dummy data representing the real and imaginary parts of S11 for a power sweep
# from 0 to -20dbm at a frequency of 2GHZ, with a total of 201 points.
powers = np.linspace(0, -20, 201)
s11_r = np.random.rand(powers.size)
s11_i = np.random.rand(powers.size)

#%% Creating a NetworkSet containing 201 networks, each containing the S11 at 2GHz.
# Power values are defined using a named parameter 'power'
s11 = s11_r + 1j*s11_i
freq = rf.Frequency(2, 2, npoints=1, unit='GHz')

ntwks = [rf.Network(frequency=freq, s=s, params={'power': power}) for (s, power) in zip(s11, powers)]
ns = rf.NetworkSet(ntwks)

#%% Examples on how to access NetworkSet data
ns.sel({'power': [-5, -10]}) # -> NetworkSet for -5 and -10 dBm

#%% plot s vs power
_s = [n.s_db.squeeze() for n in ns]
_powers = [n.params['power'] for n in ns]

fig, ax = plt.subplots()
ax.plot(_powers, _s)
ax.set_xlabel('power [dBm]')
ax.set_ylabel('s11 [dB]')

Please refer to the NetworkSet Tutorial and this NetworkSet example.

And these data are uncalibrated, how to calibrate?

Please refer first to the calibration tutorial of the documentation and the calibration examples. Without additional information on your particular setup, it's hard for us to help us more.

Another question I have is how to use the scikit-rf library function to create a network object from the above type of file and draw its image. This file is the result file of sweep power measurement with a vector network analyzer in my laboratory. It is at 2GHZ frequency, the power range is -25dbm to 5dbm, the sweep power measurement result of the amplifier.

As mentionned by @cafeclimber , scikit-rf expects frequency dependant Touchstone file. Other kind of sweep are currently not supported.

@AceYoung938
Copy link
Author

thank you,I will try your way now

@jhillairet jhillairet added Feature Request Wished Feature Touchstone concerning Touchstone formats reading/writing Question labels Apr 30, 2023
@AceYoung938
Copy link
Author

In #905 , I created the SOLT calibration standard and got the calibration object 'cal'. As an example, the 'cal' object is created in the 10mhz to 6Ghz frequency range, can you calibrate the S-parameters of '_s' in jhillairet's code ? @jhillairet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Wished Feature Question Touchstone concerning Touchstone formats reading/writing
Projects
None yet
Development

No branches or pull requests

3 participants