nanovna-v2 / NanoVNA2-firmware

Firmware for NanoVNA V2
https://nanorfe.com/nanovna-v2.html
215 stars 85 forks source link

How to calibrate the NanoVNA through Python? #78

Open 0xCoto opened 2 years ago

0xCoto commented 2 years ago

I've managed to get everything working using the provided Python scripts and I am able to output touchstone files, plot them etc., but I see that the |S21| values disagree between the NanoVNA alone (i.e. not connected to python/a computer) and the ones the python script is measuring.

My understanding is that once I calibrate the device (SOLT) and connect it to the computer, the python interface does not seem to pick up the latest calibration on file. Is there a simple way to either load the latest calibration on file or manually re-run the SOLT calibration again through python, or do I have to write something up and save each state (OPEN, SHORT, LOAD, THRU) as a separate sNp file and apply the calibration locally?

Vinc0110 commented 2 years ago

Hi. Have a look at the scikit-rf package (imported via skrf). It offers SOLT calibration and others, see this exmaple:

https://scikit-rf.readthedocs.io/en/latest/tutorials/Calibration.html#SOLT-Example

Vinc0110 commented 2 years ago

In case anyone is still watching this issue: The latest package release of scikit-rf (version 0.22.0) now includes a dedicated instrument class for the NanoVNA V2. The usage is documented and demonstrated in this example notebook: https://scikit-rf.readthedocs.io/en/latest/examples/metrology/NanoVNA_V2_4port-splitter.html

mrleongalaxyum commented 1 year ago

Is it possible to load a calibration slot from the device using the provided nanovna.py? Although I've already recalled a cal slot on the device itself, when I run the python script, I get non-calibrated values.