Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
gnuplot for nanoVNA Touchstone files
link added to application notesnanoVNA shell commands `frequencies` and `data` naturally return columns of numbers, so nearly Touchstone format. The unix utility `paste` trivializes combining text file columns, and while it is not too tricky to store PuTTY log files, then edit those logs into files appropriate for `paste`, that is not easily scripted. As Dr. David noted, "being able to generate all the PDF plots from a single unix shell script makes the process much easier". One challenge is that Windows seemingly lacks a native utility comparable to Unix `paste`, but `paste` is available e.g. by Cygwin, Windows Subsystem for Linux (WSL) or MSYS2 WSL is an option neither for Windows 7 nor 8, and Cygwin is rather extensive. MSYS2 `paste.exe` may be already available e.g. if some Ruby is installed, and appears the least invasive well-supported. Another challenge is communicating with nanoVNA's virtual COM port from scripts; that works for me on Windows 8.1 so far neither from Cygwin nor cmd.exe... Suggestions are invited; ideally, a utility is wanted that sends command line arguments in sequence to nanoVNA, then returns data from the final argument until nanoVNA returns "ch>". |
If you just want Touchstone files, NanoVNA-Saver was actually, as the name
toggle quoted message
Show quoted text
implies, built to save Touchstone files. ;-) Not easily automated, though it probably wouldn't be a huge effort to build a Python command-line tool to do so. -- Rune / 5Q5R On Fri, 18 Oct 2019 at 20:52, Oristo <ormpoa@...> wrote:
link added to application notesnanoVNA shell commands `frequencies` and `data` naturally return columns |
it probably wouldn't be a huge effort to build a Python command-line tool.. so now I must confess failing to obtain consistent results verifying NanoVNA-Saver Python prerequisites on Windows 8.1 .. and have a collection of crash reports to show for it. From ... I tried this discouraging example: #!/usr/bin/python import sys print 'Number of arguments:', len(sys.argv), 'arguments.' print 'Argument List:', str(sys.argv) --------------------------------------- C:\Users\ormpoa>py - < args.py File "<stdin>", line 5 print 'Number of arguments:', len(sys.argv), 'arguments.' ^ SyntaxError: invalid syntax .. which was fixed by surrounding print args with parens, but still.. C:\Users\ormpoa>pipenv run python nVargs.py info Number of arguments: 2 arguments. Argument List: ['nVargs.py', 'info'] info Kernel: 4.0.0 Compiler: GCC 8.2.1 20181213 (release) [gcc-8-branch revision 267074] Architecture: ARMv6-M Core Variant: Cortex-M0 Port Info: Preemption through NMI Platform: STM32F072xB Entry Level Medium Density devices Board: NanoVNA-H Build time: Oct 9 2019 - 10:20:33 |
Well, NanoVNA-Saver has a native .exe build that should run fine on Windows
toggle quoted message
Show quoted text
8.1. It wouldn't need any Python prerequisites, at least. :-) Of course, if the exercise is to do things yourself, that's a different matter altogether. ;-) -- Rune / 5Q5R On Fri, 18 Oct 2019 at 23:32, Oristo <ormpoa@...> wrote:
it probably wouldn't be a huge effort to build a Python command-line tool.. so now I must confess failing to obtain consistent results |
Oristo,
Why not just piggyback off the existing python script for the NanoVNA by edy555 @ ? You can just throwaway what you don't need and keep what is useful. I plan on eventually doing the same to automate saving corrected S21 data to CSV format after doing some other post processing specific to my requirements. - Herb |
Why not just piggyback off the existing python script for the NanoVNAFirst, I did not know enough Python to easily sort that, was planning to use C# because experience and less baggage on Windows, but Rune provoked me to try Python, and his was easy to hack: Still needs a graceful exit for nanoVNA not found: |
In case someone want to try gnuplot on Windows 10 using WSL, I had success generating a Smith Chart of a choke I'm building. I assume these steps can be adapted to work on Linux with little effort.
1. Install Windows Subsystem for Linux and sudo apt-get install gnuplot (assuming WSL is configured correctly, i.e. sudo apt-get update). I'm using the Ubuntu version. 2. Follow the instructions on the wiki on setting up the Smith Chart files, i.e. and put them in an appropriate folder. 3. Edit plotsmith.p from that folder so it looks like the commands at the bottom of my post. The trick is to write to a file, since WSL doesn't have X Windows support. Don't forget to change the name of the file to match yours. 4. Steps 4-6 are inside WSL: cd to your folder with your files, i.e. cd /mnt/c/Users/(your username)/Documents 5. Run gnuplot 6. Type plotsmith.p (some garbage gets printed to the screen, looks like it is also trying to write the png to the screen) 7. Back in Windows, open the output.png file that was generated, containing a nice Smith Chart. set terminal png size 1000,1000 load 'smithlabel.p' set linetype 1 lc rgb "gray60" lw 1 pt 1 set linetype 2 lc rgb "red" lw 2 pt 1 plot 'smithgrid.dat' w l notitle set output 'output.png' replot "mydata.s1p" u 2:3 w l title "HF Choke in UHF" Enjoy, Roman |
WSL doesn't have X Windows supportVcXsrv works for me with WSL since 2017 set terminal png size 1000,1000gif will be smaller than png set linetype 1 lc rgb "gray60" lw 1 pt 1Thanks, I forgot to update color coding. gnuplot works fine directly from Windows cmd.exe I use a bat file to set a custom PATH when using gnuplot from cmd.exe: C:\Users\ormpoa>type gnuplotPath.bat path=C:\Program Files (x86)\gnuplot\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\WindowsPowerShell\v1.0 |
On Sun, 20 Oct 2019 at 11:12, Oristo <ormpoa@...> wrote:
That's interesting. I just tried it with a different plot I have a scriptset terminal png size 1000,1000gif will be smaller than png making hourly plots, 1024x768 pixels. .gif is 18547 bytes, .png is 14244 bytes. So I definitely see .png being smaller. (Also, if you set it to gif, you end up with a gif file, which you probably wouldn't want anyway. ;-) -- Rune / 5Q5R |
Before Smith charts, my gnuplots were smaller by gif than png,OK, gnuplot Smith chart is slightly smaller by gif than png on my Windows PC, but gif takes a disturbingly long time to generate, so updated: .. with a small 'png.p' gnuplot script for generating "gnuplot.png" from current plot (remember to rename it so not overwritten by next 'png.p' invocation) and added Roman's improvements to 'smithlabel.p' |
to navigate to use esc to dismiss