Skip to content

Commit

Permalink
REFACTOR: added missing images (#4874)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
Co-authored-by: Samuel Lopez <[email protected]>
Co-authored-by: Kathy Pippert <[email protected]>
  • Loading branch information
3 people authored Jul 5, 2024
1 parent e74bc88 commit a24bfdb
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 23 deletions.
35 changes: 33 additions & 2 deletions doc/source/API/Visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,43 @@ models and 3D plots.
ModelPlotter


The class TouchstoneData instead, is based on `scikit-rf <https://scikit-rf.readthedocs.io/en/latest/>`_,
The following methods allows to read and check touchstone files.

.. currentmodule:: pyaedt.generic.touchstone_parser

.. autosummary::
:toctree: _autosummary
:nosignatures:

read_touchstone
check_touchstone_files



Using the above methods you are getting an object of a class TouchstoneData.
The class TouchstoneData is based on `scikit-rf <https://scikit-rf.readthedocs.io/en/latest/>`_,
Additional methods are added to provide easy access to touchstone curves.


.. currentmodule:: pyaedt.generic.touchstone_parser

.. autoclass:: TouchstoneData
.. autosummary::
:toctree: _autosummary
:nosignatures:

TouchstoneData.get_insertion_loss_index
TouchstoneData.plot_insertion_losses
TouchstoneData.plot
TouchstoneData.plot_return_losses
TouchstoneData.get_mixed_mode_touchstone_data
TouchstoneData.get_return_loss_index
TouchstoneData.get_insertion_loss_index_from_prefix
TouchstoneData.get_next_xtalk_index
TouchstoneData.get_fext_xtalk_index_from_prefix
TouchstoneData.plot_next_xtalk_losses
TouchstoneData.plot_fext_xtalk_losses
TouchstoneData.get_worst_curve



Here an example on how to use TouchstoneData class.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions examples/07-Circuit/Reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@
###############################################################################
# Create transient report
# ~~~~~~~~~~~~~~~~~~~~~~~
# Property dictionary can be customized in any aspect and new report can be created easily.
# In this example the curve name is customized.
# You can customize any aspect of the property dictionary and easily create a new report.
# The following code customizes the curve name.
# The expressions key can be a list of expressions as follows or a dictionary containing the expressions to plot and line properties.
# props["expressions"] = { "V(Battery)" :
# {"color": [0, 255, 0], "trace_style": "Solid", "width": 1, "trace_type": "Continuous"}}

props["expressions"] = {"V(Battery)": {}, "V(U1_VDD)": {}}

props["expressions"] = ["V(Battery)", "V(U1_VDD)"]
props["plot_name"] = "Battery Voltage"
report3 = cir.post.create_report_from_configuration(report_settings=props, solution_name="NexximTransient")
out = cir.post.export_report_to_jpg(cir.working_directory, report3.plot_name)
Expand Down
25 changes: 11 additions & 14 deletions pyaedt/generic/touchstone_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def plot_insertion_losses(self, threshold=-3, plot=True):
----------
threshold : float, int, optional
Threshold to determine shorted ports in dB.
plot: bool
Whether to plot.
plot : bool, optional
Whether to plot. The default is ``True``.
Returns
-------
Expand All @@ -171,7 +171,7 @@ def plot(self, index_couples=None, show=True):
----------
index_couples : list, optional
List of indexes couple to plot. Default is ``None`` to plot all ``port_tuples``.
show: bool
show : bool
Whether to plot. Default is ``True``.
Returns
Expand All @@ -191,8 +191,6 @@ def plot(self, index_couples=None, show=True):
def plot_return_losses(self): # pragma: no cover
"""Plot all return losses.
Parameters
----------
Returns
-------
bool
Expand Down Expand Up @@ -344,7 +342,7 @@ def get_next_xtalk_index(self, tx_prefix=""):
Returns
-------
list
list of index couples representing Near End XTalks
List of index couples representing Near End XTalks.
"""
if tx_prefix:
Expand Down Expand Up @@ -432,27 +430,26 @@ def plot_fext_xtalk_losses(self, tx_prefix, rx_prefix, skip_same_index_couples=T

@pyaedt_function_handler()
def get_worst_curve(self, freq_min=None, freq_max=None, worst_is_higher=True, curve_list=None, plot=True):
"""This method analyze a solution data object with multiple curves and
find the worst curve returning its name and an ordered dictionary with each curve mean.
Actual algorithm simply takes the mean of the magnitude over the frequency range.
"""Analyze a solution data object with multiple curves and find the worst curve.
Take the mean of the magnitude over the frequency range.
Parameters
----------
freq_min : float, optional
minimum frequency to analyze in GHz (None to 0). Default value is ``None``.
Minimum frequency to analyze in GHz (None to 0). Default value is ``None``.
freq_max : float, optional
maximum frequency to analyze in GHz (None to max freq). Default value is ``None``.
Maximum frequency to analyze in GHz (None to max freq). Default value is ``None``.
worst_is_higher : bool
boolean. if True, the worst curve is the one with higher mean value. Default value is ``None``.
Worst curve is the one with higher mean value. Default value is ``True``.
curve_list : list
List of [m,n] index of curves on which to search. None to search on all curves. Default value is ``None``.
plot : bool, optional
Whether to plot or not the chart.
Returns
-------
type
worst element str, dictionary of ordered expression and their mean
tuple
Worst element, dictionary of ordered expression.
"""

Expand Down
8 changes: 8 additions & 0 deletions pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,14 @@ def create_report_from_configuration(self, input_file=None, report_settings=None
props = read_configuration_file(input_file)
else:
props = report_settings
if (
isinstance(props.get("expressions", {}), list)
and props["expressions"]
and isinstance(props["expressions"][0], str)
): # pragma: no cover
props["expressions"] = {i: {} for i in props["expressions"]}
elif isinstance(props.get("expressions", {}), str): # pragma: no cover
props["expressions"] = {props["expressions"]: {}}
_dict_items_to_list_items(props, "expressions")
if not solution_name:
solution_name = self._app.nominal_sweep
Expand Down
8 changes: 4 additions & 4 deletions pyaedt/modules/report_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,15 @@ def _update_traces(self):
)
self.eye_mask(
points=eye_points,
xunits=eye_xunits,
yunits=eye_yunits,
x_units=eye_xunits,
y_units=eye_yunits,
enable_limits=eye_enable,
upper_limit=eye_upper,
lower_limit=eye_lower,
color=eye_color,
transparency=eye_transparency,
xoffset=eye_xoffset,
yoffset=eye_yoffset,
x_offset=eye_xoffset,
y_offset=eye_yoffset,
)
if "limitLines" in self.props and self.report_category not in ["Eye Diagram", "Statistical Eye"]:
for line in self.props["limitLines"].values():
Expand Down
6 changes: 6 additions & 0 deletions pyaedt/workflows/project/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import pyaedt
from pyaedt import get_pyaedt_app
from pyaedt.generic.general_methods import is_windows
from pyaedt.generic.pdf import AnsysReport
from pyaedt.workflows.misc import get_aedt_version
from pyaedt.workflows.misc import get_arguments
Expand Down Expand Up @@ -77,6 +78,11 @@ def main(extension_args):
report.add_toc()
out = report.save_pdf(aedtapp.working_directory, "AEDT_Results.pdf")
aedtapp.logger.info(f"Report Generated. {out}")
if is_windows and not extension_args["is_test"]: # pragma: no cover
try: # nosec
os.startfile(out)
except Exception: # pragma: no cover
aedtapp.logger.warning(f"Failed to open {out}")

if not extension_args["is_test"]: # pragma: no cover
app.release_desktop(False, False)
Expand Down

0 comments on commit a24bfdb

Please sign in to comment.