Closed ruizhi92 closed 2 years ago
Hello,
I encountered a problem when using PyCall to invoke a python package scikit-rf. The problem is that plotting functions defined for a python class doesn't show. The original python code is
scikit-rf
import skrf as rf freq = rf.Frequency(start=0.1, stop=10, unit='GHz', npoints=1001) tl_media = rf.DefinedGammaZ0(freq, z0=50, gamma=1j*freq.w/rf.c) C1 = tl_media.capacitor(3.222e-12, name='C1') C2 = tl_media.capacitor(82.25e-15, name='C2') C3 = tl_media.capacitor(3.222e-12, name='C3') L2 = tl_media.inductor(8.893e-9, name='L2') RL = tl_media.resistor(50, name='RL') gnd = rf.Circuit.Ground(freq, name='gnd') port1 = rf.Circuit.Port(freq, name='port1', z0=50) port2 = rf.Circuit.Port(freq, name='port2', z0=50) cnx = [ [(port1, 0), (C1, 0), (L2, 0), (C2, 0)], [(L2, 1), (C2, 1), (C3, 0), (port2, 0)], [(gnd, 0), (C1, 1), (C3, 1)], ] cir = rf.Circuit(cnx) ntw = cir.network cir.plot_graph()
This piece of code generates plots correctly in Python.
However when using PyCall in Julia with slight change in grammer:
using PyCall rf = pyimport("skrf") freq = rf.Frequency(start=0.1, stop=10, unit="GHz", npoints=1001) tl_media = rf.DefinedGammaZ0(freq, z0=50, gamma=1im*freq.w/rf.c) C1 = tl_media.capacitor(3.222e-12, name="C1") C2 = tl_media.capacitor(82.25e-15, name="C2") C3 = tl_media.capacitor(3.222e-12, name="C3") L2 = tl_media.inductor(8.893e-9, name="L2") RL = tl_media.resistor(50, name="RL") gnd = rf.Circuit.Ground(freq, name="gnd") port1 = rf.Circuit.Port(freq, name="port1", z0=50) port2 = rf.Circuit.Port(freq, name="port2", z0=50) cnx = [ [(port1, 0), (C1, 0), (L2, 0), (C2, 0)], [(L2, 1), (C2, 1), (C3, 0), (port2, 0)], [(gnd, 0), (C1, 1), (C3, 1)], ] cir = rf.Circuit(cnx) ntw = cir.network cir.plot_graph()
Nothing shows. I wonder what's the issue here? Are there any workarounds? Thank you.
Somehow this piece of code works now... No idea why that happens.
Hello,
I encountered a problem when using PyCall to invoke a python package
scikit-rf
. The problem is that plotting functions defined for a python class doesn't show. The original python code isThis piece of code generates plots correctly in Python.
However when using PyCall in Julia with slight change in grammer:
Nothing shows. I wonder what's the issue here? Are there any workarounds? Thank you.