.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\07-Circuit\Touchstone_Management.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_07-Circuit_Touchstone_Management.py: Circuit: Touchstone file management ----------------------------------- This example shows how you can use objects in a Touchstone file without opening AEDT. To provide the advanced postprocessing features needed for this example, Matplotlib and NumPy must be installed on your machine. This example runs only on Windows using CPython. .. GENERATED FROM PYTHON SOURCE LINES 12-15 Perform required imports ~~~~~~~~~~~~~~~~~~~~~~~~ Perform required imports and set the local path to the path for PyAEDT. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python from pyaedt import downloads example_path = downloads.download_touchstone() .. GENERATED FROM PYTHON SOURCE LINES 21-24 Import libraries and Touchstone file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Import Matplotlib, NumPy, and the Touchstone file. .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: Python from pyaedt.generic.touchstone_parser import read_touchstone .. GENERATED FROM PYTHON SOURCE LINES 28-31 Read Touchstone file ~~~~~~~~~~~~~~~~~~~~ Read the Touchstone file. .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: Python data = read_touchstone(example_path) .. GENERATED FROM PYTHON SOURCE LINES 35-39 Get curve plot ~~~~~~~~~~~~~~ Get the curve plot by category. The following code shows how to plot lists of the return losses, insertion losses, fext, and next based on a few inputs and port names. .. GENERATED FROM PYTHON SOURCE LINES 39-49 .. code-block:: Python data.plot_return_losses() data.plot_insertion_losses() data.plot_next_xtalk_losses("U1") data.plot_fext_xtalk_losses(tx_prefix="U1", rx_prefix="U7") .. image-sg:: /examples/07-Circuit/images/sphx_glr_Touchstone_Management_001.png :alt: Touchstone Management :srcset: /examples/07-Circuit/images/sphx_glr_Touchstone_Management_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 50-53 Get curve worst cases ~~~~~~~~~~~~~~~~~~~~~ Get curve worst cases. .. GENERATED FROM PYTHON SOURCE LINES 53-71 .. code-block:: Python worst_rl, global_mean = data.get_worst_curve( freq_min=1, freq_max=20, worst_is_higher=True, curve_list=data.get_return_loss_index() ) worst_il, mean2 = data.get_worst_curve(freq_min=1, freq_max=20, worst_is_higher=False, curve_list=data.get_insertion_loss_index() ) worst_fext, mean3 = data.get_worst_curve(freq_min=1, freq_max=20, worst_is_higher=True, curve_list=data.get_fext_xtalk_index_from_prefix(tx_prefix="U1", rx_prefix="U7") ) worst_next, mean4 = data.get_worst_curve( freq_min=1, freq_max=20, worst_is_higher=True, curve_list=data.get_next_xtalk_index("U1") ) .. image-sg:: /examples/07-Circuit/images/sphx_glr_Touchstone_Management_002.png :alt: Touchstone Management :srcset: /examples/07-Circuit/images/sphx_glr_Touchstone_Management_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.861 seconds) .. _sphx_glr_download_examples_07-Circuit_Touchstone_Management.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Touchstone_Management.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Touchstone_Management.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_