'saving s2p format for vector network analyzer vna by jupyter notebook

I connected my laptop to a Vector Network Analyzer (VNA) by a GPIB cable. I identified the instrument to the laptop by the following code in Jupyter Notebook:

from pleasure.instruments.Agilent import Agilent8722ES
vna = Agilent8722ES("GPIB::16")

now the VNA is connected, and I can apply different commands to the system, like changing the frequency like:

vna.write("STAR 5E4 Hz")

My problem is now how to save the data in S2P format I am trying to apply the following code

:calculate1::measure1:data:snp:ports:save "1,2","D:\users\filename.s2p"

But a syntax error has shown up. Can anyone modify the code based on Jupyter notebook commands?

e.g. this one is not working also:

vna.ask("calculate1::measure1:data:snp:ports:save "1,2","D:\users\filename.s2p"")

plePse let me know if you can think of any other solutions for saving s2p format from the device by applying a code in the Jupyter notebook.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source