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
TouchstoneParser fails to load files with \r\n line endings on Windows #528
Comments
Please paste output of running glscopeclient with "--debug --trace TouchstoneParser" and trying to load your test file. Also, are you able to share the .s2p file so I can try reproducing on my end? |
Thank you! And please download the .s2p file from below link: |
Testing on my end, all three files appear to load correctly. There's an issue from the refactoring of the channel emulation / de-embed filter that makes it not work with touchstone files opened via file|import, you have to do add|import for it to recognize the file. This will be fixed at some point soon. When you do add|import, do you not see a mag/angle waveform? Can you generate other test waveforms, say add|generate|sine, and see correct waveforms there? Are you testing on Linux or Windows? |
All of your files load fine for me on Linux... but interestingly, 12.s2p has Windows-style \r\n line terminations while test.s2p has Unix-style \n line terminators. Can you try using dos2unix or similar to change the line endings and confirm that \r\n line endings trigger the bug while \n do not? If so, we're looking at a platform specific line ending handling problem. Unrelated: you'll probably want to have the TDR filter have step start = -1V and end=0V (i.e. still a 1V step, but ending at zero) if your S-parameters don't contain a DC component, since the resting (zero reflection) state of the channel emulation filter is going to be 0V not 1V in this case. |
Also, migrating this ticket to the scopehal repo since it appears to be a bug in the TouchstoneParser class in libscopehal, rather than in the glscopeclient UI. |
You seem to be zoomed really far out on the TDR plot. For 50 GHz S-parameters you're going to want your stimulus waveform to be a minimum of 100 Gsps (minimum Nyquist rate), and the curves will look more smooth if you go even higher. I'd suggest 500 Gsps. Here's what I get when zooming in on test.s2p S11 applied to a 500 Gsps step. This looks plausible for a transmission line with a nominal impedance of about 52 ohms plus a bit of loss causing an upward slope to the curve. The overall reflection curve is about 900ps long, so your line is about 450ps propagation delay one way (which lines up nicely with the S21 group delay of your .s2p). Assuming around 6ps / mm propagation velocity your line is probably about 75mm in physical length. |
Also, try changing the fopen() call in TouchstoneParser::Load() (line 60 of lib/scopehal/TouchstoneParser.cpp) to open the file in binary mode ("rb" instead of "r"). Does that fix the import issue? Opening in text mode should work fine on Windows, but who knows... |
I have rebuilt the code, and confirmed it works fine by changingTouchstoneParser::Load() ("rb" instead of "r") on Windows. |
I'm not sure it's actually wrong. You're zoomed waaaaaay out and seem to be seeing low frequency / interpolation artifacts caused by the limited low frequency content of your .s2p. Try zooming in the channel emulation view to +/- 2ns of the step or so. I'm closing this issue as the original line ending issue is now fixed and I don't want to mix different problems in one ticket. Feel free to file a second one if you're having further trouble. |
Merry Christmas! I'm trying to generate TDR waveform from a S2p file (On offline mode), and I found 2 issues on importing touchstone file, thank you!
1: Fail to import touchstone from File menu
2: Can import touchstone file from Add/import menu, but no waveform generated.
The text was updated successfully, but these errors were encountered: