diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index fe62f2c793c..71084e4dafd 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -387,10 +387,7 @@ def test_18_diff_plot(self, diff_test): assert data1.plot(formula="phaserad", snapshot_path=os.path.join(self.local_scratch.path, "temp9.jpg")) assert diff_test.create_touchstone_report( - plot_name="Diff_plot", - curvenames=["dB(S(Diff1, Diff1))"], - solution_name="LinearFrequency", - differential_pairs=True, + name="Diff_plot", curves=["dB(S(Diff1, Diff1))"], solution="LinearFrequency", differential_pairs=True ) @pytest.mark.skipif(is_linux, reason="Failing on Linux") diff --git a/_unittest/test_21_Circuit.py b/_unittest/test_21_Circuit.py index a9620f5139d..97fffdd4f28 100644 --- a/_unittest/test_21_Circuit.py +++ b/_unittest/test_21_Circuit.py @@ -349,14 +349,14 @@ def test_26_component_catalog(self): def test_27_set_differential_pairs(self): assert self.circuitprj.set_differential_pair( - positive_terminal="Port3", - negative_terminal="Port4", - common_name=None, - diff_name=None, - common_ref_z=34, - diff_ref_z=123, + assignment="Port3", + reference="Port4", + common_mode=None, + differential_mode=None, + common_reference=34, + differential_reference=123, ) - assert self.circuitprj.set_differential_pair(positive_terminal="Port3", negative_terminal="Port5") + assert self.circuitprj.set_differential_pair(assignment="Port3", reference="Port5") def test_28_load_and_save_diff_pair_file(self): diff_def_file = os.path.join(local_path, "example_models", test_subfolder, "differential_pairs_definition.txt") @@ -839,7 +839,7 @@ def test_47_automatic_lna(self): touchstone_file = os.path.join(local_path, "example_models", test_subfolder, touchstone_custom) status, diff_pairs, comm_pairs = self.aedtapp.create_lna_schematic_from_snp( - touchstone=touchstone_file, + input_file=touchstone_file, start_frequency=0, stop_frequency=70, auto_assign_diff_pairs=True, @@ -853,15 +853,15 @@ def test_48_automatic_tdr(self): touchstone_file = os.path.join(local_path, "example_models", test_subfolder, touchstone_custom) result, tdr_probe_name = self.aedtapp.create_tdr_schematic_from_snp( - touchstone=touchstone_file, + input_file=touchstone_file, probe_pins=["A-MII-RXD1_30.SQFP28X28_208.P"], probe_ref_pins=["A-MII-RXD1_65.SQFP20X20_144.N"], termination_pins=["A-MII-RXD2_32.SQFP28X28_208.P", "A-MII-RXD2_66.SQFP20X20_144.N"], differential=True, - design_name="TDR", rise_time=35, use_convolution=True, analyze=False, + design_name="TDR", ) assert result @@ -869,17 +869,17 @@ def test_49_automatic_ami(self): touchstone_file = os.path.join(local_path, "example_models", test_subfolder, touchstone_custom) ami_file = os.path.join(local_path, "example_models", test_subfolder, "pcieg5_32gt.ibs") result, eye_curve_tx, eye_curve_rx = self.aedtapp.create_ami_schematic_from_snp( - touchstone=touchstone_file, + input_file=touchstone_file, ibis_ami=ami_file, component_name="Spec_Model", tx_buffer_name="1p", rx_buffer_name="2p", - use_ibis_buffer=False, - differential=True, tx_pins=["A-MII-RXD1_30.SQFP28X28_208.P"], tx_refs=["A-MII-RXD1_65.SQFP20X20_144.N"], rx_pins=["A-MII-RXD2_32.SQFP28X28_208.P"], rx_refs=["A-MII-RXD2_66.SQFP20X20_144.N"], + use_ibis_buffer=False, + differential=True, bit_pattern="random_bit_count=2.5e3 random_seed=1", unit_interval="31.25ps", use_convolution=True, diff --git a/_unittest_solvers/test_00_analyze.py b/_unittest_solvers/test_00_analyze.py index 4a04533c5f3..38e7d771282 100644 --- a/_unittest_solvers/test_00_analyze.py +++ b/_unittest_solvers/test_00_analyze.py @@ -392,13 +392,13 @@ def test_05c_circuit_push_excitation(self, circuit_app): setup_name = "test_07a_LNA" setup = circuit_app.create_setup(setup_name) setup.add_sweep_step(start_point=0, end_point=5, step_size=0.01) - assert circuit_app.push_excitations(instance_name="U1", setup_name=setup_name, thevenin_calculation=False) - assert circuit_app.push_excitations(instance_name="U1", setup_name=setup_name, thevenin_calculation=True) + assert circuit_app.push_excitations(instance="U1", thevenin_calculation=False, setup=setup_name) + assert circuit_app.push_excitations(instance="U1", thevenin_calculation=True, setup=setup_name) def test_05d_circuit_push_excitation_time(self, circuit_app): setup_name = "test_07b_Transient" setup = circuit_app.create_setup(setup_name, setup_type="NexximTransient") - assert circuit_app.push_time_excitations(instance_name="U1", setup_name=setup_name) + assert circuit_app.push_time_excitations(instance="U1", setup=setup_name) def test_06_m3d_harmonic_forces(self, m3dtransient): assert m3dtransient.enable_harmonic_force(["Stator"], force_type=2, window_function="Rectangular", diff --git a/examples/06-Multiphysics/Hfss_Mechanical.py b/examples/06-Multiphysics/Hfss_Mechanical.py index e5105a8dd99..973c1abc423 100644 --- a/examples/06-Multiphysics/Hfss_Mechanical.py +++ b/examples/06-Multiphysics/Hfss_Mechanical.py @@ -111,7 +111,7 @@ # correct value of losses. circuit.analyze() -circuit.push_excitations(instance_name="S1", setup_name=setup_name) +circuit.push_excitations(instance="S1", setup=setup_name) ############################################################################### diff --git a/examples/07-Circuit/Circuit_Siwave_Multizones.py b/examples/07-Circuit/Circuit_Siwave_Multizones.py index ec0a7645a44..28a61516a3b 100644 --- a/examples/07-Circuit/Circuit_Siwave_Multizones.py +++ b/examples/07-Circuit/Circuit_Siwave_Multizones.py @@ -94,10 +94,8 @@ ############################################################################### # Define differential pairs # ~~~~~~~~~~~~~~~~~~~~~~~~~ -circuit.set_differential_pair(diff_name="U0", positive_terminal="U0.via_38.B2B_SIGP", - negative_terminal="U0.via_39.B2B_SIGN") -circuit.set_differential_pair(diff_name="U1", positive_terminal="U1.via_32.B2B_SIGP", - negative_terminal="U1.via_33.B2B_SIGN") +circuit.set_differential_pair(assignment="U0.via_38.B2B_SIGP", reference="U0.via_39.B2B_SIGN", differential_mode="U0") +circuit.set_differential_pair(assignment="U1.via_32.B2B_SIGP", reference="U1.via_33.B2B_SIGN", differential_mode="U1") ############################################################################### # Plot results diff --git a/examples/07-Circuit/Virtual_Compliance.py b/examples/07-Circuit/Virtual_Compliance.py index f0317eb8315..2b654be5c98 100644 --- a/examples/07-Circuit/Virtual_Compliance.py +++ b/examples/07-Circuit/Virtual_Compliance.py @@ -72,14 +72,10 @@ # and generate frequency domain reports. cir = pyaedt.Circuit(projectname=h3d.project_name, designname="Touchstone") -status, diff_pairs, comm_pairs = cir.create_lna_schematic_from_snp(touchstone=touchstone_path, - start_frequency=0, - stop_frequency=70, - auto_assign_diff_pairs=True, - separation=".", - pattern=["component", "pin", "net"], - analyze=True - ) +status, diff_pairs, comm_pairs = cir.create_lna_schematic_from_snp(input_file=touchstone_path, start_frequency=0, + stop_frequency=70, auto_assign_diff_pairs=True, + separation=".", pattern=["component", "pin", "net"], + analyze=True) insertion = cir.get_all_insertion_loss_list(trlist=diff_pairs, reclist=diff_pairs, @@ -104,40 +100,32 @@ # the TDR measurement on a differential pair. # The original circuit schematic is duplicated and modified to achieve this target. -result, tdr_probe_name = cir.create_tdr_schematic_from_snp(touchstone=touchstone_path, - probe_pins=["X1.A2.PCIe_Gen4_RX0_P"], - probe_ref_pins=["X1.A3.PCIe_Gen4_RX0_N"], - termination_pins=["U1.AP26.PCIe_Gen4_RX0_P", - "U1.AN26.PCIe_Gen4_RX0_N"], - differential=True, - design_name="TDR", - rise_time=35, - use_convolution=True, - analyze=True, - ) +result, tdr_probe_name = cir.create_tdr_schematic_from_snp(input_file=touchstone_path, + probe_pins=["X1.A2.PCIe_Gen4_RX0_P"], + probe_ref_pins=["X1.A3.PCIe_Gen4_RX0_N"], + termination_pins=["U1.AP26.PCIe_Gen4_RX0_P", + "U1.AN26.PCIe_Gen4_RX0_N"], + differential=True, rise_time=35, use_convolution=True, + analyze=True, design_name="TDR") ############################################################################### # Create AMI project # ~~~~~~~~~~~~~~~~~~ # Create an Ibis AMI project to compute an eye diagram simulation and retrieve # eye mask violations. -result, eye_curve_tx, eye_curve_rx = cir.create_ami_schematic_from_snp(touchstone=touchstone_path, - ibis_ami=os.path.join(projectdir, "models", "pcieg5_32gt.ibs"), - component_name="Spec_Model", - tx_buffer_name="1p", - rx_buffer_name="2p", - use_ibis_buffer=False, - differential=True, - tx_pins=["U1.AM25.PCIe_Gen4_TX0_CAP_P"], - tx_refs=["U1.AL25.PCIe_Gen4_TX0_CAP_N"], - rx_pins=["X1.B2.PCIe_Gen4_TX0_P"], - rx_refs=["X1.B3.PCIe_Gen4_TX0_N"], - bit_pattern="random_bit_count=2.5e3 random_seed=1", - unit_interval="31.25ps", - use_convolution=True, - analyze=True, - design_name="AMI", - ) +result, eye_curve_tx, eye_curve_rx = cir.create_ami_schematic_from_snp(input_file=touchstone_path, + ibis_ami=os.path.join(projectdir, "models", + "pcieg5_32gt.ibs"), + component_name="Spec_Model", tx_buffer_name="1p", + rx_buffer_name="2p", + tx_pins=["U1.AM25.PCIe_Gen4_TX0_CAP_P"], + tx_refs=["U1.AL25.PCIe_Gen4_TX0_CAP_N"], + rx_pins=["X1.B2.PCIe_Gen4_TX0_P"], + rx_refs=["X1.B3.PCIe_Gen4_TX0_N"], + use_ibis_buffer=False, differential=True, + bit_pattern="random_bit_count=2.5e3 random_seed=1", + unit_interval="31.25ps", use_convolution=True, + analyze=True, design_name="AMI") cir.save_project() diff --git a/pyaedt/circuit.py b/pyaedt/circuit.py index f35a8c12e5d..8598f9152c3 100644 --- a/pyaedt/circuit.py +++ b/pyaedt/circuit.py @@ -165,8 +165,8 @@ def _get_number_from_string(self, stringval): except Exception: return from_rkm_to_aedt(value) - @pyaedt_function_handler() - def create_schematic_from_netlist(self, file_to_import): + @pyaedt_function_handler(file_to_import="input_file") + def create_schematic_from_netlist(self, input_file): """Create a circuit schematic from an HSpice netlist. Supported currently are: @@ -180,7 +180,7 @@ def create_schematic_from_netlist(self, file_to_import): Parameters ---------- - file_to_import : str + input_file : str Full path to the HSpice file to import. Returns @@ -201,7 +201,7 @@ def create_schematic_from_netlist(self, file_to_import): if self._desktop.GetAutoSaveEnabled() == 1: self._desktop.EnableAutoSave(False) autosave = True - with open_file(file_to_import, "rb") as f: + with open_file(input_file, "rb") as f: for line in f: line = line.decode("utf-8") if ".param" in line[:7].lower(): @@ -230,7 +230,7 @@ def create_schematic_from_netlist(self, file_to_import): self.modeler.schematic.disable_data_netlist(component_name="Models_Netlist") xpos += 0.0254 counter = 0 - with open_file(file_to_import, "rb") as f: + with open_file(input_file, "rb") as f: for line in f: line = line.decode("utf-8") mycomp = None @@ -422,16 +422,17 @@ def create_schematic_from_netlist(self, file_to_import): self.logger.info("Netlist was correctly imported into %s", self.design_name) return True - @pyaedt_function_handler() - def get_ibis_model_from_file(self, path, is_ami=False): + @pyaedt_function_handler(path="input_file") + def get_ibis_model_from_file(self, input_file, is_ami=False): """Create an IBIS model based on the data contained in an IBIS file. Parameters ---------- - path : str + input_file : str Path of the IBIS file. is_ami : bool, optional - Whether if import an IBIS or an IBIS AMI. + Whether the file to import is an IBIS AMI file. The + default is ``False``, in which case it is an IBIS file. Returns ------- @@ -439,14 +440,14 @@ def get_ibis_model_from_file(self, path, is_ami=False): IBIS object exposing all data from the IBIS file. """ if is_ami: - reader = ibis_reader.AMIReader(path, self) + reader = ibis_reader.AMIReader(input_file, self) else: - reader = ibis_reader.IbisReader(path, self) + reader = ibis_reader.IbisReader(input_file, self) reader.parse_ibis_file() return reader.ibis_model - @pyaedt_function_handler() - def create_schematic_from_mentor_netlist(self, file_to_import): + @pyaedt_function_handler(file_to_import="input_file") + def create_schematic_from_mentor_netlist(self, input_file): """Create a circuit schematic from a Mentor netlist. Supported currently are: @@ -460,7 +461,7 @@ def create_schematic_from_mentor_netlist(self, file_to_import): Parameters ---------- - file_to_import : str + input_file : str Full path to the HSpice file to import. Returns @@ -476,7 +477,7 @@ def create_schematic_from_mentor_netlist(self, file_to_import): delta = 0.0508 use_instance = True my_netlist = [] - with open_file(file_to_import, "r") as f: + with open_file(input_file, "r") as f: for line in f: my_netlist.append(line.split(" ")) nets = [i for i in my_netlist if i[0] == "NET"] @@ -586,13 +587,13 @@ def create_schematic_from_mentor_netlist(self, file_to_import): self.modeler.schematic_units = units return True - @pyaedt_function_handler() - def retrieve_mentor_comp(self, refid): + @pyaedt_function_handler(refid="reference_id") + def retrieve_mentor_comp(self, reference_id): """Retrieve the type of the Mentor netlist component for a given reference ID. Parameters ---------- - refid : int + reference_id : list Reference ID. Returns @@ -601,15 +602,15 @@ def retrieve_mentor_comp(self, refid): Type of the Mentor netlist component. """ - if refid[1] == "R": + if reference_id[1] == "R": return "resistor:RES." - elif refid[1] == "C": + elif reference_id[1] == "C": return "capacitor:CAP." - elif refid[1] == "L": + elif reference_id[1] == "L": return "inductor:COIL." - elif refid[1] == "D": + elif reference_id[1] == "D": return "diode" - elif refid[1] == "Q": + elif reference_id[1] == "Q": return "transistor:NPN" else: return "" @@ -670,15 +671,15 @@ def get_source_pin_names( self.logger.info("%s Excitations Pins found.", len(pins)) return pins - @pyaedt_function_handler() - def import_touchstone_solution(self, filename, solution_name="Imported_Data"): + @pyaedt_function_handler(filename="input_file", solution_name="solution") + def import_touchstone_solution(self, input_file, solution="Imported_Data"): """Import a Touchstone file as the solution. Parameters ---------- - filename : str + input_file : str Name of the Touchstone file. - solution_name : str, optional + solution : str, optional Name of the solution. The default is ``"Imported_Data"``. Returns @@ -691,8 +692,8 @@ def import_touchstone_solution(self, filename, solution_name="Imported_Data"): >>> oDesign.ImportData """ - if filename[-2:] == "ts": - with open_file(filename, "r") as f: + if input_file[-2:] == "ts": + with open_file(input_file, "r") as f: lines = f.readlines() for i in lines: if "[Number of Ports]" in i: @@ -702,10 +703,10 @@ def import_touchstone_solution(self, filename, solution_name="Imported_Data"): portnames = ["Port{}".format(i + 1) for i in range(ports)] else: re_filename = re.compile(r"\.s(?P\d+)+p", re.I) - m = re_filename.search(filename) + m = re_filename.search(input_file) ports = int(m.group("ports")) portnames = None - with open_file(filename, "r") as f: + with open_file(input_file, "r") as f: lines = f.readlines() portnames = [i.split(" = ")[1].strip() for i in lines if "Port[" in i] if not portnames: @@ -721,7 +722,7 @@ def import_touchstone_solution(self, filename, solution_name="Imported_Data"): ["NAME:PortInfoBlk"], ["NAME:PortOrderBlk"], "filename:=", - filename, + input_file, "numberofports:=", ports, "sssfilename:=", @@ -737,7 +738,7 @@ def import_touchstone_solution(self, filename, solution_name="Imported_Data"): "devicename:=", "", "SolutionName:=", - solution_name, + solution, "displayformat:=", "MagnitudePhase", "datatype:=", @@ -934,13 +935,15 @@ def export_fullwave_spice( return filename - @pyaedt_function_handler() + @pyaedt_function_handler( + plot_name="name", curvenames="curves", solution_name="solution", variation_dict="variations" + ) def create_touchstone_report( self, - plot_name, - curvenames, - solution_name=None, - variation_dict=None, + name, + curves, + solution=None, + variations=None, differential_pairs=False, subdesign_id=None, ): @@ -949,16 +952,16 @@ def create_touchstone_report( Parameters ---------- - plot_name : str + name : str Name of the plot. - curvenames : list + curves : list List of names for the curves to plot. - solution_name : str, optional - Name of the solution. The default value is ``None``. - variation_dict : dict, optional - Dictionary of variation names. The default value is ``None``. + solution : str, optional + Name of the solution. The default is ``None``. + variations : dict, optional + Dictionary of variation names. The default is ``None``. differential_pairs : bool, optional - Specify if the plot is on differential pairs traces. The default value is ``False``. + Whether the plot is on differential pairs traces. The default is ``False``. subdesign_id : int, optional Specify a subdesign ID to export a Touchstone file of this subdesign. The default value is ``None``. Returns @@ -971,30 +974,30 @@ def create_touchstone_report( >>> oModule.CreateReport """ - if not solution_name: - solution_name = self.nominal_sweep - variations = {"Freq": ["All"]} - if variation_dict: - for el in variation_dict: - variations[el] = [variation_dict[el]] + if not solution: + solution = self.nominal_sweep + variations_dict = {"Freq": ["All"]} + if variations: + for el in variations: + variations_dict[el] = [variations[el]] dif = None if differential_pairs: dif = "Differential Pairs" return self.post.create_report( - curvenames, solution_name, variations=variations, context=dif, subdesign_id=subdesign_id + curves, solution, variations=variations_dict, context=dif, subdesign_id=subdesign_id, plot_name=name ) - @pyaedt_function_handler() - def push_excitations(self, instance_name, thevenin_calculation=False, setup_name="LinearFrequency"): + @pyaedt_function_handler(instance_name="instance", setup_name="setup") + def push_excitations(self, instance, thevenin_calculation=False, setup="LinearFrequency"): """Push excitations for a linear frequency setup. Parameters ---------- - instance_name : str + instance : str Name of the instance. thevenin_calculation : bool, optional Whether to perform the Thevenin equivalent calculation. The default is ``False``. - setup_name : str, optional + setup : str, optional Name of the solution setup to push. The default is ``"LinearFrequency"``. Returns @@ -1007,15 +1010,15 @@ def push_excitations(self, instance_name, thevenin_calculation=False, setup_name >>> oEditor.PushExcitations """ - arg = ["NAME:options", "CalcThevenin:=", thevenin_calculation, "Sol:=", setup_name] + arg = ["NAME:options", "CalcThevenin:=", thevenin_calculation, "Sol:=", setup] - self.modeler.oeditor.PushExcitations(instance_name, arg) + self.modeler.oeditor.PushExcitations(instance, arg) return True - @pyaedt_function_handler() + @pyaedt_function_handler(instance_name="instance", setup_name="setup") def push_time_excitations( self, - instance_name, + instance, start=0.0, stop=0.0, harmonics=100, @@ -1023,13 +1026,13 @@ def push_time_excitations( width_percentage=100.0, kaiser=0.0, correct_coherent_gain=True, - setup_name="NexximTransient", + setup="NexximTransient", ): """Push excitations for a transient setup. Parameters ---------- - instance_name : str + instance : str Name of the instance. start : float, optional Start time in ``seconds``. The default is ``0.0``. @@ -1045,8 +1048,8 @@ def push_time_excitations( kaiser : float, optional Kaiser value. The default is ``0.0``. correct_coherent_gain : bool, optional - Enable coherent gain correction. The default is ``True``. - setup_name : str, optional + Whether to enable the coherent gain correction. The default is ``True``. + setup : str, optional Name of the solution setup to push. The default is ``"LinearFrequency"``. Returns @@ -1079,9 +1082,9 @@ def push_time_excitations( correct_coherent_gain, ], "Sol:=", - setup_name, + setup, ] - self.modeler.oeditor.PushExcitations(instance_name, arg) + self.modeler.oeditor.PushExcitations(instance, arg) return True @pyaedt_function_handler() @@ -1218,15 +1221,15 @@ def assign_power_sinusoidal_excitation_to_ports(self, ports): self.excitation_objects[port].update() return source_p - @pyaedt_function_handler() - def assign_voltage_frequency_dependent_excitation_to_ports(self, ports, filepath): - """Assign a frequency dependent excitation to circuit ports from a frequency dependent source (.fds format). + @pyaedt_function_handler(filepath="input_file") + def assign_voltage_frequency_dependent_excitation_to_ports(self, ports, input_file): + """Assign a frequency dependent excitation to circuit ports from a frequency dependent source (FDS format). Parameters ---------- ports : list List of circuit ports to assign to the frequency dependent excitation. - filepath : str + input_file : str Path to the frequency dependent file. Returns @@ -1239,7 +1242,7 @@ def assign_voltage_frequency_dependent_excitation_to_ports(self, ports, filepath >>> oDesign.UpdateSources """ - if not os.path.exists(filepath) or os.path.splitext(filepath)[1] != ".fds": + if not os.path.exists(input_file) or os.path.splitext(input_file)[1] != ".fds": self.logger.error("Introduced file is not correct. Check path and format.") return False @@ -1248,41 +1251,48 @@ def assign_voltage_frequency_dependent_excitation_to_ports(self, ports, filepath return False source_freq = self.create_source(source_type="VoltageFrequencyDependent") - source_freq.fds_filename = filepath + source_freq.fds_filename = input_file for port in ports: self.excitation_objects[port].enabled_sources.append(source_freq.name) self.excitation_objects[port].update() return source_freq - @pyaedt_function_handler() + @pyaedt_function_handler( + positive_terminal="assignment", + negative_terminal="reference", + common_name="common_mode", + diff_name="differential_mode", + common_ref="common_reference", + diff_ref_z="differential_reference", + ) def set_differential_pair( self, - positive_terminal, - negative_terminal, - common_name=None, - diff_name=None, - common_ref_z=25, - diff_ref_z=100, + assignment, + reference, + common_mode=None, + differential_mode=None, + common_reference=25, + differential_reference=100, active=True, ): """Add a differential pair definition. Parameters ---------- - positive_terminal : str + assignment : str Name of the terminal to use as the positive terminal. - negative_terminal : str + reference : str Name of the terminal to use as the negative terminal. - common_name : str, optional - Name for the common mode. Default is ``None`` in which case a unique name is chosen. - diff_name : str, optional - Name for the differential mode. Default is ``None`` in which case a unique name is chosen. - common_ref_z : float, optional - Reference impedance for the common mode. Units are Ohm. Default is ``25``. - diff_ref_z : float, optional + common_mode : str, optional + Name for the common mode. The default is ``None``, in which case a unique name is assigned. + differential_mode : str, optional + Name for the differential mode. The default is ``None``, in which case a unique name is assigned. + common_reference : float, optional + Reference impedance for the common mode. The units are Ohm. The default is ``25``. + differential_reference : float, optional Reference impedance for the differential mode. Units are Ohm. Default is ``100``. active : bool, optional - Set the differential pair as active. Default is ``True``. + Whether to set the differential pair as active. The default is ``True``. Returns ------- @@ -1293,28 +1303,28 @@ def set_differential_pair( ---------- >>> oDesign.SetDiffPairs """ - if not diff_name: - diff_name = generate_unique_name("Diff") - if not common_name: - common_name = generate_unique_name("Comm") + if not differential_mode: + differential_mode = generate_unique_name("Diff") + if not common_mode: + common_mode = generate_unique_name("Comm") arg1 = [ "Pos:=", - positive_terminal, + assignment, "Neg:=", - negative_terminal, + reference, "On:=", active, "matched:=", False, "Dif:=", - diff_name, + differential_mode, "DfZ:=", - [float(diff_ref_z), 0], + [float(differential_reference), 0], "Com:=", - common_name, + common_mode, "CmZ:=", - [float(common_ref_z), 0], + [float(common_reference), 0], ] arg = ["NAME:DiffPairs"] @@ -1364,16 +1374,16 @@ def set_differential_pair( return False return True - @pyaedt_function_handler() - def load_diff_pairs_from_file(self, filename): + @pyaedt_function_handler(filename="input_file") + def load_diff_pairs_from_file(self, input_file): """Load differtential pairs definition from a file. - You can use the ``save_diff_pairs_to_file`` method to obtain the file format. + You can use the ``save_diff_pairs_to_file()`` method to obtain the file format. New definitions are added only if they are compatible with the existing definitions in the project. Parameters ---------- - filename : str + input_file : str Full qualified name of the file containing the differential pairs definition. Returns @@ -1385,12 +1395,12 @@ def load_diff_pairs_from_file(self, filename): ---------- >>> oDesign.LoadDiffPairsFromFile """ - if not os.path.isfile(filename): # pragma: no cover - raise ValueError("{}: The specified file could not be found.".format(filename)) + if not os.path.isfile(input_file): # pragma: no cover + raise ValueError("{}: The specified file could not be found.".format(input_file)) try: - new_file = os.path.join(os.path.dirname(filename), generate_unique_name("temp") + ".txt") - with open_file(filename, "r") as file: + new_file = os.path.join(os.path.dirname(input_file), generate_unique_name("temp") + ".txt") + with open_file(input_file, "r") as file: filedata = file.read().splitlines() with io.open(new_file, "w", newline="\n") as fh: for line in filedata: @@ -1402,16 +1412,16 @@ def load_diff_pairs_from_file(self, filename): return False return True - @pyaedt_function_handler() - def save_diff_pairs_to_file(self, filename): - """Save differtential pairs definition to file. + @pyaedt_function_handler(filename="output_file") + def save_diff_pairs_to_file(self, output_file): + """Save differential pairs definition to a file. If the file that is specified already exists, it is overwritten. Parameters ---------- - filename : str - Full qualified name of the file containing the differential pairs definition. + output_file : str + Full qualified name of the file to save the differential pairs definition to. Returns ------- @@ -1422,59 +1432,59 @@ def save_diff_pairs_to_file(self, filename): ---------- >>> oDesign.SaveDiffPairsToFile """ - self.odesign.SaveDiffPairsToFile(filename) + self.odesign.SaveDiffPairsToFile(output_file) - return os.path.isfile(filename) + return os.path.isfile(output_file) - @pyaedt_function_handler() - def add_netlist_datablock(self, netlist_file, datablock_name=None): + @pyaedt_function_handler(netlist_file="input_file", datablock_name="name") + def add_netlist_datablock(self, input_file, name=None): """Add a new netlist data block to the circuit schematic. Parameters ---------- - netlist_file : str + input_file : str Path to the netlist file. - datablock_name : str, optional + name : str, optional Name of the data block. Returns ------- bool - ``True`` if successfully created, ``False`` otherwise. + ``True`` when successful, ``False`` when failed. """ - if not os.path.exists(netlist_file): + if not os.path.exists(input_file): self.logger.error("Netlist File doesn't exists") return False - if not datablock_name: - datablock_name = generate_unique_name("Inc") + if not name: + name = generate_unique_name("Inc") tmp_oModule = self.odesign.GetModule("DataBlock") tmp_oModule.AddNetlistDataBlock( - ["NAME:DataBlock", "name:=", datablock_name, "filename:=", netlist_file, "filelocation:=", 0] + ["NAME:DataBlock", "name:=", name, "filename:=", input_file, "filelocation:=", 0] ) return True - @pyaedt_function_handler() - def browse_log_file(self, filepath=None): - """Save most recent log file into a new directory. + @pyaedt_function_handler(filepath="input_file") + def browse_log_file(self, input_file=None): + """Save the most recent log file in a new directory. Parameters ---------- - filepath : str, optional - New log file path. The default is the pyaedt folder. + input_file : str, optional + File path to save the new log file to. The default is the ``pyaedt`` folder. Returns ------- str File Path. """ - if filepath and not os.path.exists(os.path.normpath(filepath)): + if input_file and not os.path.exists(os.path.normpath(input_file)): self.logger.error("Path does not exist.") return None - elif not filepath: - filepath = os.path.join(os.path.normpath(self.working_directory), "logfile") - if not os.path.exists(filepath): - os.mkdir(filepath) + elif not input_file: + input_file = os.path.join(os.path.normpath(self.working_directory), "logfile") + if not os.path.exists(input_file): + os.mkdir(input_file) results_path = os.path.join(os.path.normpath(self.results_directory), self.design_name) results_temp_path = os.path.join(results_path, "temp") @@ -1492,9 +1502,9 @@ def browse_log_file(self, filepath=None): self.logger.error("Design not solved") return None - shutil.copy(latest_file, filepath) + shutil.copy(latest_file, input_file) filename = os.path.basename(latest_file) - return os.path.join(filepath, filename) + return os.path.join(input_file, filename) @pyaedt_function_handler() def connect_circuit_models_from_multi_zone_cutout( @@ -1541,7 +1551,7 @@ def connect_circuit_models_from_multi_zone_cutout( inc = model_inc ind = 1 for edb_file in list(edb_zones_dict.keys()): - hfss3d_layout_model = self.import_edb_in_circuit(edb_path=edb_file) + hfss3d_layout_model = self.import_edb_in_circuit(input_dir=edb_file) model_position = [ind * inc, 0] hfss3d_layout_model.location = model_position ind += 1 @@ -1583,20 +1593,20 @@ def connect_circuit_models_from_multi_zone_cutout( return True return False - @pyaedt_function_handler() - def import_edb_in_circuit(self, edb_path): + @pyaedt_function_handler(edb_path="input_dir") + def import_edb_in_circuit(self, input_dir): """Import an EDB design inside a Circuit project. Parameters ---------- - edb_path : str + input_dir : str Path of the EDB file to copy. Returns ------- ``Hfss3DLayout`` component instance. """ - hfss = Hfss3dLayout(edb_path) + hfss = Hfss3dLayout(input_dir) try: hfss.edit_cosim_options( simulate_missing_solution=True, @@ -1615,10 +1625,10 @@ def import_edb_in_circuit(self, edb_path): hfss.close_project(save_project=False) return hfss_3d_layout_model - @pyaedt_function_handler() + @pyaedt_function_handler(touchstone="input_file") def create_tdr_schematic_from_snp( self, - touchstone, + input_file, probe_pins, probe_ref_pins=None, termination_pins=None, @@ -1632,10 +1642,10 @@ def create_tdr_schematic_from_snp( Parameters ---------- - touchstone : str + input_file : str Full path to the sNp file. probe_pins : list - Pins to attach to the probe components. + List of pins to attach to the probe components. probe_ref_pins : list, optional Reference pins to attach to probe components. The default is ``None``. This parameter is valid only in differential TDR probes. @@ -1662,10 +1672,10 @@ def create_tdr_schematic_from_snp( self.logger.warning("Design already exists. renaming.") design_name = generate_unique_name(design_name) self.insert_design(design_name) - if isinstance(touchstone, type(Hfss3dLayout)): - touchstone_path = touchstone.export_touchstone() + if isinstance(input_file, type(Hfss3dLayout)): + touchstone_path = input_file.export_touchstone() else: - touchstone_path = touchstone + touchstone_path = input_file sub = self.modeler.components.create_touchstone_component(touchstone_path) center_x = sub.location[0] @@ -1751,10 +1761,10 @@ def create_tdr_schematic_from_snp( self.post.create_report(trace) return True, tdr_probe_names - @pyaedt_function_handler() + @pyaedt_function_handler(touchstone="input_file") def create_lna_schematic_from_snp( self, - touchstone, + input_file, start_frequency=0, stop_frequency=30, auto_assign_diff_pairs=False, @@ -1769,7 +1779,7 @@ def create_lna_schematic_from_snp( Parameters ---------- - touchstone : str + input_file : str Full path to the sNp file. start_frequency : int, float, optional Start frequency in GHz of the LNA setup. The default is ``0``. @@ -1798,10 +1808,10 @@ def create_lna_schematic_from_snp( self.logger.warning("Design already exists. renaming.") design_name = generate_unique_name(design_name) self.insert_design(design_name) - if isinstance(touchstone, type(Hfss3dLayout)): - touchstone_path = touchstone.export_touchstone() + if isinstance(input_file, type(Hfss3dLayout)): + touchstone_path = input_file.export_touchstone() else: - touchstone_path = touchstone + touchstone_path = input_file sub = self.modeler.components.create_touchstone_component(touchstone_path) @@ -1841,12 +1851,12 @@ def create_lna_schematic_from_snp( if component_neg == component and net_neg != net and net_neg[:-1] == net[:-1]: self.set_differential_pair( - positive_terminal=pin.name, - negative_terminal=neg_pin.name, - common_name="COMMON_{}_{}".format(component, net), - diff_name="{}_{}".format(component, net), - common_ref_z=25, - diff_ref_z=100, + assignment=pin.name, + reference=neg_pin.name, + common_mode="COMMON_{}_{}".format(component, net), + differential_mode="{}_{}".format(component, net), + common_reference=25, + differential_reference=100, active=True, ) diff_pairs.append("{}_{}".format(component, net)) @@ -1858,10 +1868,10 @@ def create_lna_schematic_from_snp( self.analyze() return True, diff_pairs, comm_pairs - @pyaedt_function_handler() + @pyaedt_function_handler(touchstone="input_file") def create_ami_schematic_from_snp( self, - touchstone, + input_file, ibis_ami, component_name, tx_buffer_name, @@ -1882,7 +1892,7 @@ def create_ami_schematic_from_snp( Parameters ---------- - touchstone : str + input_file : str Full path to the sNp file. ibis_ami : str Full path to the IBIS file. @@ -1927,13 +1937,13 @@ def create_ami_schematic_from_snp( Second and third arguments are respectively the names of the tx and rx mode probes. """ if design_name in self.design_list: - self.logger.warning("Design already exists. renaming.") + self.logger.warning("Design already exists. Renaming.") design_name = generate_unique_name(design_name) self.insert_design(design_name) - if isinstance(touchstone, type(Hfss3dLayout)): - touchstone_path = touchstone.export_touchstone() + if isinstance(input_file, type(Hfss3dLayout)): + touchstone_path = input_file.export_touchstone() else: - touchstone_path = touchstone + touchstone_path = input_file sub = self.modeler.components.create_touchstone_component(touchstone_path) center_x = sub.location[0]