Loading a touchstone file

This example illustrates how to load a touchstone file into IPKISS.

Please download the touchstone file for this example: dircoup.s4p before running the sample.

See also

../_images/sphx_glr_plot_load_touchstone_001.png
import ipkiss3.all as i3
import matplotlib.pyplot as plt
import numpy as np

smat = i3.device_sim.SMatrix1DSweep.from_touchstone('dircoup.s4p')

sweep_values = smat.sweep_parameter_values
unit = smat.sweep_parameter_unit

plt.plot(sweep_values, 20 * np.log10(np.abs(smat['in1', 'in1'])), label='in1 reflection')
plt.plot(sweep_values, 20 * np.log10(np.abs(smat['in1', 'out1'])), label='in1 -> out1')
plt.xlabel("Frequency ({})".format(unit))
plt.ylabel("S Parameter [dB]")
plt.show()