skrf.vi.vna.NanoVNAv2

class skrf.vi.vna.NanoVNAv2(address='ASRL/dev/ttyACM0::INSTR')[source]

Python class for NanoVNA V2 network analyzers 1.

Parameters

address (str) – SCPI identifier of the serial port for the NanoVNA. For example ‘ASRL1::INSTR’ for COM1 on Windows, or ‘ASRL/dev/ttyACM0::INSTR’ for /dev/ttyACM0 on Linux.

Examples

Load and initialize NanoVNA on COM1 (Windows OS, see Device Manager):

>>> from skrf.vi import vna
>>> nanovna = vna.NanoVNAv2('ASRL1::INSTR')

Load and initialize NanoVNA on /dev/ttyACM0 (Linux OS, see dmesg):

>>> from skrf.vi import vna
>>> nanovna = vna.NanoVNAv2('ASRL/dev/ttyACM0::INSTR')

Configure frequency sweep (from 20 MHz to 4 GHz with 200 points, i.e. 20 MHz step):

>>> nanovna.set_frequency_sweep(20e6, 4e9, 200)

Get S11 and S21 as NumPy arrays:

>>> s11, s21 = nanovna.get_s11_s21()

Get list of available traces (will always return both channels, regardless of trace configuration):

>>> traces_avail = nanovna.get_list_of_traces()

Get 1-port networks of one or both of the traces listed in get_list_of_traces():

>>> nws_all = nanovna.get_traces(traces_avail)
>>> nw_s11 = nws_all[0]
>>> nw_s21 = nws_all[1]

Get S11 as a 1-port skrf.Network:

>>> nw_1 = nanovna.get_snp_network(ports=(0,))

Get S11 and S12 as s 2-port skrf.Network (incomplete with S21=S22=0):

>>> nw_2 = nanovna.get_snp_network(ports=(0, 1))

Get S21 and S22 in a 2-port skrf.Network (incomplete with S11=S12=0):

>>> nw_3 = nanovna.get_snp_network(ports=(1, 0))

References

1

Website of NanoVNA V2: https://nanorfe.com/nanovna-v2.html

Attributes

s11

Measures \(S_{1,1}\) and returns it as a 1-port Network.

s21

Measures \(S_{2,1}\) and returns it as a 1-port Network.

Methods

__init__

Initialize a network analyzer object

close

get_list_of_traces

Returns a list of dictionaries describing all available measurement traces.

get_oneport

convenience wrapper for get_snp_network enforcing 1-port only

get_s11_s21

Returns individual NumPy arrays of the measured data of the sweep.

get_snp_network

Returns a \(N\)-port network containing the measured parameters at the positions specified in ports.

get_switch_terms

create new traces for the switch terms and return as a 2-length list of forward and reverse terms

get_traces

Returns the data of the traces listed in traces as 1-port networks.

get_twoport

convenience wrapper for get_snp_network enforcing 2-ports only

idn

Returns the identification string of the device.

reset

set_frequency_sweep

Configures the frequency sweep.

to_hz

A simple convenience function to create frequency in Hz if it is in a different unit

wait_until_finished