From 0ae6cb3e5d4900c412d55508b7cfdedd9c644307 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 14:35:52 +0100 Subject: [PATCH 1/8] Added new method get_traces_for_plot to get trace list ready to be plotted. Refactored get_excitations_name. In some Classes it was a property in some other a method. Deprecated and replaced with excitations property --- _unittest/test_20_HFSS.py | 16 ++-- examples/02-HFSS/HFSS3DLayout_Via.py | 5 +- examples/05-Q3D/Q3D_Example.py | 2 +- examples/06-Multiphysics/Hfss_Mechanical.py | 2 +- pyaedt/application/Analysis.py | 86 ++++++++++++++++++++- pyaedt/application/Analysis3DLayout.py | 40 ++++++++-- pyaedt/application/AnalysisNexxim.py | 42 +++++++--- pyaedt/generic/general_methods.py | 25 ++++++ pyaedt/hfss.py | 28 +++---- pyaedt/hfss3dlayout.py | 6 +- pyaedt/modeler/Model3D.py | 2 +- pyaedt/modeler/Modeler.py | 17 ---- pyaedt/modules/Boundary.py | 32 ++------ pyaedt/q3d.py | 13 ++++ 14 files changed, 222 insertions(+), 94 deletions(-) diff --git a/_unittest/test_20_HFSS.py b/_unittest/test_20_HFSS.py index 01cdbcf582a..ab99eed82b0 100644 --- a/_unittest/test_20_HFSS.py +++ b/_unittest/test_20_HFSS.py @@ -466,11 +466,11 @@ def test_18_create_sources_on_objects(self): port = self.aedtapp.create_voltage_source_from_objects( box1.name, "BoxVolt2", self.aedtapp.AxisDir.XNeg, "Volt1" ) - assert port.name in self.aedtapp.modeler.get_excitations_name() + assert port.name in self.aedtapp.excitations port = self.aedtapp.create_current_source_from_objects( "BoxVolt1", "BoxVolt2", self.aedtapp.AxisDir.XPos, "Curr1" ) - assert port.name in self.aedtapp.modeler.get_excitations_name() + assert port.name in self.aedtapp.excitations def test_19_create_lumped_on_sheet(self): rect = self.aedtapp.modeler.create_rectangle( @@ -479,14 +479,14 @@ def test_19_create_lumped_on_sheet(self): port = self.aedtapp.create_lumped_port_to_sheet( rect.name, self.aedtapp.AxisDir.XNeg, 50, "Lump_sheet", True, False ) - assert port.name + ":1" in self.aedtapp.modeler.get_excitations_name() + assert port.name + ":1" in self.aedtapp.excitations def test_20_create_voltage_on_sheet(self): rect = self.aedtapp.modeler.create_rectangle( self.aedtapp.PLANE.XY, [0, 0, 0], [10, 2], name="lump_volt", matname="Copper" ) port = self.aedtapp.assign_voltage_source_to_sheet(rect.name, self.aedtapp.AxisDir.XNeg, "LumpVolt1") - assert port.name in self.aedtapp.modeler.get_excitations_name() + assert port.name in self.aedtapp.excitations assert self.aedtapp.get_property_value("BoundarySetup:LumpVolt1", "VoltageMag", "Excitation") == "1V" def test_21_create_open_region(self): @@ -709,11 +709,11 @@ def test_45_terminal_port(self): port = self.aedtapp.create_lumped_port_between_objects( box1, box2.name, self.aedtapp.AxisDir.XNeg, 50, "Lump1", True, False ) - assert "Lump1_T1" in self.aedtapp.get_excitations_name() + assert "Lump1_T1" in self.aedtapp.excitations port2 = self.aedtapp.create_lumped_port_to_sheet( sheet.name, self.aedtapp.AxisDir.XNeg, 50, "Lump_sheet", True, False, reference_object_list=[box1] ) - assert port2.name + "_T1" in self.aedtapp.modeler.get_excitations_name() + assert port2.name + "_T1" in self.aedtapp.excitations box1 = self.aedtapp.modeler.create_box([-40, -40, -20], [80, 80, 10], name="gnd", matname="copper") box2 = self.aedtapp.modeler.create_box([-40, -40, 10], [80, 80, 10], name="sig", matname="copper") @@ -728,3 +728,7 @@ def test_46_mesh_settings(self): def test_47_convert_near_field(self): example_project = os.path.join(local_path, "example_models", "nf_test") assert os.path.exists(convert_nearfield_data(example_project, self.local_scratch.path)) + + def test_48_traces(self): + assert len(self.aedtapp.excitations) > 0 + assert len(self.aedtapp.get_traces_for_plot()) > 0 \ No newline at end of file diff --git a/examples/02-HFSS/HFSS3DLayout_Via.py b/examples/02-HFSS/HFSS3DLayout_Via.py index 4dabdf06ae0..2bfb7a7eceb 100644 --- a/examples/02-HFSS/HFSS3DLayout_Via.py +++ b/examples/02-HFSS/HFSS3DLayout_Via.py @@ -91,9 +91,8 @@ # This example solves and plots results. h3d.analyze_nominal() -h3d.post.create_rectangular_plot( - ["db(S(Port1,Port1))", "db(S(Port1,Port2))"], families_dict=h3d.available_variations.nominal_w_values_dict -) +traces = h3d.get_traces_for_plot(first_element_filter="Port1") +h3d.post.create_rectangular_plot(traces, families_dict=h3d.available_variations.nominal_w_values_dict) ############################################################################### # Close AEDT diff --git a/examples/05-Q3D/Q3D_Example.py b/examples/05-Q3D/Q3D_Example.py index 509b2056c46..6eb0178fe07 100644 --- a/examples/05-Q3D/Q3D_Example.py +++ b/examples/05-Q3D/Q3D_Example.py @@ -116,7 +116,7 @@ q.post.create_rectangular_plot(expression=data_plot_self, context="Original") -data_plot_mutual = q.matrices[0].get_sources_for_plot(get_self_terms=False, get_mutual_terms=True) +data_plot_mutual = q.get_traces_for_plot(get_self_terms=False, get_mutual_terms=True) q.post.create_rectangular_plot(expression=data_plot_mutual, context="Original", plot_type="Data Table") diff --git a/examples/06-Multiphysics/Hfss_Mechanical.py b/examples/06-Multiphysics/Hfss_Mechanical.py index 46faa26ebff..32b0cefca74 100644 --- a/examples/06-Multiphysics/Hfss_Mechanical.py +++ b/examples/06-Multiphysics/Hfss_Mechanical.py @@ -36,7 +36,7 @@ version = "2021.2" hfss = Hfss(project_temp_name, specified_version=version) -pin_names = hfss.modeler.get_excitations_name() +pin_names = hfss.modeler.excitations ############################################################################### diff --git a/pyaedt/application/Analysis.py b/pyaedt/application/Analysis.py index 1eca0cced37..329d6459e11 100644 --- a/pyaedt/application/Analysis.py +++ b/pyaedt/application/Analysis.py @@ -12,7 +12,7 @@ import warnings from collections import OrderedDict -from pyaedt.generic.general_methods import aedt_exception_handler, generate_unique_name +from pyaedt.generic.general_methods import aedt_exception_handler, generate_unique_name, filter_tuple from pyaedt.generic.constants import ( AXIS, PLANE, @@ -483,8 +483,8 @@ def SolutionTypes(self): """ return SOLUTIONS() - @aedt_exception_handler - def get_excitations_name(self): + @property + def excitations(self): """Get all excitation names. Returns @@ -505,6 +505,84 @@ def get_excitations_name(self): except: return [] + @aedt_exception_handler + def get_excitations_name(self): + """Get all excitation names. + + .. deprecated:: 0.4.27 + Use :func:`excitations` property instead. + + Returns + ------- + list + List of excitation names. Excitations with multiple modes will return one + excitation for each mode. + + References + ---------- + + >>> oModule.GetExcitations + """ + warnings.warn( + "`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning + ) + return self.excitations + + @aedt_exception_handler + def get_traces_for_plot( + self, + get_self_terms=True, + get_mutual_terms=True, + first_element_filter=None, + second_element_filter=None, + category="dB(S", + ): + """Return a list of traces of specified design ready to be used in plot reports. + + Parameters + ---------- + get_self_terms : bool + Either if self terms have to be returned or not. + get_mutual_terms : bool + Either if mutual terms have to be returned or not. + first_element_filter : str, optional + Filter to apply to first element of equation. It accepts `*` and `?` as special characters. + second_element_filter : str, optional + Filter to apply to second element of equation. It accepts `*` and `?` as special characters. + category : str + Plot category name as in the report (including operator). Eg. "dB(S" is category Capacitance. + + Returns + ------- + list + + Examples + -------- + >>> from pyaedt import Q3d + >>> hfss = hfss(project_path) + >>> hfss.get_traces_for_plot(first_element_filter="Bo?1", + ... second_element_filter="GND*", category="dB(S") + """ + if not first_element_filter: + first_element_filter = "*" + if not second_element_filter: + second_element_filter = "*" + list_output = [] + end_str = ")" * (category.count('(') + 1) + if get_self_terms: + for el in self.excitations: + value = "{}({},{}{}".format(category, el, el, end_str) + if filter_tuple(value, first_element_filter, second_element_filter): + list_output.append(value) + if get_mutual_terms: + for el1 in self.excitations: + for el2 in self.excitations: + if el1 != el2: + value = "{}({},{}{}".format(category, el1, el2, end_str) + if filter_tuple(value, first_element_filter, second_element_filter): + list_output.append(value) + return list_output + @aedt_exception_handler def analyze_all(self): """Analyze all setup in an actual design. @@ -1125,7 +1203,7 @@ def create_setup(self, setupname="MySetupAuto", setuptype=None, props={}): setuptype = self.design_solutions.default_setup name = self.generate_unique_setup_name(setupname) setup = Setup(self, setuptype, name) - if self.design_type == "HFSS" and not self.get_excitations_name() and "MaxDeltaS" in setup.props: + if self.design_type == "HFSS" and not self.excitations and "MaxDeltaS" in setup.props: new_dict = OrderedDict() for k, v in setup.props.items(): if k == "MaxDeltaS": diff --git a/pyaedt/application/Analysis3DLayout.py b/pyaedt/application/Analysis3DLayout.py index 38d271f54a2..7bb107e7c57 100644 --- a/pyaedt/application/Analysis3DLayout.py +++ b/pyaedt/application/Analysis3DLayout.py @@ -1,4 +1,5 @@ import os +import warnings from pyaedt.generic.general_methods import aedt_exception_handler, is_ironpython from pyaedt.modeler.Model3DLayout import Modeler3DLayout @@ -136,10 +137,30 @@ def mesh(self): """ return self._mesh + @property + def excitations(self): + """Get all excitation names. + + Returns + ------- + list + List of excitation names. Excitations with multiple modes will return one + excitation for each mode. + + References + ---------- + + >>> oModule.GetExcitations + """ + return list(self.oboundary.GetAllPortsList()) + @property def get_excitations_name(self): """Excitation names. + .. deprecated:: 0.4.27 + Use :func:`excitations` property instead. + Returns ------- list @@ -150,7 +171,10 @@ def get_excitations_name(self): >>> oModule.GetAllPortsList """ - return list(self.oboundary.GetAllPortsList()) + warnings.warn( + "`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning + ) + return self.excitations @property def get_all_sparameter_list(self, excitation_names=[]): @@ -171,7 +195,7 @@ def get_all_sparameter_list(self, excitation_names=[]): """ if not excitation_names: - excitation_names = self.get_excitations_name + excitation_names = self.excitations spar = [] k = 0 for i in excitation_names: @@ -234,7 +258,7 @@ def get_all_return_loss_list(self, excitation_names=[], excitation_name_prefix=" >>> oModule.GetAllPorts """ if not excitation_names: - excitation_names = self.get_excitations_name + excitation_names = self.excitations if excitation_name_prefix: excitation_names = [i for i in excitation_names if excitation_name_prefix.lower() in i.lower()] spar = [] @@ -271,9 +295,9 @@ def get_all_insertion_loss_list(self, trlist=[], reclist=[], tx_prefix="", rx_pr """ spar = [] if not trlist: - trlist = [i for i in self.get_excitations_name if tx_prefix in i] + trlist = [i for i in self.excitations if tx_prefix in i] if not reclist: - reclist = [i for i in self.get_excitations_name if rx_prefix in i] + reclist = [i for i in self.excitations if rx_prefix in i] if len(trlist) != len(reclist): self.logger.error("The TX and RX lists should be same length.") return False @@ -305,7 +329,7 @@ def get_next_xtalk_list(self, trlist=[], tx_prefix=""): """ next = [] if not trlist: - trlist = [i for i in self.get_excitations_name if tx_prefix in i] + trlist = [i for i in self.excitations if tx_prefix in i] for i in trlist: k = trlist.index(i) + 1 while k < len(trlist): @@ -346,9 +370,9 @@ def get_fext_xtalk_list(self, trlist=[], reclist=[], tx_prefix="", rx_prefix="", """ fext = [] if not trlist: - trlist = [i for i in self.get_excitations_name if tx_prefix in i] + trlist = [i for i in self.excitations if tx_prefix in i] if not reclist: - reclist = [i for i in self.get_excitations_name if rx_prefix in i] + reclist = [i for i in self.excitations if rx_prefix in i] for i in trlist: for k in reclist: if not skip_same_index_couples or reclist.index(k) != trlist.index(i): diff --git a/pyaedt/application/AnalysisNexxim.py b/pyaedt/application/AnalysisNexxim.py index f116813391c..db482cdc03a 100644 --- a/pyaedt/application/AnalysisNexxim.py +++ b/pyaedt/application/AnalysisNexxim.py @@ -1,3 +1,5 @@ +import warnings + from pyaedt.generic.general_methods import aedt_exception_handler from pyaedt.modeler.Circuit import ModelerNexxim from pyaedt.modules.PostProcessor import CircuitPostProcessor @@ -96,9 +98,29 @@ def setup_names(self): return self.oanalysis.GetAllSolutionSetups() @property + def excitations(self): + """Get all excitation names. + + Returns + ------- + list + List of excitation names. Excitations with multiple modes will return one + excitation for each mode. + + References + ---------- + + >>> oModule.GetExcitations + """ + ports = [p.replace("IPort@", "").split(";")[0] for p in self.modeler.oeditor.GetAllPorts()] + return ports + @property def get_excitations_name(self): """Excitation names. + .. deprecated:: 0.4.27 + Use :func:`excitations` property instead. + Returns ------- type @@ -109,8 +131,10 @@ def get_excitations_name(self): >>> oEditor.GetAllPorts """ - ports = [p.replace("IPort@", "").split(";")[0] for p in self.modeler.oeditor.GetAllPorts()] - return ports + warnings.warn( + "`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning + ) + return self.excitations @property def get_all_sparameter_list(self, excitation_names=[]): @@ -131,7 +155,7 @@ def get_all_sparameter_list(self, excitation_names=[]): """ if not excitation_names: - excitation_names = self.get_excitations_name + excitation_names = self.excitations spar = [] k = 0 for i in excitation_names: @@ -166,7 +190,7 @@ def get_all_return_loss_list(self, excitation_names=[], excitation_name_prefix=" >>> oEditor.GetAllPorts """ if not excitation_names: - excitation_names = self.get_excitations_name + excitation_names = self.excitations if excitation_name_prefix: excitation_names = [i for i in excitation_names if excitation_name_prefix.lower() in i.lower()] spar = [] @@ -203,9 +227,9 @@ def get_all_insertion_loss_list(self, trlist=[], reclist=[], tx_prefix="", rx_pr """ spar = [] if not trlist: - trlist = [i for i in self.get_excitations_name if tx_prefix in i] + trlist = [i for i in self.excitations if tx_prefix in i] if not reclist: - reclist = [i for i in self.get_excitations_name if rx_prefix in i] + reclist = [i for i in self.excitations if rx_prefix in i] if len(trlist) != len(reclist): self.logger.error("The TX and RX lists should be the same length.") return False @@ -238,7 +262,7 @@ def get_next_xtalk_list(self, trlist=[], tx_prefix=""): """ next = [] if not trlist: - trlist = [i for i in self.get_excitations_name if tx_prefix in i] + trlist = [i for i in self.excitations if tx_prefix in i] for i in trlist: k = trlist.index(i) + 1 while k < len(trlist): @@ -281,9 +305,9 @@ def get_fext_xtalk_list(self, trlist=[], reclist=[], tx_prefix="", rx_prefix="", """ fext = [] if not trlist: - trlist = [i for i in self.get_excitations_name if tx_prefix in i] + trlist = [i for i in self.excitations if tx_prefix in i] if not reclist: - reclist = [i for i in self.get_excitations_name if rx_prefix in i] + reclist = [i for i in self.excitations if rx_prefix in i] for i in trlist: for k in reclist: if not skip_same_index_couples or reclist.index(k) != trlist.index(i): diff --git a/pyaedt/generic/general_methods.py b/pyaedt/generic/general_methods.py index 5c7bc33f3c0..1f8341c05b1 100644 --- a/pyaedt/generic/general_methods.py +++ b/pyaedt/generic/general_methods.py @@ -11,6 +11,7 @@ from collections import OrderedDict import inspect import itertools +import re try: logger = logging.getLogger("Global") @@ -541,3 +542,27 @@ def write_csv(output, list_data, delimiter=",", quotechar="|", quoting=csv.QUOTE writer.writerow(data) f.close() return True + + +@aedt_exception_handler +def filter_tuple(value, search_key1, search_key2): + """Filter a tuple of 2 elements with two search keywords""" + ignore_case = True + + def _create_pattern(k1, k2): + k1a = re.sub(r"\?", r".", k1) + k1b = re.sub(r"\*", r".*?", k1a) + k2a = re.sub(r"\?", r".", k2) + k2b = re.sub(r"\*", r".*?", k2a) + pattern = r".*\({},{}\)".format(k1b, k2b) + return pattern + + if ignore_case: + compiled_re = re.compile(_create_pattern(search_key1, search_key2), re.IGNORECASE) + else: + compiled_re = re.compile(_create_pattern(search_key1, search_key2)) + + m = compiled_re.search(value) + if m: + return True + return False diff --git a/pyaedt/hfss.py b/pyaedt/hfss.py index 26d1a50cf45..be371f4aeb3 100644 --- a/pyaedt/hfss.py +++ b/pyaedt/hfss.py @@ -1513,7 +1513,7 @@ def create_circuit_port_between_objects( port_edges = [] if not portname: portname = generate_unique_name("Port") - elif portname + ":1" in self.modeler.get_excitations_name(): + elif portname + ":1" in self.excitations: portname = generate_unique_name(portname) return self._create_circuit_port(out, impedance, portname, renorm, deemb, renorm_impedance=renorm_impedance) return False @@ -1586,7 +1586,7 @@ def create_lumped_port_between_objects( if not portname: portname = generate_unique_name("Port") - elif portname + ":1" in self.modeler.get_excitations_name(): + elif portname + ":1" in self.excitations: portname = generate_unique_name(portname) if "Modal" in self.solution_type: return self._create_lumped_driven(sheet_name, point0, point1, impedance, portname, renorm, deemb) @@ -1854,7 +1854,7 @@ def create_voltage_source_from_objects(self, startobj, endobject, axisdir=0, sou ) if not sourcename: sourcename = generate_unique_name("Voltage") - elif sourcename + ":1" in self.modeler.get_excitations_name(): + elif sourcename + ":1" in self.excitations: sourcename = generate_unique_name(sourcename) return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Voltage") return False @@ -1914,7 +1914,7 @@ def create_current_source_from_objects(self, startobj, endobject, axisdir=0, sou ) if not sourcename: sourcename = generate_unique_name("Current") - elif sourcename + ":1" in self.modeler.get_excitations_name(): + elif sourcename + ":1" in self.excitations: sourcename = generate_unique_name(sourcename) return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Current") return False @@ -2033,7 +2033,7 @@ def create_wave_port_between_objects( self._create_pec_cap(sheet_name, startobj, dist / 10) if not portname: portname = generate_unique_name("Port") - elif portname + ":1" in self.modeler.get_excitations_name(): + elif portname + ":1" in self.excitations: portname = generate_unique_name(portname) if "Modal" in self.solution_type: return self._create_waveport_driven( @@ -2460,7 +2460,7 @@ def create_wave_port_microstrip_between_objects( self._create_pec_cap(sheet_name, startobj, dist / 10) if not portname: portname = generate_unique_name("Port") - elif portname + ":1" in self.modeler.get_excitations_name(): + elif portname + ":1" in self.excitations: portname = generate_unique_name(portname) if "Modal" in self.solution_type: return self._create_waveport_driven( @@ -3031,7 +3031,7 @@ def create_wave_port_from_sheet( if not portname: portname = generate_unique_name("Port") - elif portname + ":1" in self.modeler.get_excitations_name(): + elif portname + ":1" in self.excitations: portname = generate_unique_name(portname) return self._create_waveport_driven( sheet, int_start, int_stop, impedance, portname, renorm, nummodes, deemb @@ -3046,7 +3046,7 @@ def create_wave_port_from_sheet( return False if not portname: portname = generate_unique_name("Port") - elif portname in self.modeler.get_excitations_name(): + elif portname in self.excitations: portname = generate_unique_name(portname) if terminal_references: return self._create_port_terminal(faces, terminal_references, portname, renorm=renorm, iswaveport=True) @@ -3108,7 +3108,7 @@ def create_lumped_port_to_sheet( if not portname: portname = generate_unique_name("Port") - elif portname + ":1" in self.modeler.get_excitations_name(): + elif portname + ":1" in self.excitations: portname = generate_unique_name(portname) port = False if "Modal" in self.solution_type: @@ -3191,7 +3191,7 @@ def assign_voltage_source_to_sheet(self, sheet_name, axisdir=0, sourcename=None) point0, point1 = self.modeler.get_mid_points_on_dir(sheet_name, axisdir) if not sourcename: sourcename = generate_unique_name("Voltage") - elif sourcename + ":1" in self.modeler.get_excitations_name(): + elif sourcename + ":1" in self.excitations: sourcename = generate_unique_name(sourcename) return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Voltage") return False @@ -3237,7 +3237,7 @@ def assign_current_source_to_sheet(self, sheet_name, axisdir=0, sourcename=None) point0, point1 = self.modeler.get_mid_points_on_dir(sheet_name, axisdir) if not sourcename: sourcename = generate_unique_name("Current") - elif sourcename + ":1" in self.modeler.get_excitations_name(): + elif sourcename + ":1" in self.excitations: sourcename = generate_unique_name(sourcename) return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Current") return False @@ -3540,7 +3540,7 @@ def create_circuit_port_from_edges( edge_list = [edge_signal, edge_gnd] if not port_name: port_name = generate_unique_name("Port") - elif port_name + ":1" in self.modeler.get_excitations_name(): + elif port_name + ":1" in self.excitations: port_name = generate_unique_name(port_name) return self._create_circuit_port( @@ -3842,7 +3842,7 @@ def validate_full_design(self, dname=None, outputdir=None, ports=None): msg = "Excitations Check:" val_list.append(msg) if self.solution_type != "Eigenmode": - detected_excitations = self.modeler.get_excitations_name() + detected_excitations = self.excitations if ports: if "Terminal" in self.solution_type: # For each port, there is terminal and reference excitations. @@ -3944,7 +3944,7 @@ def create_scattering( self.logger.error("Setup %s doesn't exist in the Setup list.", sweep_name) return False if not port_names: - port_names = self.modeler.get_excitations_name() + port_names = self.excitations full_matrix = False if not port_excited: port_excited = port_names diff --git a/pyaedt/hfss3dlayout.py b/pyaedt/hfss3dlayout.py index 71dd6a41e42..8e5e67a90aa 100644 --- a/pyaedt/hfss3dlayout.py +++ b/pyaedt/hfss3dlayout.py @@ -455,7 +455,7 @@ def validate_full_design(self, name=None, outputdir=None, ports=None): msg = "Excitation Messages:" validation.writelines(msg + "\n") val_list.append(msg) - numportsdefined = int(len(self.get_excitations_name)) + numportsdefined = int(len(self.excitations)) if ports is not None and ports != numportsdefined: msg = "**** Port Number Error! - Please check model" self.logger.error(msg) @@ -473,7 +473,7 @@ def validate_full_design(self, name=None, outputdir=None, ports=None): validation.writelines(msg2 + "\n") val_list.append(msg2) - excitation_names = self.get_excitations_name + excitation_names = self.excitations for excitation in excitation_names: msg = "Excitation name: " + str(excitation) self.logger.info(msg) @@ -519,7 +519,7 @@ def create_scattering( if not sweep_name: sweep_name = self.existing_analysis_sweeps[1] if not port_names: - port_names = self.get_excitations_name + port_names = self.excitations if not port_excited: port_excited = port_names Trace = [ diff --git a/pyaedt/modeler/Model3D.py b/pyaedt/modeler/Model3D.py index 56a63935e1d..f20f8f38053 100644 --- a/pyaedt/modeler/Model3D.py +++ b/pyaedt/modeler/Model3D.py @@ -160,7 +160,7 @@ def create_3dcomponent(self, component_file, component_name=None, variables_to_i pass arg2.append("MeshRegions:="), arg2.append(meshregions) else: - excitations = self.get_excitations_name() + excitations = self._app.excitations arg2.append("Excitations:="), arg2.append(excitations) meshops = [el.name for el in self._app.mesh.meshoperations] arg2.append("MeshOperations:="), arg2.append(meshops) diff --git a/pyaedt/modeler/Modeler.py b/pyaedt/modeler/Modeler.py index 8634e9fa00f..0ab6f9d4a53 100644 --- a/pyaedt/modeler/Modeler.py +++ b/pyaedt/modeler/Modeler.py @@ -1897,23 +1897,6 @@ def duplicate_and_unite(sheet_name, array1, array2, dup_factor): return sheet_name, point0, point1 - @aedt_exception_handler - def get_excitations_name(self): - """Get all excitation names. - - Returns - ------- - list - List of excitation names. Excitations with multiple modes will return one - excitation for each mode. - - References - ---------- - - >>> oModule.GetExcitations - """ - return self._app.get_excitations_name() - @aedt_exception_handler def get_boundaries_name(self): """Retrieve all boundary names. diff --git a/pyaedt/modules/Boundary.py b/pyaedt/modules/Boundary.py index 02d4adfc173..31e0c6bf650 100644 --- a/pyaedt/modules/Boundary.py +++ b/pyaedt/modules/Boundary.py @@ -4,7 +4,7 @@ from collections import OrderedDict import re -from pyaedt.generic.general_methods import aedt_exception_handler, generate_unique_name +from pyaedt.generic.general_methods import aedt_exception_handler, generate_unique_name, filter_tuple from pyaedt.generic.DataHandlers import _dict2arg from pyaedt.modeler.Object3d import EdgePrimitive, FacePrimitive, VertexPrimitive from pyaedt.generic.DataHandlers import random_string @@ -162,12 +162,12 @@ def create(self): """ self.name = "InsertNativeComponentData" try: - names = [i for i in self._app.modeler.get_excitations_name()] + names = [i for i in self._app.excitations] except Exception as e: names = [] self.antennaname = self._app.modeler.oeditor.InsertNativeComponent(self._get_args()) try: - a = [i for i in self._app.modeler.get_excitations_name() if i not in names] + a = [i for i in self._app.excitations if i not in names] self.excitation_name = a[0].split(":")[0] except Exception as e: self.excitation_name = self.antennaname @@ -1046,28 +1046,6 @@ def sources(self, is_gc_sources=True): self._sources = list(self._app.omatrix.ListReduceMatrixReducedSources(self.name)) return self._sources - @staticmethod - def _filter(value, search_key1, search_key2): - ignore_case = True - - def _create_pattern(k1, k2): - k1a = re.sub(r"\?", r".", k1) - k1b = re.sub(r"\*", r".*?", k1a) - k2a = re.sub(r"\?", r".", k2) - k2b = re.sub(r"\*", r".*?", k2a) - pattern = r".*\({},{}\)".format(k1b, k2b) - return pattern - - if ignore_case: - compiled_re = re.compile(_create_pattern(search_key1, search_key2), re.IGNORECASE) - else: - compiled_re = re.compile(_create_pattern(search_key1, search_key2)) - - m = compiled_re.search(value) - if m: - return True - return False - @aedt_exception_handler def get_sources_for_plot( self, @@ -1115,14 +1093,14 @@ def get_sources_for_plot( if get_self_terms: for el in self.sources(is_gc_sources=is_cg): value = "{}({},{})".format(category, el, el) - if self._filter(value, first_element_filter, second_element_filter): + if filter_tuple(value, first_element_filter, second_element_filter): list_output.append(value) if get_mutual_terms: for el1 in self.sources(is_gc_sources=is_cg): for el2 in self.sources(is_gc_sources=is_cg): if el1 != el2: value = "{}({},{})".format(category, el1, el2) - if self._filter(value, first_element_filter, second_element_filter): + if filter_tuple(value, first_element_filter, second_element_filter): list_output.append(value) return list_output diff --git a/pyaedt/q3d.py b/pyaedt/q3d.py index 52266ad5635..5458542435e 100644 --- a/pyaedt/q3d.py +++ b/pyaedt/q3d.py @@ -80,6 +80,19 @@ def __init__( def __enter__(self): return self + @property + def excitations(self): + """Get all excitation names. + + Returns + ------- + list + List of excitation names. Excitations with multiple modes will return one + excitation for each mode. + + """ + return self.matrices[0].sources + @aedt_exception_handler def insert_reduced_matrix(self, operation_name, source_names=None, rm_name=None): """Insert a new reduced matrix. From 69cd6b0898061833d905b532e1d23ad750360547 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 14:36:06 +0100 Subject: [PATCH 2/8] Added new method get_traces_for_plot to get trace list ready to be plotted. Refactored get_excitations_name. In some Classes it was a property in some other a method. Deprecated and replaced with excitations property --- _unittest/test_20_HFSS.py | 2 +- pyaedt/application/Analysis.py | 6 ++---- pyaedt/application/Analysis3DLayout.py | 4 +--- pyaedt/application/AnalysisNexxim.py | 5 ++--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/_unittest/test_20_HFSS.py b/_unittest/test_20_HFSS.py index ab99eed82b0..6826ee54c35 100644 --- a/_unittest/test_20_HFSS.py +++ b/_unittest/test_20_HFSS.py @@ -731,4 +731,4 @@ def test_47_convert_near_field(self): def test_48_traces(self): assert len(self.aedtapp.excitations) > 0 - assert len(self.aedtapp.get_traces_for_plot()) > 0 \ No newline at end of file + assert len(self.aedtapp.get_traces_for_plot()) > 0 diff --git a/pyaedt/application/Analysis.py b/pyaedt/application/Analysis.py index 329d6459e11..26679523af1 100644 --- a/pyaedt/application/Analysis.py +++ b/pyaedt/application/Analysis.py @@ -523,9 +523,7 @@ def get_excitations_name(self): >>> oModule.GetExcitations """ - warnings.warn( - "`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning - ) + warnings.warn("`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning) return self.excitations @aedt_exception_handler @@ -568,7 +566,7 @@ def get_traces_for_plot( if not second_element_filter: second_element_filter = "*" list_output = [] - end_str = ")" * (category.count('(') + 1) + end_str = ")" * (category.count("(") + 1) if get_self_terms: for el in self.excitations: value = "{}({},{}{}".format(category, el, el, end_str) diff --git a/pyaedt/application/Analysis3DLayout.py b/pyaedt/application/Analysis3DLayout.py index 7bb107e7c57..b03a6f41301 100644 --- a/pyaedt/application/Analysis3DLayout.py +++ b/pyaedt/application/Analysis3DLayout.py @@ -171,9 +171,7 @@ def get_excitations_name(self): >>> oModule.GetAllPortsList """ - warnings.warn( - "`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning - ) + warnings.warn("`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning) return self.excitations @property diff --git a/pyaedt/application/AnalysisNexxim.py b/pyaedt/application/AnalysisNexxim.py index db482cdc03a..0a4f86a29bf 100644 --- a/pyaedt/application/AnalysisNexxim.py +++ b/pyaedt/application/AnalysisNexxim.py @@ -114,6 +114,7 @@ def excitations(self): """ ports = [p.replace("IPort@", "").split(";")[0] for p in self.modeler.oeditor.GetAllPorts()] return ports + @property def get_excitations_name(self): """Excitation names. @@ -131,9 +132,7 @@ def get_excitations_name(self): >>> oEditor.GetAllPorts """ - warnings.warn( - "`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning - ) + warnings.warn("`get_excitations_name` is deprecated. Use `excitations` property instead.", DeprecationWarning) return self.excitations @property From e4ebc74f03e64b323d3e34a74249cfb1d90e994d Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 14:53:16 +0100 Subject: [PATCH 3/8] fixed flake8 --- pyaedt/modules/Boundary.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyaedt/modules/Boundary.py b/pyaedt/modules/Boundary.py index 31e0c6bf650..aee067df21f 100644 --- a/pyaedt/modules/Boundary.py +++ b/pyaedt/modules/Boundary.py @@ -2,7 +2,6 @@ This module contains these classes: `BoundaryCommon` and `BoundaryObject`. """ from collections import OrderedDict -import re from pyaedt.generic.general_methods import aedt_exception_handler, generate_unique_name, filter_tuple from pyaedt.generic.DataHandlers import _dict2arg From f0508db548ef250f3ab69f4b2fe3f2ae98a95a89 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 15:44:01 +0100 Subject: [PATCH 4/8] added additional UT --- _unittest/test_21_Circuit.py | 1 + _unittest/test_31_Q3D.py | 1 + _unittest/test_41_3dlayout_modeler.py | 1 + 3 files changed, 3 insertions(+) diff --git a/_unittest/test_21_Circuit.py b/_unittest/test_21_Circuit.py index cef599ad98f..738842a7c06 100644 --- a/_unittest/test_21_Circuit.py +++ b/_unittest/test_21_Circuit.py @@ -147,6 +147,7 @@ def test_12_connect_components(self): myres = self.aedtapp.modeler.schematic.create_resistor("R100", 50) mycap = self.aedtapp.modeler.schematic.create_capacitor("C100", 1e-12) portname = self.aedtapp.modeler.schematic.create_interface_port("Port1") + assert len(self.aedtapp.excitations) > 0 assert "Port1" in portname.name assert myind.pins[0].connect_to_component(portname.pins[0]) assert myind.pins[1].connect_to_component(myres.pins[1]) diff --git a/_unittest/test_31_Q3D.py b/_unittest/test_31_Q3D.py index 9c72ce104cc..2e4ec2d6b07 100644 --- a/_unittest/test_31_Q3D.py +++ b/_unittest/test_31_Q3D.py @@ -72,6 +72,7 @@ def test_07_create_source_sinks(self): sink = self.aedtapp.assign_sink_to_objectface("MyCylinder", axisdir=3, sink_name="Sink1") assert source.name == "Source1" assert sink.name == "Sink1" + assert len(self.aedtapp.excitations) > 0 def test_07B_create_source_tosheet(self): self.aedtapp.modeler.create_circle(self.aedtapp.PLANE.XY, [0, 0, 0], 4, name="Source1") diff --git a/_unittest/test_41_3dlayout_modeler.py b/_unittest/test_41_3dlayout_modeler.py index 25a317bf249..15d52ef881f 100644 --- a/_unittest/test_41_3dlayout_modeler.py +++ b/_unittest/test_41_3dlayout_modeler.py @@ -184,6 +184,7 @@ def test_12_create_line(self): def test_13a_create_edge_port(self): assert self.aedtapp.create_edge_port("line1", 3, False) assert self.aedtapp.create_edge_port("line1", 0, True) + assert len(self.aedtapp.excitations) > 0 def test_14a_create_coaxial_port(self): assert self.aedtapp.create_coax_port("Via123", "Bottom", "Top", 10, 10, 10, 10) From f902220497942379dbbe93a227ff594e63e76023 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 16:05:54 +0100 Subject: [PATCH 5/8] fixed method in q3d --- pyaedt/q3d.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaedt/q3d.py b/pyaedt/q3d.py index 5458542435e..c21a5c953f1 100644 --- a/pyaedt/q3d.py +++ b/pyaedt/q3d.py @@ -91,7 +91,7 @@ def excitations(self): excitation for each mode. """ - return self.matrices[0].sources + return self.matrices[0].sources(False) @aedt_exception_handler def insert_reduced_matrix(self, operation_name, source_names=None, rm_name=None): From f66814cbb6b336e97706b0be77b90c42a32b1fe7 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 16:33:28 +0100 Subject: [PATCH 6/8] fixed method in q3d --- _unittest/test_20_HFSS.py | 2 +- pyaedt/hfss.py | 69 ++++++++++++++------------------------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/_unittest/test_20_HFSS.py b/_unittest/test_20_HFSS.py index 6826ee54c35..33a22b0ea08 100644 --- a/_unittest/test_20_HFSS.py +++ b/_unittest/test_20_HFSS.py @@ -468,7 +468,7 @@ def test_18_create_sources_on_objects(self): ) assert port.name in self.aedtapp.excitations port = self.aedtapp.create_current_source_from_objects( - "BoxVolt1", "BoxVolt2", self.aedtapp.AxisDir.XPos, "Curr1" + "BoxVolt1", "BoxVolt2", self.aedtapp.AxisDir.XPos ) assert port.name in self.aedtapp.excitations diff --git a/pyaedt/hfss.py b/pyaedt/hfss.py index 6edb4e7e875..c4e894bb916 100644 --- a/pyaedt/hfss.py +++ b/pyaedt/hfss.py @@ -226,6 +226,14 @@ def set_auto_open(self, enable=True, boundary_type="Radiation"): raise AttributeError("Wrong boundary type. Check Documentation for valid inputs") return self.design_solutions.set_auto_open(enable=enable, boundary_type=boundary_type) + @aedt_exception_handler + def _get_unique_source_name(self, source_name, root_name): + if not source_name: + source_name = generate_unique_name(root_name) + elif source_name in self.excitations or source_name + ":1" in self.excitations: + source_name = generate_unique_name(source_name) + return source_name + @aedt_exception_handler def _get_rad_fields(self): if not self.design_properties: @@ -1511,10 +1519,8 @@ def create_circuit_port_between_objects( if self.solution_type in ["Modal", "Terminal", "Transient Network"]: out, parallel = self.modeler.find_closest_edges(startobj, endobject, axisdir) port_edges = [] - if not portname: - portname = generate_unique_name("Port") - elif portname + ":1" in self.excitations: - portname = generate_unique_name(portname) + portname = self._get_unique_source_name(portname, "Port") + return self._create_circuit_port(out, impedance, portname, renorm, deemb, renorm_impedance=renorm_impedance) return False @@ -1584,10 +1590,8 @@ def create_lumped_port_between_objects( startobj, endobject, axisdir, port_on_plane ) - if not portname: - portname = generate_unique_name("Port") - elif portname + ":1" in self.excitations: - portname = generate_unique_name(portname) + portname = self._get_unique_source_name(portname, "Port") + if "Modal" in self.solution_type: return self._create_lumped_driven(sheet_name, point0, point1, impedance, portname, renorm, deemb) else: @@ -1852,10 +1856,7 @@ def create_voltage_source_from_objects(self, startobj, endobject, axisdir=0, sou sheet_name, point0, point1 = self.modeler._create_sheet_from_object_closest_edge( startobj, endobject, axisdir, source_on_plane ) - if not sourcename: - sourcename = generate_unique_name("Voltage") - elif sourcename + ":1" in self.excitations: - sourcename = generate_unique_name(sourcename) + sourcename = self._get_unique_source_name(sourcename, "Voltage") return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Voltage") return False @@ -1912,10 +1913,7 @@ def create_current_source_from_objects(self, startobj, endobject, axisdir=0, sou sheet_name, point0, point1 = self.modeler._create_sheet_from_object_closest_edge( startobj, endobject, axisdir, source_on_plane ) - if not sourcename: - sourcename = generate_unique_name("Current") - elif sourcename + ":1" in self.excitations: - sourcename = generate_unique_name(sourcename) + sourcename = self._get_unique_source_name(sourcename, "Current") return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Current") return False @@ -2031,10 +2029,8 @@ def create_wave_port_between_objects( if add_pec_cap: dist = GeometryOperators.points_distance(point0, point1) self._create_pec_cap(sheet_name, startobj, dist / 10) - if not portname: - portname = generate_unique_name("Port") - elif portname + ":1" in self.excitations: - portname = generate_unique_name(portname) + portname = self._get_unique_source_name(portname, "Port") + if "Modal" in self.solution_type: return self._create_waveport_driven( sheet_name, point0, point1, impedance, portname, renorm, nummodes, deembed_dist @@ -2458,10 +2454,8 @@ def create_wave_port_microstrip_between_objects( ) dist = GeometryOperators.points_distance(point0, point1) self._create_pec_cap(sheet_name, startobj, dist / 10) - if not portname: - portname = generate_unique_name("Port") - elif portname + ":1" in self.excitations: - portname = generate_unique_name(portname) + portname = self._get_unique_source_name(portname, "Port") + if "Modal" in self.solution_type: return self._create_waveport_driven( sheet_name, point0, point1, impedance, portname, renorm, nummodes, deembed_dist @@ -3029,10 +3023,8 @@ def create_wave_port_from_sheet( refid, int_start, int_stop = self._get_reference_and_integration_points(sheet, axisdir, oname) - if not portname: - portname = generate_unique_name("Port") - elif portname + ":1" in self.excitations: - portname = generate_unique_name(portname) + portname = self._get_unique_source_name(portname, "Port") + return self._create_waveport_driven( sheet, int_start, int_stop, impedance, portname, renorm, nummodes, deemb ) @@ -3106,10 +3098,8 @@ def create_lumped_port_to_sheet( if self.solution_type in ["Modal", "Terminal", "Transient Network"]: point0, point1 = self.modeler.get_mid_points_on_dir(sheet_name, axisdir) - if not portname: - portname = generate_unique_name("Port") - elif portname + ":1" in self.excitations: - portname = generate_unique_name(portname) + portname = self._get_unique_source_name(portname, "Port") + port = False if "Modal" in self.solution_type: port = self._create_lumped_driven(sheet_name, point0, point1, impedance, portname, renorm, deemb) @@ -3189,10 +3179,7 @@ def assign_voltage_source_to_sheet(self, sheet_name, axisdir=0, sourcename=None) if self.solution_type in ["Modal", "Terminal", "Transient Network"]: point0, point1 = self.modeler.get_mid_points_on_dir(sheet_name, axisdir) - if not sourcename: - sourcename = generate_unique_name("Voltage") - elif sourcename + ":1" in self.excitations: - sourcename = generate_unique_name(sourcename) + sourcename = self._get_unique_source_name(sourcename, "Voltage") return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Voltage") return False @@ -3235,10 +3222,7 @@ def assign_current_source_to_sheet(self, sheet_name, axisdir=0, sourcename=None) if self.solution_type in ["Modal", "Terminal", "Transient Network"]: point0, point1 = self.modeler.get_mid_points_on_dir(sheet_name, axisdir) - if not sourcename: - sourcename = generate_unique_name("Current") - elif sourcename + ":1" in self.excitations: - sourcename = generate_unique_name(sourcename) + sourcename = self._get_unique_source_name(sourcename, "Current") return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Current") return False @@ -3538,10 +3522,7 @@ def create_circuit_port_from_edges( """ edge_list = [edge_signal, edge_gnd] - if not port_name: - port_name = generate_unique_name("Port") - elif port_name + ":1" in self.excitations: - port_name = generate_unique_name(port_name) + port_name = self._get_unique_source_name(port_name, "Port") return self._create_circuit_port( edge_list, port_impedance, port_name, renormalize, deembed, renorm_impedance=renorm_impedance From 00c0cc7e4fb6ceadf32bda76b1519e0d35755780 Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 17:23:51 +0100 Subject: [PATCH 7/8] add coverage comments --- _unittest/test_12_PostProcessing.py | 13 +++++-------- pyaedt/hfss.py | 10 +++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index 6b1ba1982af..7cf48b0e909 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -30,14 +30,11 @@ class TestClass: def setup_class(self): # set a scratch directory and the environment / test data with Scratch(scratch_path) as self.local_scratch: - try: - example_project = os.path.join(local_path, "example_models", test_project_name + ".aedtz") - self.test_project = self.local_scratch.copyfile(example_project) - example_project2 = os.path.join(local_path, "example_models", test_field_name + ".aedtz") - self.test_project2 = self.local_scratch.copyfile(example_project2) - self.aedtapp = Hfss(self.test_project) - except: - pass + example_project = os.path.join(local_path, "example_models", test_project_name + ".aedtz") + self.test_project = self.local_scratch.copyfile(example_project) + example_project2 = os.path.join(local_path, "example_models", test_field_name + ".aedtz") + self.test_project2 = self.local_scratch.copyfile(example_project2) + self.aedtapp = Hfss(self.test_project) def teardown_class(self): self.aedtapp._desktop.ClearMessages("", "", 3) diff --git a/pyaedt/hfss.py b/pyaedt/hfss.py index c4e894bb916..d3680b3ad56 100644 --- a/pyaedt/hfss.py +++ b/pyaedt/hfss.py @@ -1522,7 +1522,7 @@ def create_circuit_port_between_objects( portname = self._get_unique_source_name(portname, "Port") return self._create_circuit_port(out, impedance, portname, renorm, deemb, renorm_impedance=renorm_impedance) - return False + return False # pragma: no cover @aedt_exception_handler def create_lumped_port_between_objects( @@ -1597,7 +1597,7 @@ def create_lumped_port_between_objects( else: faces = self.modeler.get_object_faces(sheet_name) return self._create_port_terminal(faces[0], endobject, portname, renorm=renorm, iswaveport=False) - return False + return False # pragma: no cover @aedt_exception_handler def create_spiral_lumped_port(self, start_object, end_object, port_width=None): @@ -1858,7 +1858,7 @@ def create_voltage_source_from_objects(self, startobj, endobject, axisdir=0, sou ) sourcename = self._get_unique_source_name(sourcename, "Voltage") return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Voltage") - return False + return False # pragma: no cover @aedt_exception_handler def create_current_source_from_objects(self, startobj, endobject, axisdir=0, sourcename=None, source_on_plane=True): @@ -1915,7 +1915,7 @@ def create_current_source_from_objects(self, startobj, endobject, axisdir=0, sou ) sourcename = self._get_unique_source_name(sourcename, "Current") return self.create_source_excitation(sheet_name, point0, point1, sourcename, sourcetype="Current") - return False + return False # pragma: no cover @aedt_exception_handler def create_source_excitation(self, sheet_name, point1, point2, sourcename, sourcetype="Voltage"): @@ -2038,7 +2038,7 @@ def create_wave_port_between_objects( else: faces = self.modeler.get_object_faces(sheet_name) return self._create_port_terminal(faces[0], endobject, portname, renorm=renorm, iswaveport=True) - return False + return False # pragma: no cover @aedt_exception_handler def create_floquet_port( From 2d127641f75893c5d9b0b1eebbe68622ff8bccbb Mon Sep 17 00:00:00 2001 From: Massimo Capodiferro Date: Wed, 9 Feb 2022 17:26:57 +0100 Subject: [PATCH 8/8] black fix --- _unittest/test_20_HFSS.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/_unittest/test_20_HFSS.py b/_unittest/test_20_HFSS.py index 33a22b0ea08..2b5411413d3 100644 --- a/_unittest/test_20_HFSS.py +++ b/_unittest/test_20_HFSS.py @@ -467,9 +467,7 @@ def test_18_create_sources_on_objects(self): box1.name, "BoxVolt2", self.aedtapp.AxisDir.XNeg, "Volt1" ) assert port.name in self.aedtapp.excitations - port = self.aedtapp.create_current_source_from_objects( - "BoxVolt1", "BoxVolt2", self.aedtapp.AxisDir.XPos - ) + port = self.aedtapp.create_current_source_from_objects("BoxVolt1", "BoxVolt2", self.aedtapp.AxisDir.XPos) assert port.name in self.aedtapp.excitations def test_19_create_lumped_on_sheet(self):