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
Opening time series touchstones from Agilent/Keysight VNAs (Discussion, maybe feature request) #432
Comments
ignore frequency is completely reasonable, i like it. i think before i have used their csv's to save time-domain data. |
I just went through the error messages again. Btw: Are there other solutions to storing timeseries s-parameter datasets that you know of? |
A very general way of storing and transferring datasets would be using HDF5. |
to provide some context, , |
Thanks for the feedback. As a workaround I though of using a regular expression: import re
fname = "yourfile.s2p"
modfh = open(fname[:-4] + ".mod" + fname[-4:], "wb+")
rex = re.compile(b"^\#\s+([a-zA-Z]+)(\s+.+)")
found_ex = False
with open(fname, "rb") as fh:
for line in fh:
if not found_ex and rex.match(line):
found_ex = True
match = rex.findall(line)
line = b"# Hz " + match[0][-1] + b"\n"
modfh.write(line)
modfh.seek(0)
net = rf.Network(modfh)
modfh.close()
net.plot_s_db() The idea is to use this as a context manager later. The |
Okay, didn't work before because of quirks of Here's a import tempfile
import re
from contextlib import contextmanager
@contextmanager
def touchstone_ignore_unit(fname):
rex = re.compile(b"^\#\s+([a-zA-Z]+)(\s+.+)")
suffix = "." + fname.split(".")[-1]
modfh = tempfile.NamedTemporaryFile(buffering=0, delete=False, suffix=suffix)
found_ex = False
with open(fname, "rb") as fh:
for line in fh:
if not found_ex and rex.match(line):
found_ex = True
match = rex.findall(line)
line = b"# Hz " + match[0][-1] + b"\n"
modfh.write(line)
modfh.seek(0)
try:
yield modfh
finally:
modfh.close() Use it like this: with touchstone_ignore_unit("testfile.s2p") as fh:
net = rf.Network(fh, name="something more informative than the tempfile name ;-)")
net.plot_s_db() Updates:
|
The package hfarray does not seem to be maintained isn't? So I wonder if there is a need for an equivalent feature, available within scikit-rf. An import/export file format, multidimensional, saved on hdf5 or equivalent to support data descriptions/comments, that could be used to store/reload Network sets, parameter scan Networks, time domain data, etc..
What are your opinions?
|
No strong opinions here. I think the initial problem is really due to misuse of Touchstone. Your comment, @jhillairet, is - I think - a separate one. |
I'll need a solution for this issue in the next time and decided to fix this issue. |
OK with your proposal |
Valid point and I have no objections to that.
Just for my understanding: you would still have s-params over frequency as a result of the FT. It would not be s-params at one frequency over time, right?
26 Oct 2021 12:23:34 FranzForstmayr ***@***.***>:
… I'll need a solution for this issue in the next time and decided to fix this issue.
Is everyone fine raising an Exception, if an Time series Touchstone is detected, which suggests an different Constructor, like
*rf.Network.from_timeseries(file)*?
I think this is a clean solution, the constructor should calculate the S-Parameters from the impulse responses, so it's treated as a *Network* after initialization.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub[#432 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADT5B5U4HI6ADV27OIA47L3UI2FTDANCNFSM4YMXD23A].
Triage notifications on the go with GitHub Mobile for iOS[https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675] or Android[https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAAA/CAYAAABXXxDfAAAABHNCSVQICAgIfAhkiAAAACZJREFUaIHtwQENAAAAwqD3T20PBxQAAAAAAAAAAAAAAAAAAAAnBj5DAAGK8nHUAAAAAElFTkSuQmCC###24x24:true###][Tracking image][https://github.com/notifications/beacon/ADT5B5TQ5KI6FDLCRUMSYBTUI2FTDA5CNFSM4YMXD23KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHC5UIQA.gif]
|
Yes exactly. I just figured out that my testdata is screwed up in some way. I'll have to measure again. |
@cweickhmann I tried to measure again, however the data seems strange, in my case only S11 was transformed into time domain, whereas the remaining 3 parameters stayed the same...Do you have an example dataset in time domain and frequency domain to compare? |
I should search for it, but I was not aware it's more than just changing the 'Hz' entry in the definition line to 's' for seconds.
Afaik, Keysight VNAs have an odd (and frankly slightly annoying) behaviour where they update the S-parameter matrix as they sweep. I.e. in time domain, after the first sweep (e.g. with source Port 1), the data in S11 and S21 is valid (S21 will look odd usually), and S22 and S12 are simply garbage from the sweep before (or even the last frequency sweep).
3 nov. 2022 22:32:25 Franz ***@***.***>:
… @cweickhmann[https://github.com/cweickhmann]
I was pretty sure there (was?) a specification for these kind of files available (at keysight?)... Do you maybe have such a specification?
I tried to measure again, however the data seems strange, in my case only S11 was transformed into time domain, whereas the remaining 3 parameters stayed the same...Do you have an example dataset in time domain and frequency domain to compare?
—
Reply to this email directly, view it on GitHub[#432 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADT5B5VBR2WVLNSZZK75FD3WGQVOJANCNFSM4YMXD23A].
You are receiving this because you were mentioned.[Image de pistage][https://github.com/notifications/beacon/ADT5B5QZGLHKA6HZOMKATQTWGQVOJA5CNFSM4YMXD23KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJWSWXFI.gif]
|
I think so too, but I was sure I found a documentation about this once, and I can not find it again.
Could you maybe provide valid testdata? |
Here you go. This is a valid s2p file right from a Keysight N5247A PNA. It's renamed to .txt because Github would not accept .s2p. |
Are you sure everything is fine with the data?
The time step of 32.9 ms indicates a frequency of about 15Hz. A multimeter seems more appropriate than a Keysight PNA ;) The first column after the time vector starts at about -12 to -26...Is this the impulse response written in db? I saw a similar file a while ago, every second column was empty as the impulse response does not deliver complex values. |
Well, no, and that was the point of my initial post here 😉 It's not standard compliant.
But replace the lower case s in the line with the hashbang, and it'll open.
This is the way Keysight dumps timesweep data. The file is from 2015, so maybe they have changed it since (doubt it though).
12 nov. 2022 22:44:58 Franz ***@***.***>:
… Are you sure everything is fine with the data?
*!Agilent Technologies,N5247A,US50470143,A.09.90.13
!Agilent N5247A: A.09.90.13
!Date: Saturday, January 03, 2015 07:11:32
!Correction: S11(Full 2 Port(1,2))
!S21(Full 2 Port(1,2))
!S12(Full 2 Port(1,2))
!S22(Full 2 Port(1,2))
!S2P File: Measurements: S11, S21, S12, S22:CW Time Sweep
!CW Freq: 23750000000 Hz
# s S dB R 50
0 -12.486843 27.334291 -3.1314292 -48.88015 -4.3183527 94.157898 -25.091829 155.28807
0.032967032967033 -12.487159 27.351484 -3.1318481 -48.891125 -4.3181267 94.159744 -25.101725 155.27542
0.065934065934066 -12.485792 27.323 -3.1313319 -48.892918 -4.3183451 94.156502 -25.100018 155.28954
0.098901098901099 -12.487652 27.329481 -3.132103 -48.891663 -4.3206248 94.158195 -25.108162 155.25157
0.13186813186813 -12.489649 27.327703 -3.1317155 -48.891304 -4.318686 94.162804 -25.098158 155.2653
0.16483516483516 -12.487955 27.32765 -3.1309357 -48.89431 -4.3187885 94.156982 -25.107195 155.24843
0.1978021978022 -12.487185 27.337252 -3.1313045 -48.901257 -4.3186226 94.162056 -25.100147 155.21162
*
The time step of 32.9 ms indicates a frequency of about 15Hz. A multimeter seems more appropriate than a Keysight PNA ;)
The first column after the time vector starts at about -12 to -26...Is this the impulse response written in db?
I saw a similar file a while ago, every second column was empty as the impulse response does not deliver complex values.
What's about the (phase?) columns here?
—
Reply to this email directly, view it on GitHub[#432 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ADT5B5RRFHDFRGRIWBE6IHDWIAFVLANCNFSM4YMXD23A].
You are receiving this because you were mentioned.[Image de pistage][https://github.com/notifications/beacon/ADT5B5WYCR3VHW6B54KUJJLWIAFVLA5CNFSM4YMXD23KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJY6F3AA.gif]
|
I can open the file with the branch in #545. But I get a maximum frequency of about 15Hz due to the timestep of 33ms which made me curious? |
I think there's been some confusion throughout this issue over the data in these files. The Keysight touchstone files posted are for measurements taken in CW time sweep mode. This mode repeatedly measures (frequency-domain) S-parameters at a single frequency point to see how they change over time. It's not a time-domain measurement, so I don't think it makes sense to be applying an FFT to it. |
I think so too. The file is indeed a time series frequency domain measurement, not a time domain measurement. I am not aware that PNA-X does time domain measurements, but maybe that's only due to that specific feature missing on my former lab's device. The way the above example file is created is by chaining subsequent S-parameter measurements at one frequency point into one file. The 15 Hz rate was deliberately selected by me because I was looking at a very slow process. It'll go faster if you want it to. |
Thinking about it a bit more, maybe the solution proposed in #903 (comment) of loading the file into a NetworkSet would be appropriate for this too? |
Don't know about the others, but for me this approach seems a bit clunky. The sweep does not change any parameter except time. In my specific case it would be a NetworkSet with 9111 entries of one frequency point. I don't know if performance was improved, but last time I used NetworkSet, it was pretty slow to handle this. Imho, it does make a lot of sense for power- or other parameter-sweeps where you usually record more than one frequency point. |
Hi everyone,
I often work with time sweep measurements on Agilent/Keysight devices.
Keysight decided to save time series s-parameter data in touchstone files as well, setting the
frequency
field to the illegal values
.While this is not standard compliant, I think it is a very reasonable way to save data.
However,
scikit-rf
complains (rightfully so):I could imagine some optional parameter
ignore_frequency_unit
as a solution.So, here's my question: Is there a fundamental issue with allowing these files to be imported without manual modifications (see example below)?
Example of a time series dataset saved in a touchstone file by a Keysight PNA-X (other Keysight devices do it in the same way).
Note the units line
# s S RI R 50
:The text was updated successfully, but these errors were encountered: