From dceedc65a717ec00067dea40cf31b433db2ce354 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Wed, 15 May 2024 11:40:50 -0400 Subject: [PATCH 01/26] feat/filtersolutions: ignore changes to pyaedtenv --- .gitignore | 2 + .../resources/bridge_t.ckt | 27 + .../resources/bridge_t_high.ckt | 33 + .../resources/bridge_t_low.ckt | 39 + .../resources/c_lead_inductor.ckt | 23 + .../resources/c_node_capacitor.ckt | 20 + .../resources/c_node_compensate.ckt | 17 + .../resources/capacitor_ls.ckt | 20 + .../resources/capacitor_q.ckt | 20 + .../resources/capacitor_rp.ckt | 20 + .../resources/capacitor_rs.ckt | 20 + .../resources/complex.ckt | 17 + .../resources/current_source.ckt | 17 + .../resources/diplexer1_bp_1.ckt | 42 + .../resources/diplexer1_bp_2.ckt | 42 + .../resources/diplexer1_bp_bs.ckt | 40 + .../resources/diplexer1_hi_lo.ckt | 28 + .../resources/diplexer2_bp_bs.ckt | 40 + .../resources/diplexer2_triplexer_1.ckt | 41 + .../resources/diplexer2_triplexer_2.ckt | 41 + .../resources/equal_capacitors.ckt | 38 + .../resources/equal_inductors.ckt | 32 + .../resources/equal_legs.ckt | 32 + .../resources/first_series.ckt | 17 + .../resources/first_shunt.ckt | 17 + .../resources/generator_resistor.ckt | 17 + .../resources/high_low_pass.ckt | 22 + .../resources/high_low_pass_min_ind.ckt | 33 + .../resources/inductor_cp.ckt | 19 + .../resources/inductor_q.ckt | 19 + .../resources/inductor_rp.ckt | 19 + .../resources/inductor_rs.ckt | 19 + .../resources/l_lead_inductor.ckt | 21 + .../resources/l_node_capacitor.ckt | 21 + .../resources/l_node_compensate.ckt | 17 + .../resources/laod_resistor.ckt | 17 + .../resources/match_impedance.ckt | 23 + .../resources/min_cap.ckt | 34 + .../resources/min_ind.ckt | 33 + .../resources/multiband.ckt | 37 + .../resources/netlist.ckt | 17 + .../resources/node_cap_ground.ckt | 34 + .../resources/pspice.ckt | 32 + .../resources/r_lead_inductor.ckt | 17 + .../resources/r_node_capacitor.ckt | 17 + .../resources/set_source_res.ckt | 33 + .../resources/source_res.ckt | 33 + .../resources/transferfunction.ckt | 6 + .../resources/trap_topology.ckt | 35 + .../resources/zig_zag.ckt | 33 + .../test_filter/resource.py | 12 + .../test_filter/test_attributes.py | 409 +++++ .../test_filter/test_dll_interface.py | 19 + .../test_filter/test_filter_design.py | 83 + .../test_filter/test_graph_setup.py | 29 + .../test_filter/test_ideal_response.py | 326 ++++ .../test_filter/test_multiple_bands_table.py | 67 + .../test_filter/test_transmission_zeros.py | 112 ++ .../test_lumped_filter/resource.py | 12 + .../test_lumped_implementation.py | 99 ++ .../test_lumped_nodes_and_leads.py | 107 ++ .../test_lumped_parasitics.py | 107 ++ .../test_lumped_termination_impedance.py | 143 ++ .../test_lumped_topology.py | 352 +++++ .../test_raise_error.py | 9 + _unittest/test_46_attributes.py | 409 +++++ examples/02-HFSS/HFSS_Dipole.py | 5 +- .../filltersolutionsexample.py | 20 + pyaedt.code-workspace | 10 + pyaedt/__init__.py | 1 + pyaedt/filtersolutions.py | 116 ++ pyaedt/filtersolutions_core/__init__.py | 16 + pyaedt/filtersolutions_core/attributes.py | 1378 +++++++++++++++++ pyaedt/filtersolutions_core/dll_interface.py | 155 ++ pyaedt/filtersolutions_core/graph_setup.py | 108 ++ pyaedt/filtersolutions_core/ideal_response.py | 441 ++++++ .../lumped_nodes_and_leads.py | 208 +++ .../filtersolutions_core/lumped_parasitics.py | 199 +++ .../lumped_termination_impedance.py | 382 +++++ .../filtersolutions_core/lumped_topology.py | 546 +++++++ .../multiple_bands_table.py | 145 ++ .../transmission_zeros.py | 234 +++ pyaedt/generic/design_types.py | 12 + 83 files changed, 7560 insertions(+), 4 deletions(-) create mode 100644 _unittest/test_45 FilterSolutions/resources/bridge_t.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/bridge_t_high.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/bridge_t_low.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/c_lead_inductor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/c_node_capacitor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/c_node_compensate.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/capacitor_ls.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/capacitor_q.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/capacitor_rp.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/capacitor_rs.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/complex.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/current_source.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer1_bp_1.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer1_bp_2.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer1_bp_bs.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer1_hi_lo.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer2_bp_bs.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_1.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_2.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/equal_capacitors.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/equal_inductors.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/equal_legs.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/first_series.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/first_shunt.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/generator_resistor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/high_low_pass.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/high_low_pass_min_ind.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/inductor_cp.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/inductor_q.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/inductor_rp.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/inductor_rs.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/l_lead_inductor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/l_node_capacitor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/l_node_compensate.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/laod_resistor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/match_impedance.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/min_cap.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/min_ind.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/multiband.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/netlist.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/node_cap_ground.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/pspice.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/r_lead_inductor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/r_node_capacitor.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/set_source_res.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/source_res.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/transferfunction.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/trap_topology.ckt create mode 100644 _unittest/test_45 FilterSolutions/resources/zig_zag.ckt create mode 100644 _unittest/test_45 FilterSolutions/test_filter/resource.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_attributes.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_dll_interface.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_filter_design.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_graph_setup.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_ideal_response.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_multiple_bands_table.py create mode 100644 _unittest/test_45 FilterSolutions/test_filter/test_transmission_zeros.py create mode 100644 _unittest/test_45 FilterSolutions/test_lumped_filter/resource.py create mode 100644 _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_implementation.py create mode 100644 _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py create mode 100644 _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_parasitics.py create mode 100644 _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py create mode 100644 _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_topology.py create mode 100644 _unittest/test_45 FilterSolutions/test_raise_error.py create mode 100644 _unittest/test_46_attributes.py create mode 100644 examples/Filtersolutions/filltersolutionsexample.py create mode 100644 pyaedt.code-workspace create mode 100644 pyaedt/filtersolutions.py create mode 100644 pyaedt/filtersolutions_core/__init__.py create mode 100644 pyaedt/filtersolutions_core/attributes.py create mode 100644 pyaedt/filtersolutions_core/dll_interface.py create mode 100644 pyaedt/filtersolutions_core/graph_setup.py create mode 100644 pyaedt/filtersolutions_core/ideal_response.py create mode 100644 pyaedt/filtersolutions_core/lumped_nodes_and_leads.py create mode 100644 pyaedt/filtersolutions_core/lumped_parasitics.py create mode 100644 pyaedt/filtersolutions_core/lumped_termination_impedance.py create mode 100644 pyaedt/filtersolutions_core/lumped_topology.py create mode 100644 pyaedt/filtersolutions_core/multiple_bands_table.py create mode 100644 pyaedt/filtersolutions_core/transmission_zeros.py diff --git a/.gitignore b/.gitignore index 32172648189..cbe6fe6f40a 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,5 @@ model.index\+ # local environment settings used by e.g. Visual Studio Code /.env /doc/source/local_config.json +/pyaedtenv/** +/.cov/** diff --git a/_unittest/test_45 FilterSolutions/resources/bridge_t.ckt b/_unittest/test_45 FilterSolutions/resources/bridge_t.ckt new file mode 100644 index 00000000000..9a692c73fd1 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/bridge_t.ckt @@ -0,0 +1,27 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C2 2 3 7.12E-12 +C3 3 0 3.873E-12 +C4 3 4 1.233E-11 +Rq4 3 4 5E+10 +L1 2 4 4.424E-09 +C6 4 5 3.916E-12 +Rq6 4 5 5E+10 +C7 5 0 9.429E-12 +C8 5 6 4.684E-12 +Rq8 5 6 5E+10 +L5 4 6 8.388E-09 +R9 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -70 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 2.5E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/bridge_t_high.ckt b/_unittest/test_45 FilterSolutions/resources/bridge_t_high.ckt new file mode 100644 index 00000000000..a45cb02ca4e --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/bridge_t_high.ckt @@ -0,0 +1,33 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L2 2 3 8.17E-09 +L3 3 4 8.595E-09 +C3 4 0 2.366E-12 +L4 3 5 8.123E-09 +L5 5 6 4.129E-09 +C5 6 0 2.523E-12 +L6 5 7 1.459E-09 +R7 7 0 50 +C9 2 8 7.438E-13 +L10 8 0 1.071E-08 +C11 8 9 1.496E-12 +C8 2 9 1.574E-12 +C13 9 10 1.287E-12 +L14 10 0 1.004E-08 +C15 10 11 3.582E-12 +C12 9 11 3.642E-12 +R16 11 0 50 +* +* Compensation Elements +* +L1 2 12 2.28E-07 +C1 12 0 1.111E-13 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(7) VDB(11) -200 0 +.PLOT AC VP(7) VP(11) -200 200 +.PLOT AC VG(7) VG(11) 0 1.8E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(7) V(11) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/bridge_t_low.ckt b/_unittest/test_45 FilterSolutions/resources/bridge_t_low.ckt new file mode 100644 index 00000000000..b7126ceba00 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/bridge_t_low.ckt @@ -0,0 +1,39 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L3 2 3 3.406E-08 +C4 3 0 2.366E-12 +L5 3 4 1.693E-08 +L2 2 4 1.609E-08 +L7 4 5 1.969E-08 +C8 5 0 2.523E-12 +L9 5 6 7.071E-09 +L6 4 6 6.955E-09 +R10 6 0 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C11 2 7 3.1E-12 +L12 7 8 1.071E-08 +C12 8 0 2.947E-12 +C13 7 9 3.118E-12 +Rq13 7 9 5E+10 +L14 9 10 1.004E-08 +C14 10 0 6.135E-12 +C15 9 11 1.736E-11 +Rq15 9 11 5E+10 +R16 11 0 50 +* +* Compensation Elements +* +L1 2 12 2.28E-07 +C1 12 0 1.111E-13 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) VDB(11) -200 0 +.PLOT AC VP(6) VP(11) -200 200 +.PLOT AC VG(6) VG(11) 0 1.8E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) V(11) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/c_lead_inductor.ckt b/_unittest/test_45 FilterSolutions/resources/c_lead_inductor.ckt new file mode 100644 index 00000000000..0494a776955 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/c_lead_inductor.ckt @@ -0,0 +1,23 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +Ln1C1 2 2517 1E-09 +C1 2517 2519 1.967E-12 +Ln2C1 2519 0 1E-09 +L2 2 3 1.288E-08 +Ln1C3 3 3517 1E-09 +C3 3517 3519 6.366E-12 +Ln2C3 3519 0 1E-09 +L4 3 4 1.288E-08 +Ln1C5 4 4517 1E-09 +C5 4517 4519 1.967E-12 +Ln2C5 4519 0 1E-09 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -140 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 1.2E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) -0.1 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/c_node_capacitor.ckt b/_unittest/test_45 FilterSolutions/resources/c_node_capacitor.ckt new file mode 100644 index 00000000000..d438dd52aee --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/c_node_capacitor.ckt @@ -0,0 +1,20 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +Cn1C1 2 0 1E-09 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +Cn1C3 3 0 1E-09 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +Cn1C5 4 0 1E-09 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -200 -50 +.PLOT AC VP(4) -90 0 +.PLOT AC VG(4) 0 3E-11 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) -0.1 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/c_node_compensate.ckt b/_unittest/test_45 FilterSolutions/resources/c_node_compensate.ckt new file mode 100644 index 00000000000..341985a9476 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/c_node_compensate.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_ls.ckt b/_unittest/test_45 FilterSolutions/resources/capacitor_ls.ckt new file mode 100644 index 00000000000..ee03e5d60bb --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/capacitor_ls.ckt @@ -0,0 +1,20 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 3 1.967E-12 +LXcs1 3 0 1E-09 +L2 2 4 1.288E-08 +C3 4 5 6.366E-12 +LXcs3 5 0 1E-09 +L4 4 6 1.288E-08 +C5 6 7 1.967E-12 +LXcs5 7 0 1E-09 +R6 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -160 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 1E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_q.ckt b/_unittest/test_45 FilterSolutions/resources/capacitor_q.ckt new file mode 100644 index 00000000000..2a7355017b6 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/capacitor_q.ckt @@ -0,0 +1,20 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +Rq1 2 0 8090 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +Rq3 3 0 2500 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +Rq5 4 0 8090 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_rp.ckt b/_unittest/test_45 FilterSolutions/resources/capacitor_rp.ckt new file mode 100644 index 00000000000..2eead0f6a32 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/capacitor_rp.ckt @@ -0,0 +1,20 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +Rp1 2 0 1000 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +Rp3 3 0 1000 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +Rp5 4 0 1000 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_rs.ckt b/_unittest/test_45 FilterSolutions/resources/capacitor_rs.ckt new file mode 100644 index 00000000000..c7bc0d4e4ef --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/capacitor_rs.ckt @@ -0,0 +1,20 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 3 1.967E-12 +Rs1 3 0 1 +L2 2 4 1.288E-08 +C3 4 5 6.366E-12 +Rs3 5 0 1 +L4 4 6 1.288E-08 +C5 6 7 1.967E-12 +Rs5 7 0 1 +R6 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -80 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 8E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/complex.ckt b/_unittest/test_45 FilterSolutions/resources/complex.ckt new file mode 100644 index 00000000000..516f71d6897 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/complex.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 {TABLE(F, 1E+08, 1, 1E+09, 1, 1E+10, 1) + J*TABLE(F, 1E+08, 0, 1E+09, 0, 1E+10, 0)} +C1 2 0 9.836E-11 +L2 2 3 2.575E-10 +C3 3 0 3.183E-10 +L4 3 4 2.575E-10 +C5 4 0 9.836E-11 +R6 4 0 {TABLE(F, 1E+08, 1, 1E+09, 1, 1E+10, 1) + J*TABLE(F, 1E+08, 0, 1E+09, 0, 1E+10, 0)} +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/current_source.ckt b/_unittest/test_45 FilterSolutions/resources/current_source.ckt new file mode 100644 index 00000000000..0ff573d7e52 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/current_source.ckt @@ -0,0 +1,17 @@ +* +I1 1 0 AC 1 PULSE 0 0.04 0 1.592E-13 0 +R0 1 0 50 +C1 1 0 1.967E-12 +L2 1 2 1.288E-08 +C3 2 0 6.366E-12 +L4 2 3 1.288E-08 +C5 3 0 1.967E-12 +R6 3 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC IDB(R6) -80 0 +.PLOT AC IP(R6) -200 200 +.PLOT AC VG(R6) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN I(R6) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_1.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_1.ckt new file mode 100644 index 00000000000..7d071286181 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_1.ckt @@ -0,0 +1,42 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L2 2 3 3.173E-08 +C2 3 0 1.017E-11 +C3 2 4 2.697E-12 +L4 4 5 2.505E-08 +L5 5 0 6.149E-09 +C6 5 0 1.099E-11 +C7 5 6 3.016E-12 +L8 6 7 2.241E-08 +L9 7 0 1.165E-08 +C10 7 0 5.801E-12 +C11 7 8 1.349E-11 +L12 8 9 5.011E-09 +R13 9 0 50 +L14 2 10 2.492E-09 +C14 10 0 7.983E-13 +C15 2 11 1.011E-12 +L16 11 12 9.391E-09 +L17 12 0 2.305E-09 +C18 12 0 4.12E-12 +C19 12 13 1.13E-12 +L20 13 14 8.4E-09 +L21 14 0 4.366E-09 +C22 14 0 2.175E-12 +C23 14 15 5.055E-12 +L24 15 16 1.878E-09 +R25 16 0 50 +* +* Compensation Elements +* +L1 2 17 8.356E-08 +C1 17 0 3.031E-13 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) VDB(16) -200 0 +.PLOT AC VP(9) VP(16) -200 200 +.PLOT AC VG(9) VG(16) -1E-09 7E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) V(16) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_2.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_2.ckt new file mode 100644 index 00000000000..ba392bebff7 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_2.ckt @@ -0,0 +1,42 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L2 2 3 3.998E-08 +C2 3 0 1.737E-11 +C3 2 4 4.12E-12 +L4 4 5 2.459E-08 +L5 5 0 9.393E-09 +C6 5 0 1.079E-11 +C7 5 6 4.607E-12 +L8 6 7 2.199E-08 +L9 7 0 1.779E-08 +C10 7 0 5.694E-12 +C11 7 8 2.06E-11 +L12 8 9 4.918E-09 +R13 9 0 50 +L14 2 10 1.458E-09 +C14 10 0 6.335E-13 +C15 2 11 1.03E-12 +L16 11 12 6.148E-09 +L17 12 0 2.348E-09 +C18 12 0 2.697E-12 +C19 12 13 1.152E-12 +L20 13 14 5.499E-09 +L21 14 0 4.449E-09 +C22 14 0 1.424E-12 +C23 14 15 5.15E-12 +L24 15 16 1.23E-09 +R25 16 0 50 +* +* Compensation Elements +* +L1 2 17 2.885E-08 +C1 17 0 8.78E-13 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) VDB(16) -200 0 +.PLOT AC VP(9) VP(16) -200 200 +.PLOT AC VG(9) VG(16) -1E-09 8E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) V(16) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_bs.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_bs.ckt new file mode 100644 index 00000000000..70285e884ec --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_bs.ckt @@ -0,0 +1,40 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C3 2 3 4.12E-13 +L4 3 4 6.148E-08 +L5 4 0 9.393E-10 +C6 4 0 2.697E-11 +C7 4 5 4.607E-13 +L8 5 6 5.499E-08 +L9 6 0 1.779E-09 +C10 6 0 1.424E-11 +C11 6 7 2.06E-12 +L12 7 8 1.23E-08 +R13 8 0 50 +L14 2 9 2.459E-08 +C14 2 9 1.03E-12 +L15 9 10 2.348E-09 +C15 10 0 1.079E-11 +L16 9 11 2.199E-08 +C16 9 11 1.152E-12 +L17 11 12 4.449E-09 +C17 12 0 5.694E-12 +L18 11 13 4.918E-09 +C18 11 13 5.15E-12 +R19 13 0 50 +* +* Compensation Elements +* +L1 2 14 1.745E-08 +C1 14 0 3.873E-12 +L2 2 15 6.54E-09 +C2 15 0 1.452E-12 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(8) VDB(13) -200 0 +.PLOT AC VP(8) VP(13) -200 200 +.PLOT AC VG(8) VG(13) -1E-09 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(8) V(13) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_hi_lo.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer1_hi_lo.ckt new file mode 100644 index 00000000000..faf4df142de --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer1_hi_lo.ckt @@ -0,0 +1,28 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L2 2 3 1.359E-08 +C3 3 0 5.96E-12 +L4 3 4 1.215E-08 +C5 4 0 3.146E-12 +L6 4 5 2.717E-09 +R7 5 0 50 +C8 2 6 1.864E-12 +L9 6 0 4.25E-09 +C10 6 7 2.084E-12 +L11 7 0 8.052E-09 +C12 7 8 9.322E-12 +R13 8 0 50 +* +* Compensation Elements +* +L1 2 9 2.041E-07 +C1 9 0 1.241E-13 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(5) VDB(8) -200 0 +.PLOT AC VP(5) VP(8) -200 200 +.PLOT AC VG(5) VG(8) 0 1.4E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(5) V(8) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer2_bp_bs.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer2_bp_bs.ckt new file mode 100644 index 00000000000..70285e884ec --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer2_bp_bs.ckt @@ -0,0 +1,40 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C3 2 3 4.12E-13 +L4 3 4 6.148E-08 +L5 4 0 9.393E-10 +C6 4 0 2.697E-11 +C7 4 5 4.607E-13 +L8 5 6 5.499E-08 +L9 6 0 1.779E-09 +C10 6 0 1.424E-11 +C11 6 7 2.06E-12 +L12 7 8 1.23E-08 +R13 8 0 50 +L14 2 9 2.459E-08 +C14 2 9 1.03E-12 +L15 9 10 2.348E-09 +C15 10 0 1.079E-11 +L16 9 11 2.199E-08 +C16 9 11 1.152E-12 +L17 11 12 4.449E-09 +C17 12 0 5.694E-12 +L18 11 13 4.918E-09 +C18 11 13 5.15E-12 +R19 13 0 50 +* +* Compensation Elements +* +L1 2 14 1.745E-08 +C1 14 0 3.873E-12 +L2 2 15 6.54E-09 +C2 15 0 1.452E-12 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(8) VDB(13) -200 0 +.PLOT AC VP(8) VP(13) -200 200 +.PLOT AC VG(8) VG(13) -1E-09 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(8) V(13) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_1.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_1.ckt new file mode 100644 index 00000000000..5102c593558 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_1.ckt @@ -0,0 +1,41 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L3 2 3 2.968E-08 +C4 3 0 1.302E-11 +L5 3 4 2.655E-08 +C6 4 0 6.873E-12 +L7 4 5 5.937E-09 +R8 5 0 50 +C9 2 6 8.533E-13 +L10 6 0 1.945E-09 +C11 6 7 9.541E-13 +L12 7 0 3.685E-09 +C13 7 8 4.267E-12 +R14 8 0 50 +C15 2 9 4.12E-13 +L16 9 10 6.148E-08 +L17 10 0 9.393E-10 +C18 10 0 2.697E-11 +C19 10 11 4.607E-13 +L20 11 12 5.499E-08 +L21 12 0 1.779E-09 +C22 12 0 1.424E-11 +C23 12 13 2.06E-12 +L24 13 14 1.23E-08 +R25 14 0 50 +* +* Compensation Elements +* +L1 2 15 1.86E-08 +C1 15 0 3.633E-12 +L2 2 16 6.972E-09 +C2 16 0 1.362E-12 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(5) VDB(8) VDB(14) -160 0 +.PLOT AC VP(5) VP(8) VP(14) -200 200 +.PLOT AC VG(5) VG(8) VG(14) -2E-09 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(5) V(8) V(14) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_2.ckt b/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_2.ckt new file mode 100644 index 00000000000..44f501aaf90 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_2.ckt @@ -0,0 +1,41 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L3 2 3 3.979E-08 +C4 3 0 1.745E-11 +L5 3 4 3.559E-08 +C6 4 0 9.213E-12 +L7 4 5 7.958E-09 +R8 5 0 50 +C9 2 6 6.366E-13 +L10 6 0 1.451E-09 +C11 6 7 7.118E-13 +L12 7 0 2.749E-09 +C13 7 8 3.183E-12 +R14 8 0 50 +C15 2 9 8.798E-13 +L16 9 10 2.879E-08 +L17 10 0 2.006E-09 +C18 10 0 1.263E-11 +C19 10 11 9.836E-13 +L20 11 12 2.575E-08 +L21 12 0 3.799E-09 +C22 12 0 6.667E-12 +C23 12 13 4.399E-12 +L24 13 14 5.758E-09 +R25 14 0 50 +* +* Compensation Elements +* +L1 2 15 1.835E-08 +C1 15 0 5.521E-12 +L2 2 16 4.588E-09 +C2 16 0 1.38E-12 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(5) VDB(8) VDB(14) -140 0 +.PLOT AC VP(5) VP(8) VP(14) -200 200 +.PLOT AC VG(5) VG(8) VG(14) -1E-09 5E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(5) V(8) V(14) -0.2 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/equal_capacitors.ckt b/_unittest/test_45 FilterSolutions/resources/equal_capacitors.ckt new file mode 100644 index 00000000000..fbee04c3090 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/equal_capacitors.ckt @@ -0,0 +1,38 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +L1 2 0 4.003E-09 +C2 2 0 6.443E-12 +L3 2 3 7.648E-10 +C3 2 3 4.236E-11 +L4 3 4 4.003E-09 +Rq4 4 0 5E-08 +C5 3 0 4.743E-12 +L6 3 5 7.217E-10 +C6 3 5 2.744E-11 +L7 5 6 4.003E-09 +Rq7 6 0 5E-08 +C8 5 0 6.711E-12 +L9 5 7 3.148E-09 +C9 5 7 1.134E-11 +L10 7 8 5.758E-09 +Rq10 8 0 5E-08 +C11 7 0 5.081E-12 +L12 7 9 1.851E-09 +C12 7 9 9.713E-12 +L13 9 10 2.342E-09 +Rq13 10 0 5E-08 +C14 9 0 1.123E-11 +R15 9 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) -60 0 +.PLOT AC VP(9) -200 200 +.PLOT AC VG(9) 0 2.5E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) -0.04 0.04 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/equal_inductors.ckt b/_unittest/test_45 FilterSolutions/resources/equal_inductors.ckt new file mode 100644 index 00000000000..2cc6bb68d7a --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/equal_inductors.ckt @@ -0,0 +1,32 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +L1 2 0 2.575E-09 +C2 2 3 1.23E-11 +C3 3 0 4.918E-11 +L4 3 4 2.575E-09 +C5 4 0 1.041E-11 +C6 4 5 1.302E-12 +Rq6 4 5 5E+10 +L7 5 0 2.575E-09 +C8 5 0 7.522E-12 +C9 5 6 1.302E-12 +C10 6 0 1.041E-11 +L11 6 7 2.575E-09 +C12 7 0 4.918E-11 +C13 7 8 1.23E-11 +Rq13 7 8 5E+10 +L14 8 0 2.575E-09 +R15 8 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(8) -160 0 +.PLOT AC VP(8) -200 200 +.PLOT AC VG(8) 0 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(8) -0.04 0.04 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/equal_legs.ckt b/_unittest/test_45 FilterSolutions/resources/equal_legs.ckt new file mode 100644 index 00000000000..67a3082a9e4 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/equal_legs.ckt @@ -0,0 +1,32 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +L1 2 0 3.08E-09 +C2 2 0 9.836E-12 +L3 2 3 1.263E-08 +L4 3 4 3.08E-09 +Rq4 4 0 5E-08 +C5 3 0 8.641E-12 +C6 3 5 1.589E-12 +L7 5 0 1.269E-09 +C8 5 0 1.728E-11 +C9 5 6 1.589E-12 +L10 6 0 3.08E-09 +C11 6 0 8.641E-12 +L12 6 7 1.263E-08 +L13 7 8 3.08E-09 +Rq13 8 0 5E-08 +C14 7 0 9.836E-12 +R15 7 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(7) -160 0 +.PLOT AC VP(7) -200 200 +.PLOT AC VG(7) 0 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(7) -0.04 0.04 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/first_series.ckt b/_unittest/test_45 FilterSolutions/resources/first_series.ckt new file mode 100644 index 00000000000..084c3c8588d --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/first_series.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +L1 2 3 4.918E-09 +C2 3 0 5.15E-12 +L3 3 4 1.592E-08 +C4 4 0 5.15E-12 +L5 4 5 4.918E-09 +R6 5 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(5) -80 0 +.PLOT AC VP(5) -200 200 +.PLOT AC VG(5) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(5) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/first_shunt.ckt b/_unittest/test_45 FilterSolutions/resources/first_shunt.ckt new file mode 100644 index 00000000000..341985a9476 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/first_shunt.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/generator_resistor.ckt b/_unittest/test_45 FilterSolutions/resources/generator_resistor.ckt new file mode 100644 index 00000000000..41bbe13e2dc --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/generator_resistor.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 30 +C1 2 0 1.865E-12 +L2 2 3 4.849E-09 +C3 3 0 8.275E-12 +L4 3 4 8.956E-09 +C5 4 0 8.124E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.8 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/high_low_pass.ckt b/_unittest/test_45 FilterSolutions/resources/high_low_pass.ckt new file mode 100644 index 00000000000..a1e2b114f65 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/high_low_pass.ckt @@ -0,0 +1,22 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 9.836E-12 +L2 2 3 2.476E-09 +C3 3 0 2.627E-10 +L4 3 4 9.78E-11 +C5 4 0 2.04E-08 +L6 4 0 1.242E-12 +C7 4 5 2.59E-10 +L8 5 0 9.641E-11 +C9 5 6 1.023E-11 +L10 6 0 2.575E-09 +R11 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -160 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) -0.04 0.04 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/high_low_pass_min_ind.ckt b/_unittest/test_45 FilterSolutions/resources/high_low_pass_min_ind.ckt new file mode 100644 index 00000000000..0331584a42a --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/high_low_pass_min_ind.ckt @@ -0,0 +1,33 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C1 2 0 1.886E-12 +C2 2 3 6.779E-12 +L3 3 4 2.646E-08 +C3 4 0 1.5E-12 +C4 3 5 2.261E-12 +Rq4 3 5 5E+10 +L5 5 6 1.297E-07 +C5 6 0 2.506E-13 +L6 5 7 1.91E-09 +C6 5 7 1.034E-11 +C7 7 0 1.845E-13 +C8 7 8 2.717E-12 +Rq8 7 8 5E+10 +C9 8 0 1.487E-12 +L10 8 9 3.91E-09 +C10 8 9 4.135E-12 +C11 9 0 1.169E-12 +R12 9 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) -70 0 +.PLOT AC VP(9) -200 200 +.PLOT AC VG(9) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_cp.ckt b/_unittest/test_45 FilterSolutions/resources/inductor_cp.ckt new file mode 100644 index 00000000000..6ebb131e4f0 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/inductor_cp.ckt @@ -0,0 +1,19 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +CXlp2 2 3 1E-09 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +CXlp4 3 4 1E-09 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -25 -5 +.PLOT AC VP(4) -90 -10 +.PLOT AC VG(4) 0 2.5E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.5 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_q.ckt b/_unittest/test_45 FilterSolutions/resources/inductor_q.ckt new file mode 100644 index 00000000000..31b6e146174 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/inductor_q.ckt @@ -0,0 +1,19 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +Rq2 3 4 0.809 +C3 4 0 6.366E-12 +L4 4 5 1.288E-08 +Rq4 5 6 0.809 +C5 6 0 1.967E-12 +R6 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -80 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_rp.ckt b/_unittest/test_45 FilterSolutions/resources/inductor_rp.ckt new file mode 100644 index 00000000000..641e3c9900e --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/inductor_rp.ckt @@ -0,0 +1,19 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +Rp2 2 3 1000 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +Rp4 3 4 1000 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 8E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_rs.ckt b/_unittest/test_45 FilterSolutions/resources/inductor_rs.ckt new file mode 100644 index 00000000000..95db13c9463 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/inductor_rs.ckt @@ -0,0 +1,19 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +Rs2 3 4 1 +C3 4 0 6.366E-12 +L4 4 5 1.288E-08 +Rs4 5 6 1 +C5 6 0 1.967E-12 +R6 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -80 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/l_lead_inductor.ckt b/_unittest/test_45 FilterSolutions/resources/l_lead_inductor.ckt new file mode 100644 index 00000000000..47b308f3517 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/l_lead_inductor.ckt @@ -0,0 +1,21 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +Ln1L2 2000 2 1E-09 +L2 2000 3001 1.288E-08 +Ln2L2 3001 3 1E-09 +C3 3 0 6.366E-12 +Ln1L4 3000 3 1E-09 +L4 3000 4001 1.288E-08 +Ln2L4 4001 4 1E-09 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) -0.1 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/l_node_capacitor.ckt b/_unittest/test_45 FilterSolutions/resources/l_node_capacitor.ckt new file mode 100644 index 00000000000..4c369e47216 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/l_node_capacitor.ckt @@ -0,0 +1,21 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +Cn1L2 2 0 1E-09 +L2 2 3 1.288E-08 +Cn2L2 3 0 1E-09 +C3 3 0 6.366E-12 +Cn1L4 3 0 1E-09 +L4 3 4 1.288E-08 +Cn2L4 4 0 1E-09 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -200 -50 +.PLOT AC VP(4) -90 0 +.PLOT AC VG(4) 0 3E-11 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) -0.1 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/l_node_compensate.ckt b/_unittest/test_45 FilterSolutions/resources/l_node_compensate.ckt new file mode 100644 index 00000000000..341985a9476 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/l_node_compensate.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/laod_resistor.ckt b/_unittest/test_45 FilterSolutions/resources/laod_resistor.ckt new file mode 100644 index 00000000000..10645a9f9f8 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/laod_resistor.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 8.124E-12 +L2 2 3 8.956E-09 +C3 3 0 8.275E-12 +L4 3 4 4.849E-09 +C5 4 0 1.865E-12 +R6 4 0 30 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.5 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/match_impedance.ckt b/_unittest/test_45 FilterSolutions/resources/match_impedance.ckt new file mode 100644 index 00000000000..9d6028ed29b --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/match_impedance.ckt @@ -0,0 +1,23 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 75 +L1 2 0 3.863E-09 +C2 2 0 6.499E-12 +C3 2 3 3.213E-13 +C4 3 0 7.22E-14 +L5 3 4 6.438E-08 +L6 4 0 7.958E-10 +C7 4 0 3.183E-11 +C8 4 5 3.935E-13 +L9 5 6 6.438E-08 +L10 6 0 2.575E-09 +C11 6 0 9.836E-12 +R12 6 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(6) -160 0 +.PLOT AC VP(6) -200 200 +.PLOT AC VG(6) 0 9E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(6) -0.03 0.03 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/min_cap.ckt b/_unittest/test_45 FilterSolutions/resources/min_cap.ckt new file mode 100644 index 00000000000..20b7b7f3909 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/min_cap.ckt @@ -0,0 +1,34 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +L1 2 3 2.923E-09 +L2 3 0 8.341E-09 +L3 3 4 1.034E-08 +C3 4 0 1.564E-12 +L4 3 5 9.446E-09 +C4 3 5 4.201E-12 +L5 5 6 9.231E-08 +Rq5 6 0 5E-08 +L6 5 7 2.175E-08 +L7 7 8 1.01E-08 +Rq7 8 0 5E-08 +L8 7 9 1.086E-07 +C8 9 0 1.817E-13 +L9 7 10 6.611E-10 +C9 7 10 4.918E-11 +L10 10 11 -1.28E-09 +L11 11 12 -2.966E-08 +Rq11 12 0 5E-08 +R12 11 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(11) -70 0 +.PLOT AC VP(11) -200 200 +.PLOT AC VG(11) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(11) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/min_ind.ckt b/_unittest/test_45 FilterSolutions/resources/min_ind.ckt new file mode 100644 index 00000000000..f948a2b0803 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/min_ind.ckt @@ -0,0 +1,33 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C1 2 0 3.83E-13 +C2 2 3 4.123E-12 +C3 3 0 9.716E-13 +L4 3 4 2.561E-09 +C4 3 4 6.314E-12 +L5 4 5 6.878E-09 +C5 5 0 5.769E-12 +C6 4 0 1.075E-11 +C7 4 6 3.713E-12 +Rq7 4 6 5E+10 +L8 6 7 4.542E-10 +C8 6 7 4.345E-11 +L9 7 8 1.229E-07 +C9 8 0 2.644E-13 +C10 7 0 -5.118E-13 +C11 7 9 -1.186E-11 +Rq11 7 9 5E+10 +R12 9 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) -70 0 +.PLOT AC VP(9) -200 200 +.PLOT AC VG(9) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/multiband.ckt b/_unittest/test_45 FilterSolutions/resources/multiband.ckt new file mode 100644 index 00000000000..5b3c473dacf --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/multiband.ckt @@ -0,0 +1,37 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 6.558E-13 +L2 2 3 1.183E-08 +C2 3 0 7.587E-13 +L3 2 4 1.412E-08 +C3 4 0 1.265E-13 +L4 2 5 4.292E-09 +L5 5 6 4.966E-09 +C5 5 6 1.808E-12 +L6 6 7 8.281E-10 +C6 6 7 2.157E-12 +C7 7 0 2.122E-12 +L8 7 8 3.657E-09 +C8 8 0 2.455E-12 +L9 7 9 4.363E-09 +C9 9 0 4.095E-13 +L10 7 10 4.292E-09 +L11 10 11 4.966E-09 +C11 10 11 1.808E-12 +L12 11 12 8.281E-10 +C12 11 12 2.157E-12 +C13 12 0 6.558E-13 +L14 12 13 1.183E-08 +C14 13 0 7.587E-13 +L15 12 14 1.412E-08 +C15 14 0 1.265E-13 +R16 12 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(12) -200 0 +.PLOT AC VP(12) -200 200 +.PLOT AC VG(12) 0 7E-09 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(12) 0 0.7 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/netlist.ckt b/_unittest/test_45 FilterSolutions/resources/netlist.ckt new file mode 100644 index 00000000000..341985a9476 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/netlist.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/node_cap_ground.ckt b/_unittest/test_45 FilterSolutions/resources/node_cap_ground.ckt new file mode 100644 index 00000000000..3b51b775af0 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/node_cap_ground.ckt @@ -0,0 +1,34 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 98.45 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +L1 2 0 1.413E-08 +C2 2 0 1.455E-12 +L3 2 3 1.389E-09 +C3 2 3 2.333E-11 +C4 3 0 6.44E-13 +L5 3 4 9.637E-10 +C5 3 4 2.055E-11 +L6 4 5 1.841E-09 +Rq6 5 0 5E-08 +C7 4 0 1.313E-11 +L8 4 6 3.952E-09 +C8 4 6 9.032E-12 +C9 6 0 6.44E-13 +L10 6 7 2.251E-09 +C10 6 7 7.985E-12 +L11 7 8 1.912E-09 +Rq11 8 0 5E-08 +C12 7 0 1.296E-11 +R13 7 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(7) -60 0 +.PLOT AC VP(7) -200 200 +.PLOT AC VG(7) 0 2.5E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(7) -0.03 0.03 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/pspice.ckt b/_unittest/test_45 FilterSolutions/resources/pspice.ckt new file mode 100644 index 00000000000..08f462c6a11 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/pspice.ckt @@ -0,0 +1,32 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +L1 2 0 4.285E-09 +C2 2 0 5.911E-12 +L3 2 3 7.553E-10 +C3 2 3 4.289E-11 +L4 3 4 5.905E-10 +C4 3 4 3.354E-11 +L5 4 5 1.237E-09 +Rq5 5 0 5E-08 +C6 4 0 2.048E-11 +L7 4 6 2.913E-09 +C7 4 6 1.225E-11 +L8 6 7 2.067E-09 +C8 6 7 8.696E-12 +L9 7 8 2.068E-09 +Rq9 8 0 5E-08 +C10 7 0 1.225E-11 +R11 7 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(7) -60 0 +.PLOT AC VP(7) -200 200 +.PLOT AC VG(7) 0 2.5E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(7) -0.04 0.04 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/r_lead_inductor.ckt b/_unittest/test_45 FilterSolutions/resources/r_lead_inductor.ckt new file mode 100644 index 00000000000..341985a9476 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/r_lead_inductor.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/r_node_capacitor.ckt b/_unittest/test_45 FilterSolutions/resources/r_node_capacitor.ckt new file mode 100644 index 00000000000..341985a9476 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/r_node_capacitor.ckt @@ -0,0 +1,17 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +C1 2 0 1.967E-12 +L2 2 3 1.288E-08 +C3 3 0 6.366E-12 +L4 3 4 1.288E-08 +C5 4 0 1.967E-12 +R6 4 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(4) -80 0 +.PLOT AC VP(4) -200 200 +.PLOT AC VG(4) 0 9E-10 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(4) 0 0.6 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/set_source_res.ckt b/_unittest/test_45 FilterSolutions/resources/set_source_res.ckt new file mode 100644 index 00000000000..f948a2b0803 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/set_source_res.ckt @@ -0,0 +1,33 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C1 2 0 3.83E-13 +C2 2 3 4.123E-12 +C3 3 0 9.716E-13 +L4 3 4 2.561E-09 +C4 3 4 6.314E-12 +L5 4 5 6.878E-09 +C5 5 0 5.769E-12 +C6 4 0 1.075E-11 +C7 4 6 3.713E-12 +Rq7 4 6 5E+10 +L8 6 7 4.542E-10 +C8 6 7 4.345E-11 +L9 7 8 1.229E-07 +C9 8 0 2.644E-13 +C10 7 0 -5.118E-13 +C11 7 9 -1.186E-11 +Rq11 7 9 5E+10 +R12 9 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) -70 0 +.PLOT AC VP(9) -200 200 +.PLOT AC VG(9) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/source_res.ckt b/_unittest/test_45 FilterSolutions/resources/source_res.ckt new file mode 100644 index 00000000000..f948a2b0803 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/source_res.ckt @@ -0,0 +1,33 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C1 2 0 3.83E-13 +C2 2 3 4.123E-12 +C3 3 0 9.716E-13 +L4 3 4 2.561E-09 +C4 3 4 6.314E-12 +L5 4 5 6.878E-09 +C5 5 0 5.769E-12 +C6 4 0 1.075E-11 +C7 4 6 3.713E-12 +Rq7 4 6 5E+10 +L8 6 7 4.542E-10 +C8 6 7 4.345E-11 +L9 7 8 1.229E-07 +C9 8 0 2.644E-13 +C10 7 0 -5.118E-13 +C11 7 9 -1.186E-11 +Rq11 7 9 5E+10 +R12 9 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) -70 0 +.PLOT AC VP(9) -200 200 +.PLOT AC VG(9) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/transferfunction.ckt b/_unittest/test_45 FilterSolutions/resources/transferfunction.ckt new file mode 100644 index 00000000000..2515562c037 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/transferfunction.ckt @@ -0,0 +1,6 @@ + 5 1 + 4 2.033e+10 + 3 2.067e+20 + 2 1.299e+30 + 1 5.044e+39 + 0 9.793e+48 9.793e+48 diff --git a/_unittest/test_45 FilterSolutions/resources/trap_topology.ckt b/_unittest/test_45 FilterSolutions/resources/trap_topology.ckt new file mode 100644 index 00000000000..2293fa0f364 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/trap_topology.ckt @@ -0,0 +1,35 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C1 2 0 2.29E-13 +C2 2 3 4.93E-12 +C3 3 0 1.162E-12 +L5 3 4 3.706E-09 +C6 4 5 2.586E-11 +Rq6 4 5 5E+10 +C4 3 5 5.248E-12 +L7 5 6 8.386E-10 +C7 6 0 1.652E-11 +C8 5 6 3.079E-11 +C10 5 7 2.923E-13 +Rq10 5 7 5E+10 +L11 7 8 7.329E-08 +C9 5 8 3.421E-12 +L12 8 9 1.405E-07 +C12 9 0 -2.474E-13 +C13 8 9 4.788E-13 +C14 8 10 -1.186E-11 +Rq14 8 10 5E+10 +R15 10 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(10) -70 0 +.PLOT AC VP(10) -200 200 +.PLOT AC VG(10) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(10) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/resources/zig_zag.ckt b/_unittest/test_45 FilterSolutions/resources/zig_zag.ckt new file mode 100644 index 00000000000..f948a2b0803 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/resources/zig_zag.ckt @@ -0,0 +1,33 @@ +* +V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0 +R0 1 2 50 +* +* Dummy Resistors Required For Spice +* Have Been Added to Net List. +* +C1 2 0 3.83E-13 +C2 2 3 4.123E-12 +C3 3 0 9.716E-13 +L4 3 4 2.561E-09 +C4 3 4 6.314E-12 +L5 4 5 6.878E-09 +C5 5 0 5.769E-12 +C6 4 0 1.075E-11 +C7 4 6 3.713E-12 +Rq7 4 6 5E+10 +L8 6 7 4.542E-10 +C8 6 7 4.345E-11 +L9 7 8 1.229E-07 +C9 8 0 2.644E-13 +C10 7 0 -5.118E-13 +C11 7 9 -1.186E-11 +Rq11 7 9 5E+10 +R12 9 0 50 +* +.AC DEC 200 2E+08 5E+09 +.PLOT AC VDB(9) -70 0 +.PLOT AC VP(9) -200 200 +.PLOT AC VG(9) 0 2E-08 +.TRAN 5E-11 1E-08 0 +.PLOT TRAN V(9) -0.04 0.08 +.END diff --git a/_unittest/test_45 FilterSolutions/test_filter/resource.py b/_unittest/test_45 FilterSolutions/test_filter/resource.py new file mode 100644 index 00000000000..f5db364f802 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/resource.py @@ -0,0 +1,12 @@ +import os + + +def resources_driectory(): + dir_path = os.path.dirname(os.path.realpath(__file__)) + test_dir = os.path.dirname(dir_path) + resources_path = os.path.join(test_dir, "resources") + return resources_path + + +def resource_path(resource_file_name): + return os.path.join(resources_driectory(), resource_file_name) diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45 FilterSolutions/test_filter/test_attributes.py new file mode 100644 index 00000000000..124cfa8f1b1 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_attributes.py @@ -0,0 +1,409 @@ +import pytest +from fspy.attributes import BesselRipplePercentage +from fspy.attributes import GaussianBesselReflection +from fspy.attributes import GaussianTransition +from fspy.attributes import PassbandDefinition +from fspy.attributes import RippleConstrictionBandSelect +from fspy.attributes import SinglePointRippleInfZeros +from fspy.attributes import StopbandDefinition +from fspy.filter_design import FilterClass +from fspy.filter_design import FilterType +from fspy.ideal_design import IdealDesign + + +def test_order(): + design = IdealDesign() + assert design.attributes.order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.order = i + assert design.attributes.order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.order = 22 + assert info.value.args[0] == "The maximum order is 21" + + +def test_minimum_order_stop_band_att(): + design = IdealDesign() + assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" + design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" + assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" + + +def test_minimum_order_stop_band_freq(): + design = IdealDesign() + assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" + design.attributes.minimum_order_stop_band_frequency = "500 MHz" + assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" + + +def test_minimum_order(): + design = IdealDesign() + assert design.attributes.order == 5 + design.attributes.ideal_minimum_order + assert design.attributes.order == 3 + + +def test_pass_band_definition(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + assert len(PassbandDefinition) == 2 + assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY + for pbd in PassbandDefinition: + design.attributes.pass_band_definition = pbd + assert design.attributes.pass_band_definition == pbd + + +def test_pass_band_center_frequency(): + design = IdealDesign() + assert design.attributes.pass_band_center_frequency == "1G" + design.attributes.pass_band_center_frequency = "500M" + assert design.attributes.pass_band_center_frequency == "500M" + + +def test_pass_band_frequency(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + assert design.attributes.pass_band_width_frequency == "200M" + design.attributes.pass_band_width_frequency = "500M" + assert design.attributes.pass_band_width_frequency == "500M" + + +def test_lower_frequency(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.lower_frequency == "905 M" + design.attributes.lower_frequency = "800M" + assert design.attributes.lower_frequency == "800M" + + +def test_upper_frequency(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.upper_frequency == "1.105 G" + design.attributes.upper_frequency = "1.2 G" + assert design.attributes.upper_frequency == "1.2 G" + + +def test_stop_band_definition(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert len(StopbandDefinition) == 3 + assert design.attributes.stop_band_definition == StopbandDefinition.RATIO + for sbd in StopbandDefinition: + design.attributes.stop_band_definition = sbd + assert design.attributes.stop_band_definition == sbd + + +def test_stop_band_ratio(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.stop_band_ratio == "1.2" + design.attributes.stop_band_ratio = "1.5" + assert design.attributes.stop_band_ratio == "1.5" + + +def test_stop_band_frequency(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY + assert design.attributes.stop_band_frequency == "1.2 G" + design.attributes.stop_band_frequency = "1.5 G" + assert design.attributes.stop_band_frequency == "1.5 G" + + +def test_stop_band_attenuation(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB + assert design.attributes.stop_band_attenuation_db == "60" + design.attributes.stop_band_attenuation_db = "40 dB" + assert design.attributes.stop_band_attenuation_db == "40" + + +def test_standard_pass_band_attenuation(): + design = IdealDesign() + assert design.attributes.standard_pass_band_attenuation + design.attributes.standard_pass_band_attenuation = False + assert design.attributes.standard_pass_band_attenuation is False + + +def test_standard_pass_band_attenuation_value_db(): + design = IdealDesign() + design.attributes.standard_pass_band_attenuation = False + assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" + design.attributes.standard_pass_band_attenuation_value_db = "4" + assert design.attributes.standard_pass_band_attenuation_value_db == "4" + + +def test_bessel_normalized_delay(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + assert design.attributes.bessel_normalized_delay is False + design.attributes.bessel_normalized_delay = True + assert design.attributes.bessel_normalized_delay + + +def test_bessel_normalized_delay_period(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + design.attributes.bessel_normalized_delay = True + assert design.attributes.bessel_normalized_delay_period == "2" + design.attributes.bessel_normalized_delay_period = "3" + assert design.attributes.bessel_normalized_delay_period == "3" + + +def test_bessel_normalized_delay_percentage(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + design.attributes.bessel_normalized_delay = True + assert len(BesselRipplePercentage) == 6 + for bessel_normalized_delay_percentage in BesselRipplePercentage: + design.attributes.bessel_normalized_delay_percentage = bessel_normalized_delay_percentage + assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage + + +def test_pass_band_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.pass_band_ripple == ".05" + design.attributes.pass_band_ripple = ".03" + assert design.attributes.pass_band_ripple == ".03" + + +def test_arith_symmetry(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.filter_class = FilterClass.BAND_PASS + assert design.attributes.arith_symmetry is False + design.attributes.arith_symmetry = True + assert design.attributes.arith_symmetry + + +def test_asymmetric(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + assert design.attributes.asymmetric is False + design.attributes.asymmetric = True + assert design.attributes.asymmetric + + +def test_asymmetric_low_order(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_low_order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.asymmetric_low_order = i + assert design.attributes.asymmetric_low_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_low_order = 22 + assert info.value.args[0] == "The maximum order is 21" + + +def test_asymmetric_high_order(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_high_order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.asymmetric_high_order = i + assert design.attributes.asymmetric_high_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_high_order = 22 + assert info.value.args[0] == "The maximum order is 21" + + +def test_asymmetric_low_stop_band_ratio(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_stop_band_ratio == "1.2" + design.attributes.asymmetric_low_stop_band_ratio = "1.5" + assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" + + +def test_asymmetric_high_stop_band_ratio(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_stop_band_ratio == "1.2" + design.attributes.asymmetric_high_stop_band_ratio = "1.5" + assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" + + +def test_asymmetric_low_stop_band_attenuation_db(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_stop_band_attenuation_db == "60" + design.attributes.asymmetric_low_stop_band_attenuation_db = "40" + assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" + + +def test_asymmetric_high_stop_band_attenuation_db(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_stop_band_attenuation_db == "60" + design.attributes.asymmetric_high_stop_band_attenuation_db = "40" + assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" + + +def test_gaussian_transition(): + design = IdealDesign() + design.filter_type = FilterType.GAUSSIAN + assert len(GaussianTransition) == 6 + for gaussian_transition in GaussianTransition: + design.attributes.gaussian_transition = gaussian_transition + assert design.attributes.gaussian_transition == gaussian_transition + + +def test_gaussian_bessel_reflection(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + assert len(GaussianBesselReflection) == 3 + for gaussian_bessel_reflection in GaussianBesselReflection: + design.attributes.gaussian_bessel_reflection = gaussian_bessel_reflection + assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection + + +def test_even_order(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order + design.attributes.even_order = False + assert design.attributes.even_order is False + + +def test_even_order_refl_zero(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order_refl_zero + design.attributes.even_order_refl_zero = False + assert design.attributes.even_order_refl_zero is False + + +def test_even_order_trn_zero(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order_trn_zero + design.attributes.even_order_trn_zero = False + assert design.attributes.even_order_trn_zero is False + + +def test_constrict_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.constrict_ripple is False + design.attributes.constrict_ripple = True + assert design.attributes.constrict_ripple + + +def test_single_point_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.single_point_ripple is False + design.attributes.single_point_ripple = True + assert design.attributes.single_point_ripple + + +def test_half_band_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.half_band_ripple is False + design.attributes.half_band_ripple = True + assert design.attributes.half_band_ripple + + +def test_constrict_ripple_percent(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.constrict_ripple = True + assert design.attributes.constrict_ripple_percent == "50%" + design.attributes.constrict_ripple_percent = "40%" + assert design.attributes.constrict_ripple_percent == "40%" + + +def test_ripple_constriction_band(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.constrict_ripple = True + assert len(RippleConstrictionBandSelect) == 3 + for ripple_constriction_band in RippleConstrictionBandSelect: + design.attributes.ripple_constriction_band = ripple_constriction_band + assert design.attributes.ripple_constriction_band == ripple_constriction_band + + +def test_single_point_ripple_inf_zeros(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.single_point_ripple = True + assert len(SinglePointRippleInfZeros) == 2 + for single_point_ripple_inf_zeros in SinglePointRippleInfZeros: + design.attributes.single_point_ripple_inf_zeros = single_point_ripple_inf_zeros + assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros + + +def test_delay_equalizer(): + design = IdealDesign() + assert design.attributes.delay_equalizer is False + design.attributes.delay_equalizer = True + assert design.attributes.delay_equalizer + + +def test_delay_equalizer_order(): + design = IdealDesign() + design.attributes.delay_equalizer = True + assert design.attributes.delay_equalizer_order == 2 + + for i in range(0, 21): + design.attributes.delay_equalizer_order = i + assert design.attributes.delay_equalizer_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.delay_equalizer_order = 21 + assert info.value.args[0] == "The maximum order is 20" + + +def test_standard_delay_equ_pass_band_attenuation(): + design = IdealDesign() + design.attributes.delay_equalizer = True + assert design.attributes.standard_delay_equ_pass_band_attenuation + design.attributes.standard_delay_equ_pass_band_attenuation = False + assert design.attributes.standard_delay_equ_pass_band_attenuation is False + + +def test_standard_delay_equ_pass_band_attenuation_value_db(): + design = IdealDesign() + design.attributes.delay_equalizer = True + design.attributes.standard_delay_equ_pass_band_attenuation = False + assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" + design.attributes.standard_delay_equ_pass_band_attenuation_value_db = "4" + assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "4" diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45 FilterSolutions/test_filter/test_dll_interface.py new file mode 100644 index 00000000000..c4b05ceada2 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_dll_interface.py @@ -0,0 +1,19 @@ +import fspy +import pytest +from fspy.filter_design import FilterType +from fspy.ideal_design import IdealDesign + + +def test_string_to_enum(): + assert fspy._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN + + +def test_enum_to_string(): + assert fspy._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" + + +def test_raise_error(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_filter_design.py b/_unittest/test_45 FilterSolutions/test_filter/test_filter_design.py new file mode 100644 index 00000000000..75ead20c190 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_filter_design.py @@ -0,0 +1,83 @@ +import fspy +from fspy.filter_design import DiplexerType +from fspy.filter_design import FilterClass +from fspy.filter_design import FilterDesign +from fspy.filter_design import FilterImplementation +from fspy.filter_design import FilterType + + +def test_version(): + assert fspy.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" + + +def test_filter_type(): + design = FilterDesign() + assert design.filter_type == FilterType.BUTTERWORTH + + assert len(FilterType) == 8 + + for fimp in [FilterImplementation.LUMPED]: + design.filter_implementation = fimp + for ftype in FilterType: + design.filter_type = ftype + assert design.filter_type == ftype + + +def test_filter_class(): + design = FilterDesign() + assert design.filter_implementation == FilterImplementation.LUMPED + + # Only lumped supports all classes + # TODO: Confirm proper exceptions are raised when setting unsupported filter class for each implementation. + + assert len(FilterClass) == 10 + for index, fclass in enumerate(FilterClass): + if index > 5: + design.filter_multiple_bands_enabled = True + design.filter_class = fclass + assert design.filter_class == fclass + + +def test_filter_multiple_bands_enabled(): + design = FilterDesign() + assert design.filter_multiple_bands_enabled is False + design.filter_multiple_bands_enabled = True + assert design.filter_multiple_bands_enabled + + +def test_filter_multiple_bands_low_pass_frequency(): + design = FilterDesign() + design.filter_multiple_bands_enabled = True + design.filter_class = FilterClass.LOW_BAND + assert design.filter_multiple_bands_low_pass_frequency == "1G" + design.filter_multiple_bands_low_pass_frequency = "500M" + assert design.filter_multiple_bands_low_pass_frequency == "500M" + + +def test_filter_multiple_bands_high_pass_frequency(): + design = FilterDesign() + design.filter_multiple_bands_enabled = True + design.filter_class = FilterClass.BAND_HIGH + assert design.filter_multiple_bands_high_pass_frequency == "1G" + design.filter_multiple_bands_high_pass_frequency = "500M" + assert design.filter_multiple_bands_high_pass_frequency == "500M" + + +def test_filter_implementation(): + design = FilterDesign() + assert len(FilterImplementation) == 5 + for fimplementation in FilterImplementation: + design.filter_implementation = fimplementation + assert design.filter_implementation == fimplementation + + +def test_diplexer_type(): + design = FilterDesign() + assert len(DiplexerType) == 6 + for index, diplexer_type in enumerate(DiplexerType): + if index < 3: + design.filter_class = FilterClass.DIPLEXER_1 + elif index > 2: + design.filter_class = FilterClass.DIPLEXER_2 + design.diplexer_type = diplexer_type + assert design.diplexer_type == diplexer_type diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45 FilterSolutions/test_filter/test_graph_setup.py new file mode 100644 index 00000000000..a969ee6b572 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_graph_setup.py @@ -0,0 +1,29 @@ +from fspy.ideal_design import IdealDesign + + +def test_minimum_frequency(): + design = IdealDesign() + assert design.graph_setup.minimum_frequency == "200 MHz" + design.graph_setup.minimum_frequency = "500 MHz" + assert design.graph_setup.minimum_frequency == "500 MHz" + + +def test_maximum_frequency(): + design = IdealDesign() + assert design.graph_setup.maximum_frequency == "5 GHz" + design.graph_setup.maximum_frequency = "2 GHz" + assert design.graph_setup.maximum_frequency == "2 GHz" + + +def test_minimum_time(): + design = IdealDesign() + assert design.graph_setup.minimum_time == "0" + design.graph_setup.minimum_time = "5 ns" + assert design.graph_setup.minimum_time == "5 ns" + + +def test_maximum_time(): + design = IdealDesign() + assert design.graph_setup.maximum_time == "10n" + design.graph_setup.maximum_time = "8 ns" + assert design.graph_setup.maximum_time == "8 ns" diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45 FilterSolutions/test_filter/test_ideal_response.py new file mode 100644 index 00000000000..a939ca906fc --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_ideal_response.py @@ -0,0 +1,326 @@ +from resource import resource_path + +import pytest +from fspy.ideal_design import IdealDesign +from fspy.ideal_response import FrequencyResponseColumn +from fspy.ideal_response import PoleZerosResponseColumn +from fspy.ideal_response import SParametersResponseColumn +from fspy.ideal_response import TimeResponseColumn + + +def test_frequency_response_getter(): + design = IdealDesign() + + mag_db = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_DB) + assert len(mag_db) == 500 + assert mag_db[100] == pytest.approx(-0.0002779395744451339) + assert mag_db[300] == pytest.approx(-14.14973347970826) + assert mag_db[-1] == pytest.approx(-69.61741290615645) + phs_deg = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEG) + assert len(phs_deg) == 500 + assert phs_deg[100] == pytest.approx(-72.00174823521779) + assert phs_deg[300] == pytest.approx(57.235563076374426) + assert phs_deg[-1] == pytest.approx(-52.48142049626833) + grp_dly = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.GROUP_DELAY) + assert len(grp_dly) == 500 + assert grp_dly[100] == pytest.approx(5.476886038520659e-10) + assert grp_dly[300] == pytest.approx(3.6873949391963247e-10) + assert grp_dly[-1] == pytest.approx(2.1202561661746704e-11) + phs_rad = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_RAD) + assert len(phs_rad) == 500 + assert phs_rad[100] == pytest.approx(-1.256667573896567) + assert phs_rad[300] == pytest.approx(0.9989490249156284) + assert phs_rad[-1] == pytest.approx(-0.9159735837835188) + mag_art = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_ARITH) + assert len(mag_art) == 500 + assert mag_art[100] == pytest.approx(0.9999680015359182) + assert mag_art[300] == pytest.approx(0.1961161351381822) + assert mag_art[-1] == pytest.approx(0.000330467956321812) + mag_r = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_REAL) + assert len(mag_r) == 500 + assert mag_r[100] == pytest.approx(0.3089780880159494) + assert mag_r[300] == pytest.approx(0.10613537973464354) + assert mag_r[-1] == pytest.approx(0.00020126115208825366) + mag_x = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_IMAG) + assert len(mag_x) == 500 + assert mag_x[100] == pytest.approx(-0.9510355120718397) + assert mag_x[300] == pytest.approx(0.1649145828303876) + assert mag_x[-1] == pytest.approx(-0.00026211260712835594) + phs_dev_deg = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEV_DEG) + assert len(phs_dev_deg) == 500 + assert phs_dev_deg[100] == pytest.approx(116.73031543331324) + assert phs_dev_deg[300] == pytest.approx(-50.566997975196706) + assert phs_dev_deg[-1] == pytest.approx(67.66973459820802) + phs_dev_rad = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEV_RAD) + assert len(phs_dev_rad) == 500 + assert phs_dev_rad[100] == pytest.approx(2.0373283412028673) + assert phs_dev_rad[300] == pytest.approx(-0.8825606075164885) + assert phs_dev_rad[-1] == pytest.approx(1.181059672689452) + freqs = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.FREQUENCY) + assert len(freqs) == 500 + assert freqs[100] == 2392202091.5388284 + assert freqs[300] == 8669097136.772985 + assert freqs[-1] == 31214328219.225075 + + +def test_time_response_getter(): + design = IdealDesign() + step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) + assert len(step_response) == 300 + assert step_response[100] == pytest.approx(1.0006647872833518) + assert step_response[200] == pytest.approx(0.9999988501385255) + assert step_response[-1] == pytest.approx(0.9999999965045667) + ramp_response = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE) + assert len(ramp_response) == 300 + assert ramp_response[100] == pytest.approx(2.8184497075983895e-09) + assert ramp_response[200] == pytest.approx(6.151630831481296e-09) + assert ramp_response[-1] == pytest.approx(9.45163045223663e-09) + impulse_response = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE) + assert len(impulse_response) == 300 + assert impulse_response[100] == pytest.approx(-8537300.294689251) + assert impulse_response[200] == pytest.approx(-8538.227868086184) + assert impulse_response[-1] == pytest.approx(3.996366349798659) + step_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE_DB) + assert len(step_response_db) == 300 + assert step_response_db[100] == pytest.approx(-1.0381882969997027) + assert step_response_db[200] == pytest.approx(-1.0439706350712086) + assert step_response_db[-1] == pytest.approx(-1.0439606778565478) + ramp_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE_DB) + assert len(ramp_response_db) == 300 + assert ramp_response_db[100] == pytest.approx(-10.540507747401335) + assert ramp_response_db[200] == pytest.approx(-3.7609082425924782) + assert ramp_response_db[-1] == pytest.approx(-0.03057888328183367) + impulse_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE_DB) + assert len(impulse_response_db) == 300 + assert impulse_response_db[100] == pytest.approx(-48.60282519370875) + assert impulse_response_db[200] == pytest.approx(-100.0) + assert impulse_response_db[-1] == pytest.approx(-100.0) + time = design.ideal_response._time_response_getter(TimeResponseColumn.TIME) + assert len(time) == 300 + assert time[1] == pytest.approx(3.3333333333333335e-11) + assert time[200] == pytest.approx(6.666666666666667e-09) + assert time[-1] == pytest.approx(9.966666666666667e-09) + + +def test_sparameters_response_getter(): + design = IdealDesign() + s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) + assert len(s11_response_db) == 500 + assert s11_response_db[100] == pytest.approx(-41.93847819973562) + assert s11_response_db[300] == pytest.approx(-0.1703333929877981) + assert s11_response_db[-1] == pytest.approx(-4.742889883456317e-07) + s21_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_DB) + assert len(s21_response_db) == 500 + assert s21_response_db[100] == pytest.approx(-0.0002779395744451339) + assert s21_response_db[300] == pytest.approx(-14.14973347970826) + assert s21_response_db[-1] == pytest.approx(-69.61741290615645) + s11_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_ARITH) + assert len(s11_response) == 500 + assert s11_response[100] == pytest.approx(0.007999744012287301) + assert s11_response[300] == pytest.approx(0.9805806756909208) + assert s11_response[-1] == pytest.approx(0.9999999453954638) + s21_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_ARITH) + assert len(s21_response) == 500 + assert s21_response[100] == pytest.approx(0.9999680015359182) + assert s21_response[300] == pytest.approx(0.1961161351381822) + assert s21_response[-1] == pytest.approx(0.000330467956321812) + freqs = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.FREQUENCY) + assert len(freqs) == 500 + assert freqs[100] == pytest.approx(2392202091.5388284) + assert freqs[300] == pytest.approx(8669097136.772985) + assert freqs[-1] == pytest.approx(31214328219.225075) + + +def test_pole_zeros_response_getter(): + design = IdealDesign() + pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) + assert len(pole_zero_den_x) == 5 + assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) + assert pole_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert pole_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert pole_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert pole_zero_den_x[4] == pytest.approx(-309016994.3749475) + pole_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_Y) + assert len(pole_zero_den_y) == 5 + assert pole_zero_den_y[0] == pytest.approx(0.0) + assert pole_zero_den_y[1] == pytest.approx(587785252.2924731) + assert pole_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert pole_zero_den_y[3] == pytest.approx(951056516.2951534) + assert pole_zero_den_y[4] == pytest.approx(-951056516.2951534) + pole_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_X) + assert len(pole_zero_num_x) == 0 + pole_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_Y) + assert len(pole_zero_num_y) == 0 + proto_pole_zero_den_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_X + ) + assert len(proto_pole_zero_den_x) == 5 + assert proto_pole_zero_den_x[0] == pytest.approx(-0.30901699437494745) + assert proto_pole_zero_den_x[1] == pytest.approx(-0.30901699437494745) + assert proto_pole_zero_den_x[2] == pytest.approx(-0.8090169943749475) + assert proto_pole_zero_den_x[3] == pytest.approx(-0.8090169943749475) + assert proto_pole_zero_den_x[4] == pytest.approx(-1.0) + proto_pole_zero_den_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_Y + ) + assert len(proto_pole_zero_den_y) == 5 + assert proto_pole_zero_den_y[0] == pytest.approx(0.9510565162951534) + assert proto_pole_zero_den_y[1] == pytest.approx(-0.9510565162951534) + assert proto_pole_zero_den_y[2] == pytest.approx(-0.5877852522924731) + assert proto_pole_zero_den_y[3] == pytest.approx(0.5877852522924731) + assert proto_pole_zero_den_y[4] == pytest.approx(0.0) + proto_pole_zero_num_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_X + ) + assert len(proto_pole_zero_num_x) == 0 + proto_pole_zero_num_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_Y + ) + assert len(proto_pole_zero_num_y) == 0 + rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_X) + assert len(rx_zero_den_x) == 5 + assert rx_zero_den_x[0] == pytest.approx(-1000000000.0) + assert rx_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert rx_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert rx_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert rx_zero_den_x[4] == pytest.approx(-309016994.3749475) + rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_Y) + assert len(rx_zero_den_y) == 5 + assert rx_zero_den_y[0] == pytest.approx(0.0) + assert rx_zero_den_y[1] == pytest.approx(587785252.2924731) + assert rx_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert rx_zero_den_y[3] == pytest.approx(951056516.2951534) + assert rx_zero_den_y[4] == pytest.approx(-951056516.2951534) + rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_X) + assert len(rx_zero_num_x) == 5 + assert rx_zero_num_x[0] == pytest.approx(0.0) + assert rx_zero_num_x[1] == pytest.approx(0.0) + assert rx_zero_num_x[2] == pytest.approx(0.0) + assert rx_zero_num_x[3] == pytest.approx(0.0) + assert rx_zero_num_x[4] == pytest.approx(0.0) + rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_Y) + assert len(rx_zero_num_y) == 5 + assert rx_zero_num_y[0] == pytest.approx(0.0) + assert rx_zero_num_y[1] == pytest.approx(0.0) + assert rx_zero_num_y[2] == pytest.approx(0.0) + assert rx_zero_num_y[3] == pytest.approx(0.0) + assert rx_zero_num_y[4] == pytest.approx(0.0) + proto_rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_X) + assert len(proto_rx_zero_den_x) == 5 + assert proto_rx_zero_den_x[0] == pytest.approx(-0.30901699437494745) + assert proto_rx_zero_den_x[1] == pytest.approx(-0.30901699437494745) + assert proto_rx_zero_den_x[2] == pytest.approx(-0.8090169943749475) + assert proto_rx_zero_den_x[3] == pytest.approx(-0.8090169943749475) + assert proto_rx_zero_den_x[4] == pytest.approx(-1.0) + proto_rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_Y) + assert len(proto_rx_zero_den_y) == 5 + assert proto_rx_zero_den_y[0] == pytest.approx(0.9510565162951534) + assert proto_rx_zero_den_y[1] == pytest.approx(-0.9510565162951534) + assert proto_rx_zero_den_y[2] == pytest.approx(-0.5877852522924731) + assert proto_rx_zero_den_y[3] == pytest.approx(0.5877852522924731) + assert proto_rx_zero_den_y[4] == pytest.approx(0.0) + proto_rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_X) + assert len(proto_rx_zero_num_x) == 5 + assert proto_rx_zero_num_x[0] == pytest.approx(0.0) + assert proto_rx_zero_num_x[1] == pytest.approx(0.0) + assert proto_rx_zero_num_x[2] == pytest.approx(0.0) + assert proto_rx_zero_num_x[3] == pytest.approx(0.0) + assert proto_rx_zero_num_x[4] == pytest.approx(0.0) + proto_rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_Y) + assert len(proto_rx_zero_num_y) == 5 + assert proto_rx_zero_num_y[0] == pytest.approx(0.0) + assert proto_rx_zero_num_y[1] == pytest.approx(0.0) + assert proto_rx_zero_num_y[2] == pytest.approx(0.0) + assert proto_rx_zero_num_y[3] == pytest.approx(0.0) + assert proto_rx_zero_num_y[4] == pytest.approx(0.0) + + +def test_filter_vsg_analysis_enabled(): + design = IdealDesign() + assert design.ideal_response.vsg_analysis_enabled is False + design.ideal_response.vsg_analysis_enabled = True + assert design.ideal_response.vsg_analysis_enabled + + +def test_frequency_response(): + design = IdealDesign() + freq, mag_db = design.ideal_response.frequency_response( + y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + vsg_analysis_enabled=False, + ) + assert len(freq) == 500 + assert freq[100] == pytest.approx(380730787.74317527) + assert freq[300] == pytest.approx(1379729661.4612174) + assert freq[-1] == pytest.approx(4967914631.382509) + assert len(mag_db) == 500 + assert mag_db[100] == pytest.approx(-0.0002779395744451339) + assert mag_db[300] == pytest.approx(-14.14973347970826) + assert mag_db[-1] == pytest.approx(-69.61741290615645) + + +def test_time_response(): + design = IdealDesign() + time, step_response = design.ideal_response.time_response( + y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, + minimum_time="0 ns", + maximum_time="10 ns", + vsg_analysis_enabled=False, + ) + assert len(time) == 300 + assert time[100] == pytest.approx(3.334e-09) + assert time[200] == pytest.approx(6.667e-09) + assert time[-1] == pytest.approx(9.9667e-09) + + assert len(step_response) == 300 + assert step_response[100] == pytest.approx(1.0006647872833518) + assert step_response[200] == pytest.approx(0.9999988501385255) + assert step_response[-1] == pytest.approx(0.9999999965045667) + + +def test_s_parameters(): + design = IdealDesign() + freq, s21_db = design.ideal_response.s_parameters( + y_axis_parameter=SParametersResponseColumn.S21_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + ) + assert len(freq) == 500 + assert freq[100] == pytest.approx(380730787.74317527) + assert freq[300] == pytest.approx(1379729661.4612174) + assert freq[-1] == pytest.approx(4967914631.382509) + assert len(s21_db) == 500 + assert s21_db[100] == pytest.approx(-0.0002779395744451339) + assert s21_db[300] == pytest.approx(-14.14973347970826) + assert s21_db[-1] == pytest.approx(-69.61741290615645) + + +def test_pole_zero_locations(): + design = IdealDesign() + tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( + x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, + y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, + ) + assert len(tx_zero_den_x) == 5 + assert tx_zero_den_x[0] == pytest.approx(-1000000000.0) + assert tx_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert tx_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert tx_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert tx_zero_den_x[4] == pytest.approx(-309016994.3749475) + assert len(tx_zero_den_y) == 5 + assert tx_zero_den_y[0] == pytest.approx(0.0) + assert tx_zero_den_y[1] == pytest.approx(587785252.2924731) + assert tx_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert tx_zero_den_y[3] == pytest.approx(951056516.2951534) + assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) + + +def test_transfer_function_response(): + design = IdealDesign() + list = design.ideal_response.transfer_function_response() + list_file = open(resource_path("transferfunction.ckt")) + lines_list = list.splitlines() + lines_list_file = list_file.readlines() + for i in range(len(lines_list_file)): + assert lines_list_file[i] == lines_list[i] + "\n" diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45 FilterSolutions/test_filter/test_multiple_bands_table.py new file mode 100644 index 00000000000..0393fa9d591 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_multiple_bands_table.py @@ -0,0 +1,67 @@ +import pytest +from fspy.ideal_design import IdealDesign + + +def test_row_count(): + design = IdealDesign() + design.filter_multiple_bands_enabled = True + assert design.multiple_bands_table.row_count == 2 + + +def test_row(): + design = IdealDesign() + design.filter_multiple_bands_enabled = True + assert design.multiple_bands_table.row(0) == ("2G", "3G") + + +def test_update_row(): + design = IdealDesign() + design.filter_multiple_bands_enabled = True + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.update_row(0) + assert info.value.args[0] == "It is not possible to update table with an empty value" + design.multiple_bands_table.update_row(0, lower_frequency="100M") + assert design.multiple_bands_table.row(0) == ("100M", "3G") + design.multiple_bands_table.update_row(0, upper_frequency="4G") + assert design.multiple_bands_table.row(0) == ("100M", "4G") + design.multiple_bands_table.update_row(0, "200M", "5G") + assert design.multiple_bands_table.row(0) == ("200M", "5G") + + +def test_append_row(): + design = IdealDesign() + design.filter_multiple_bands_enabled = True + design.multiple_bands_table.append_row("100M", "500M") + assert design.multiple_bands_table.row_count == 3 + assert design.multiple_bands_table.row(2) == ("100M", "500M") + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.append_row("", "500M") + assert info.value.args[0] == "It is not possible to append an empty value" + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.append_row("100M", "") + assert info.value.args[0] == "It is not possible to append an empty value" + + +def test_insert_row(): + design = IdealDesign() + design.filter_multiple_bands_enabled = True + design.multiple_bands_table.insert_row(0, "200M", "5G") + assert design.multiple_bands_table.row(0) == ("200M", "5G") + design.multiple_bands_table.insert_row(0, lower_frequency="500M", upper_frequency="2G") + assert design.multiple_bands_table.row(0) == ("500M", "2G") + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.insert_row(22, lower_frequency="500M", upper_frequency="2G") + assert info.value.args[0] == "The rowIndex must be greater than zero and less than row count" + + +def test_remove_row(): + design = IdealDesign() + design.filter_multiple_bands_enabled = True + design.multiple_bands_table.remove_row(0) + assert design.multiple_bands_table.row(0) == ("4G", "5G") + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.row(1) + assert ( + info.value.args[0] + == "Either no value is set for this band or the rowIndex must be greater than zero and less than row count" + ) diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45 FilterSolutions/test_filter/test_transmission_zeros.py new file mode 100644 index 00000000000..ee97317a452 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_filter/test_transmission_zeros.py @@ -0,0 +1,112 @@ +import pytest +from fspy.ideal_design import IdealDesign + + +def test_row_count(): + design = IdealDesign() + assert design.transmission_zeros_frequency.row_count == 0 + assert design.transmission_zeros_ratio.row_count == 0 + + +def test_row(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + + +def test_update_row(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.update_row(0, zero="1.3G", position="2") + assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.update_row(0, "1.3", "2") + assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" + + +def test_append_row(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.append_row(zero="", position="") + assert info.value.args[0] == "The input value is blank" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.append_row("", "") + assert info.value.args[0] == "The input value is blank" + design.transmission_zeros_frequency.append_row("1600M") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "") + design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_frequency.append_row(zero="1600M", position="2") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") + design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_ratio.append_row("1.6") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "") + design.transmission_zeros_ratio.clear_row() + design.transmission_zeros_ratio.append_row(zero="1.6", position="2") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") + + +def test_insert_row(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.insert_row(6, zero="1.3G", position="2") + assert info.value.args[0] == "The given index 6 is larger than zeros order" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.insert_row(6, "1.3", "2") + assert info.value.args[0] == "The given index 6 is larger than zeros order" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.insert_row(0, zero="", position="2") + assert info.value.args[0] == "The input value is blank" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.insert_row(0, "", "") + assert info.value.args[0] == "The input value is blank" + design.transmission_zeros_frequency.insert_row(0, "1600M") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "") + design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") + design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_ratio.insert_row(0, "1.6") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "") + design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") + + +def test_remove_row(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.remove_row(2) + assert info.value.args[0] == "The given index 2 is larger than zeros order" + design.transmission_zeros_frequency.append_row(zero="1600M", position="2") + design.transmission_zeros_frequency.remove_row(0) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + + +def test_clear_row(): + design = IdealDesign() + design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") + design.transmission_zeros_frequency.clear_row() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") + design.transmission_zeros_ratio.clear_row() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + + +def test_default_position(): + design = IdealDesign() + design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") + design.transmission_zeros_frequency.default_position() + assert design.transmission_zeros_frequency.row(0) == ("1600M", "3") + design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") + design.transmission_zeros_ratio.default_position() + assert design.transmission_zeros_ratio.row(0) == ("1.6", "3") diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/resource.py b/_unittest/test_45 FilterSolutions/test_lumped_filter/resource.py new file mode 100644 index 00000000000..f5db364f802 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_lumped_filter/resource.py @@ -0,0 +1,12 @@ +import os + + +def resources_driectory(): + dir_path = os.path.dirname(os.path.realpath(__file__)) + test_dir = os.path.dirname(dir_path) + resources_path = os.path.join(test_dir, "resources") + return resources_path + + +def resource_path(resource_file_name): + return os.path.join(resources_driectory(), resource_file_name) diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_implementation.py b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_implementation.py new file mode 100644 index 00000000000..20c82d98719 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_implementation.py @@ -0,0 +1,99 @@ +from resource import resource_path + +from fspy.filter_design import DiplexerType +from fspy.filter_design import FilterClass +from fspy.lumped_design import LumpedDesign + + +def test_lumped_circuit_export(): + lumpdesign = LumpedDesign() + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("netlist.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer1_hi_lo(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.diplexer_type == DiplexerType.HI_LO + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("diplexer1_hi_lo.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer1_bp_1(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.diplexer_type = DiplexerType.BP_1 + assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.diplexer_type == DiplexerType.BP_1 + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("diplexer1_bp_1.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer1_bp_2(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.diplexer_type = DiplexerType.BP_2 + assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.diplexer_type == DiplexerType.BP_2 + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("diplexer1_bp_2.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer2_bp_bs(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.diplexer_type = DiplexerType.BP_BS + assert lumpdesign.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.diplexer_type == DiplexerType.BP_BS + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("diplexer2_bp_bs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer2_triplexer_1(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.diplexer_type = DiplexerType.TRIPLEXER_1 + assert lumpdesign.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.diplexer_type == DiplexerType.TRIPLEXER_1 + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("diplexer2_triplexer_1.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer2_triplexer_2(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.diplexer_type = DiplexerType.TRIPLEXER_2 + assert lumpdesign.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.diplexer_type == DiplexerType.TRIPLEXER_2 + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("diplexer2_triplexer_2.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py new file mode 100644 index 00000000000..3dc71bfe81f --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -0,0 +1,107 @@ +from resource import resource_path + +from fspy.lumped_design import LumpedDesign + + +def test_lumped_c_node_capacitor(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" + lumpdesign.leads_and_nodes.c_node_capacitor = "1n" + assert lumpdesign.leads_and_nodes.c_node_capacitor == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("c_node_capacitor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_c_lead_inductor(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" + lumpdesign.leads_and_nodes.c_lead_inductor = "1n" + assert lumpdesign.leads_and_nodes.c_lead_inductor == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("c_lead_inductor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_l_node_capacitor(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" + lumpdesign.leads_and_nodes.l_node_capacitor = "1n" + assert lumpdesign.leads_and_nodes.l_node_capacitor == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("l_node_capacitor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_l_lead_inductor(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" + lumpdesign.leads_and_nodes.l_lead_inductor = "1n" + assert lumpdesign.leads_and_nodes.l_lead_inductor == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("l_lead_inductor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_r_node_capacitor(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" + lumpdesign.leads_and_nodes.r_node_capacitor = "1n" + assert lumpdesign.leads_and_nodes.r_node_capacitor == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("r_node_capacitor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_r_lead_inductor(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" + lumpdesign.leads_and_nodes.r_lead_inductor = "1n" + assert lumpdesign.leads_and_nodes.r_lead_inductor == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("r_lead_inductor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_c_node_compensate(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.c_node_compensate is False + lumpdesign.leads_and_nodes.c_node_compensate = True + assert lumpdesign.leads_and_nodes.c_node_compensate + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("c_node_compensate.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_l_node_compensate(): + lumpdesign = LumpedDesign() + assert lumpdesign.leads_and_nodes.l_node_compensate is False + lumpdesign.leads_and_nodes.l_node_compensate = True + assert lumpdesign.leads_and_nodes.l_node_compensate + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("l_node_compensate.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_parasitics.py new file mode 100644 index 00000000000..19fa1d276f3 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -0,0 +1,107 @@ +from resource import resource_path + +from fspy.lumped_design import LumpedDesign + + +def test_lumped_capacitor_q(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.capacitor_q == "Inf" + lumpdesign.parasitics.capacitor_q = "100" + assert lumpdesign.parasitics.capacitor_q == "100" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("capacitor_q.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_capacitor_rs(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.capacitor_rs == "0" + lumpdesign.parasitics.capacitor_rs = "1" + assert lumpdesign.parasitics.capacitor_rs == "1" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("capacitor_rs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_capacitor_rp(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.capacitor_rp == "Inf" + lumpdesign.parasitics.capacitor_rp = "1000" + assert lumpdesign.parasitics.capacitor_rp == "1000" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("capacitor_rp.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_capacitor_ls(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.capacitor_ls == "0" + lumpdesign.parasitics.capacitor_ls = "1n" + assert lumpdesign.parasitics.capacitor_ls == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("capacitor_ls.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_inductor_q(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.inductor_q == "Inf" + lumpdesign.parasitics.inductor_q = "100" + assert lumpdesign.parasitics.inductor_q == "100" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("inductor_q.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_inductor_rs(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.inductor_rs == "0" + lumpdesign.parasitics.inductor_rs = "1" + assert lumpdesign.parasitics.inductor_rs == "1" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("inductor_rs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_inductor_rp(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.inductor_rp == "Inf" + lumpdesign.parasitics.inductor_rp = "1000" + assert lumpdesign.parasitics.inductor_rp == "1000" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("inductor_rp.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_inductor_cp(): + lumpdesign = LumpedDesign() + assert lumpdesign.parasitics.inductor_cp == "0" + lumpdesign.parasitics.inductor_cp = "1n" + assert lumpdesign.parasitics.inductor_cp == "1n" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("inductor_cp.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py new file mode 100644 index 00000000000..d891bb8edf5 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -0,0 +1,143 @@ +import pytest +from fspy.lumped_design import LumpedDesign +from fspy.lumped_termination_impedance import ComplexReactanceType +from fspy.lumped_termination_impedance import ComplexTerminationDefinition + + +def test_row_count(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + assert lumpdesign.source_impedance_table.row_count == 3 + assert lumpdesign.load_impedance_table.row_count == 3 + + +def test_row(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + assert lumpdesign.source_impedance_table.row(0) == ("0.100G", "1.000", "0.000") + assert lumpdesign.load_impedance_table.row(0) == ("0.100G", "1.000", "0.000") + + +def test_update_row(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.update_row(0) + assert info.value.args[0] == "There is no input value to update" + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.update_row(0) + assert info.value.args[0] == "There is no input value to update" + lumpdesign.source_impedance_table.update_row(0, "2G", "22", "11") + assert lumpdesign.source_impedance_table.row(0) == ("2G", "22", "11") + lumpdesign.load_impedance_table.update_row(0, "2G", "22", "11") + assert lumpdesign.load_impedance_table.row(0) == ("2G", "22", "11") + lumpdesign.source_impedance_table.update_row(0, frequency="4G") + assert lumpdesign.source_impedance_table.row(0) == ("4G", "22", "11") + lumpdesign.load_impedance_table.update_row(0, frequency="4G") + assert lumpdesign.load_impedance_table.row(0) == ("4G", "22", "11") + lumpdesign.source_impedance_table.update_row(0, "2G", "50", "0") + assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") + lumpdesign.load_impedance_table.update_row(0, "2G", "50", "0") + assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") + + +def test_append_row(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.append_row("100M", "10", "20") + assert lumpdesign.source_impedance_table.row_count == 4 + assert lumpdesign.source_impedance_table.row(3) == ("100M", "10", "20") + lumpdesign.topology.complex_termination = True + lumpdesign.load_impedance_table.append_row("100M", "10", "20") + assert lumpdesign.load_impedance_table.row_count == 4 + assert lumpdesign.load_impedance_table.row(3) == ("100M", "10", "20") + + +def test_insert_row(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.insert_row(0, "2G", "50", "0") + assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") + lumpdesign.load_impedance_table.insert_row(0, "2G", "50", "0") + assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") + + +def test_remove_row(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.remove_row(0) + assert lumpdesign.source_impedance_table.row(0) == ("1.000G", "1.000", "0.000") + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.row(2) + assert info.value.args[0] == "No value is set for this band" + lumpdesign.load_impedance_table.remove_row(0) + assert lumpdesign.load_impedance_table.row(0) == ("1.000G", "1.000", "0.000") + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.row(2) + assert info.value.args[0] == "No value is set for this band" + + +def test_complex_definition(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + assert len(ComplexTerminationDefinition) == 4 + assert lumpdesign.source_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN + for cdef in ComplexTerminationDefinition: + lumpdesign.source_impedance_table.complex_definition = cdef + assert lumpdesign.source_impedance_table.complex_definition == cdef + assert lumpdesign.load_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN + for cdef in ComplexTerminationDefinition: + lumpdesign.load_impedance_table.complex_definition = cdef + assert lumpdesign.load_impedance_table.complex_definition == cdef + + +def test_reactance_type(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + assert len(ComplexReactanceType) == 3 + assert lumpdesign.source_impedance_table.reactance_type == ComplexReactanceType.REAC + for creac in ComplexReactanceType: + lumpdesign.source_impedance_table.reactance_type = creac + assert lumpdesign.source_impedance_table.reactance_type == creac + assert lumpdesign.load_impedance_table.reactance_type == ComplexReactanceType.REAC + for creac in ComplexReactanceType: + lumpdesign.load_impedance_table.reactance_type = creac + assert lumpdesign.load_impedance_table.reactance_type == creac + + +def test_compensation_enabled(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + assert lumpdesign.source_impedance_table.compensation_enabled is False + lumpdesign.source_impedance_table.compensation_enabled = True + assert lumpdesign.source_impedance_table.compensation_enabled + assert lumpdesign.load_impedance_table.compensation_enabled is False + lumpdesign.load_impedance_table.compensation_enabled = True + assert lumpdesign.load_impedance_table.compensation_enabled + + +def test_compensation_order(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.compensation_enabled = True + assert lumpdesign.source_impedance_table.compensation_order == 2 + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.compensation_order = 0 + assert info.value.args[0] == "The minimum impedance compensation order is 1" + for i in range(1, 22): + lumpdesign.source_impedance_table.compensation_order = i + assert lumpdesign.source_impedance_table.compensation_order == i + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.compensation_order = 22 + assert info.value.args[0] == "The maximum impedance compensation order is 21" + lumpdesign.load_impedance_table.compensation_enabled = True + assert lumpdesign.load_impedance_table.compensation_order == 2 + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.compensation_order = 0 + assert info.value.args[0] == "The minimum impedance compensation order is 1" + for i in range(1, 22): + lumpdesign.load_impedance_table.compensation_order = i + assert lumpdesign.load_impedance_table.compensation_order == i + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.compensation_order = 22 + assert info.value.args[0] == "The maximum impedance compensation order is 21" diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_topology.py new file mode 100644 index 00000000000..9574879f918 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -0,0 +1,352 @@ +# from fspy.lumped_termination_impedance import TerminationType +from resource import resource_path + +from fspy.filter_design import DiplexerType +from fspy.filter_design import FilterClass +from fspy.filter_design import FilterType +from fspy.lumped_design import LumpedDesign + + +def test_lumped_generator_resistor_30(): + lumpdesign = LumpedDesign() + assert lumpdesign.topology.generator_resistor == "50" + lumpdesign.topology.generator_resistor = "30" + assert lumpdesign.topology.generator_resistor == "30" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("generator_resistor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_load_resistor_30(): + lumpdesign = LumpedDesign() + assert lumpdesign.topology.load_resistor == "50" + lumpdesign.topology.load_resistor = "30" + assert lumpdesign.topology.load_resistor == "30" + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("laod_resistor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_current_source(): + lumpdesign = LumpedDesign() + assert lumpdesign.topology.current_source is False + lumpdesign.topology.current_source = True + assert lumpdesign.topology.current_source + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("current_source.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_first_shunt(): + lumpdesign = LumpedDesign() + assert lumpdesign.topology.first_shunt + lumpdesign.topology.first_shunt = True + assert lumpdesign.topology.first_shunt + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("first_shunt.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_first_series(): + lumpdesign = LumpedDesign() + assert lumpdesign.topology.first_shunt + lumpdesign.topology.first_shunt = False + assert lumpdesign.topology.first_shunt is False + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("first_series.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_bridge_t(): + lumpdesign = LumpedDesign() + lumpdesign.filter_type = FilterType.ELLIPTIC + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.bridge_t is False + lumpdesign.topology.bridge_t = True + assert lumpdesign.topology.bridge_t + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("bridge_t.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_bridge_t_low(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_1 + assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 + lumpdesign.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.diplexer_type == DiplexerType.HI_LO + lumpdesign.filter_type = FilterType.ELLIPTIC + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.bridge_t_low is False + lumpdesign.topology.bridge_t_low = True + assert lumpdesign.topology.bridge_t_low + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("bridge_t_low.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_bridge_t_high(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.DIPLEXER_1 + assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 + lumpdesign.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.diplexer_type == DiplexerType.HI_LO + lumpdesign.filter_type = FilterType.ELLIPTIC + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.bridge_t_high is False + lumpdesign.topology.bridge_t_high = True + assert lumpdesign.topology.bridge_t_high + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("bridge_t_high.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_equal_inductors(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.equal_inductors is False + lumpdesign.topology.equal_inductors = True + assert lumpdesign.topology.equal_inductors + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("equal_inductors.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_equal_capacitors(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.min_cap is False + assert lumpdesign.topology.equal_capacitors is False + lumpdesign.topology.min_cap = True + lumpdesign.topology.equal_capacitors = True + assert lumpdesign.topology.min_cap + assert lumpdesign.topology.equal_capacitors + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("equal_capacitors.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_equal_legs(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.equal_legs is False + lumpdesign.topology.equal_legs = True + assert lumpdesign.topology.equal_legs + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("equal_legs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_high_low_pass(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.high_low_pass is False + lumpdesign.topology.high_low_pass = True + assert lumpdesign.topology.high_low_pass + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("high_low_pass.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_high_low_pass_min_ind(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.high_low_pass_min_ind is False + lumpdesign.topology.high_low_pass_min_ind = True + assert lumpdesign.topology.high_low_pass_min_ind + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("high_low_pass_min_ind.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_zig_zag(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag is False + lumpdesign.topology.zig_zag = True + assert lumpdesign.topology.zig_zag + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("zig_zag.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_min_ind(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.min_ind + lumpdesign.topology.min_ind = True + assert lumpdesign.topology.min_ind + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("min_ind.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_min_cap(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.min_cap is False + lumpdesign.topology.min_cap = True + assert lumpdesign.topology.min_cap + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("min_cap.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_set_source_res(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + lumpdesign.topology.set_source_res = False + assert lumpdesign.topology.set_source_res is False + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + lumpdesign.topology.set_source_res = True + assert lumpdesign.topology.set_source_res + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("set_source_res.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_trap_topology(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.trap_topology is False + lumpdesign.topology.trap_topology = True + assert lumpdesign.topology.trap_topology + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("trap_topology.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_node_cap_ground(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.filter_type = FilterType.ELLIPTIC + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.node_cap_ground is False + lumpdesign.topology.node_cap_ground = True + assert lumpdesign.topology.node_cap_ground + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("node_cap_ground.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_match_impedance(): + lumpdesign = LumpedDesign() + lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign.topology.generator_resistor = "75" + assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.generator_resistor == "75" + assert lumpdesign.topology.match_impedance is False + lumpdesign.topology.match_impedance = True + assert lumpdesign.topology.match_impedance + netlist = lumpdesign.implementation.circuit_response() + netlist_file = open(resource_path("match_impedance.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_complex_termination(): + lumpdesign = LumpedDesign() + assert lumpdesign.topology.complex_termination is False + lumpdesign.topology.complex_termination = True + assert lumpdesign.topology.complex_termination + + +def test_complex_element_tune_enabled(): + lumpdesign = LumpedDesign() + lumpdesign.topology.complex_termination = True + assert lumpdesign.topology.complex_element_tune_enabled + lumpdesign.topology.complex_element_tune_enabled = False + assert lumpdesign.topology.complex_element_tune_enabled is False diff --git a/_unittest/test_45 FilterSolutions/test_raise_error.py b/_unittest/test_45 FilterSolutions/test_raise_error.py new file mode 100644 index 00000000000..91717719be6 --- /dev/null +++ b/_unittest/test_45 FilterSolutions/test_raise_error.py @@ -0,0 +1,9 @@ +import pytest +from fspy.ideal_design import IdealDesign + + +def test_raise_error(): + design = IdealDesign() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/_unittest/test_46_attributes.py b/_unittest/test_46_attributes.py new file mode 100644 index 00000000000..124cfa8f1b1 --- /dev/null +++ b/_unittest/test_46_attributes.py @@ -0,0 +1,409 @@ +import pytest +from fspy.attributes import BesselRipplePercentage +from fspy.attributes import GaussianBesselReflection +from fspy.attributes import GaussianTransition +from fspy.attributes import PassbandDefinition +from fspy.attributes import RippleConstrictionBandSelect +from fspy.attributes import SinglePointRippleInfZeros +from fspy.attributes import StopbandDefinition +from fspy.filter_design import FilterClass +from fspy.filter_design import FilterType +from fspy.ideal_design import IdealDesign + + +def test_order(): + design = IdealDesign() + assert design.attributes.order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.order = i + assert design.attributes.order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.order = 22 + assert info.value.args[0] == "The maximum order is 21" + + +def test_minimum_order_stop_band_att(): + design = IdealDesign() + assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" + design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" + assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" + + +def test_minimum_order_stop_band_freq(): + design = IdealDesign() + assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" + design.attributes.minimum_order_stop_band_frequency = "500 MHz" + assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" + + +def test_minimum_order(): + design = IdealDesign() + assert design.attributes.order == 5 + design.attributes.ideal_minimum_order + assert design.attributes.order == 3 + + +def test_pass_band_definition(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + assert len(PassbandDefinition) == 2 + assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY + for pbd in PassbandDefinition: + design.attributes.pass_band_definition = pbd + assert design.attributes.pass_band_definition == pbd + + +def test_pass_band_center_frequency(): + design = IdealDesign() + assert design.attributes.pass_band_center_frequency == "1G" + design.attributes.pass_band_center_frequency = "500M" + assert design.attributes.pass_band_center_frequency == "500M" + + +def test_pass_band_frequency(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + assert design.attributes.pass_band_width_frequency == "200M" + design.attributes.pass_band_width_frequency = "500M" + assert design.attributes.pass_band_width_frequency == "500M" + + +def test_lower_frequency(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.lower_frequency == "905 M" + design.attributes.lower_frequency = "800M" + assert design.attributes.lower_frequency == "800M" + + +def test_upper_frequency(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.upper_frequency == "1.105 G" + design.attributes.upper_frequency = "1.2 G" + assert design.attributes.upper_frequency == "1.2 G" + + +def test_stop_band_definition(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert len(StopbandDefinition) == 3 + assert design.attributes.stop_band_definition == StopbandDefinition.RATIO + for sbd in StopbandDefinition: + design.attributes.stop_band_definition = sbd + assert design.attributes.stop_band_definition == sbd + + +def test_stop_band_ratio(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.stop_band_ratio == "1.2" + design.attributes.stop_band_ratio = "1.5" + assert design.attributes.stop_band_ratio == "1.5" + + +def test_stop_band_frequency(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY + assert design.attributes.stop_band_frequency == "1.2 G" + design.attributes.stop_band_frequency = "1.5 G" + assert design.attributes.stop_band_frequency == "1.5 G" + + +def test_stop_band_attenuation(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB + assert design.attributes.stop_band_attenuation_db == "60" + design.attributes.stop_band_attenuation_db = "40 dB" + assert design.attributes.stop_band_attenuation_db == "40" + + +def test_standard_pass_band_attenuation(): + design = IdealDesign() + assert design.attributes.standard_pass_band_attenuation + design.attributes.standard_pass_band_attenuation = False + assert design.attributes.standard_pass_band_attenuation is False + + +def test_standard_pass_band_attenuation_value_db(): + design = IdealDesign() + design.attributes.standard_pass_band_attenuation = False + assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" + design.attributes.standard_pass_band_attenuation_value_db = "4" + assert design.attributes.standard_pass_band_attenuation_value_db == "4" + + +def test_bessel_normalized_delay(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + assert design.attributes.bessel_normalized_delay is False + design.attributes.bessel_normalized_delay = True + assert design.attributes.bessel_normalized_delay + + +def test_bessel_normalized_delay_period(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + design.attributes.bessel_normalized_delay = True + assert design.attributes.bessel_normalized_delay_period == "2" + design.attributes.bessel_normalized_delay_period = "3" + assert design.attributes.bessel_normalized_delay_period == "3" + + +def test_bessel_normalized_delay_percentage(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + design.attributes.bessel_normalized_delay = True + assert len(BesselRipplePercentage) == 6 + for bessel_normalized_delay_percentage in BesselRipplePercentage: + design.attributes.bessel_normalized_delay_percentage = bessel_normalized_delay_percentage + assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage + + +def test_pass_band_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.pass_band_ripple == ".05" + design.attributes.pass_band_ripple = ".03" + assert design.attributes.pass_band_ripple == ".03" + + +def test_arith_symmetry(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.filter_class = FilterClass.BAND_PASS + assert design.attributes.arith_symmetry is False + design.attributes.arith_symmetry = True + assert design.attributes.arith_symmetry + + +def test_asymmetric(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + assert design.attributes.asymmetric is False + design.attributes.asymmetric = True + assert design.attributes.asymmetric + + +def test_asymmetric_low_order(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_low_order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.asymmetric_low_order = i + assert design.attributes.asymmetric_low_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_low_order = 22 + assert info.value.args[0] == "The maximum order is 21" + + +def test_asymmetric_high_order(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_high_order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.asymmetric_high_order = i + assert design.attributes.asymmetric_high_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_high_order = 22 + assert info.value.args[0] == "The maximum order is 21" + + +def test_asymmetric_low_stop_band_ratio(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_stop_band_ratio == "1.2" + design.attributes.asymmetric_low_stop_band_ratio = "1.5" + assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" + + +def test_asymmetric_high_stop_band_ratio(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_stop_band_ratio == "1.2" + design.attributes.asymmetric_high_stop_band_ratio = "1.5" + assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" + + +def test_asymmetric_low_stop_band_attenuation_db(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_stop_band_attenuation_db == "60" + design.attributes.asymmetric_low_stop_band_attenuation_db = "40" + assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" + + +def test_asymmetric_high_stop_band_attenuation_db(): + design = IdealDesign() + design.filter_class = FilterClass.BAND_PASS + design.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_stop_band_attenuation_db == "60" + design.attributes.asymmetric_high_stop_band_attenuation_db = "40" + assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" + + +def test_gaussian_transition(): + design = IdealDesign() + design.filter_type = FilterType.GAUSSIAN + assert len(GaussianTransition) == 6 + for gaussian_transition in GaussianTransition: + design.attributes.gaussian_transition = gaussian_transition + assert design.attributes.gaussian_transition == gaussian_transition + + +def test_gaussian_bessel_reflection(): + design = IdealDesign() + design.filter_type = FilterType.BESSEL + assert len(GaussianBesselReflection) == 3 + for gaussian_bessel_reflection in GaussianBesselReflection: + design.attributes.gaussian_bessel_reflection = gaussian_bessel_reflection + assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection + + +def test_even_order(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order + design.attributes.even_order = False + assert design.attributes.even_order is False + + +def test_even_order_refl_zero(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order_refl_zero + design.attributes.even_order_refl_zero = False + assert design.attributes.even_order_refl_zero is False + + +def test_even_order_trn_zero(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order_trn_zero + design.attributes.even_order_trn_zero = False + assert design.attributes.even_order_trn_zero is False + + +def test_constrict_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.constrict_ripple is False + design.attributes.constrict_ripple = True + assert design.attributes.constrict_ripple + + +def test_single_point_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.single_point_ripple is False + design.attributes.single_point_ripple = True + assert design.attributes.single_point_ripple + + +def test_half_band_ripple(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + assert design.attributes.half_band_ripple is False + design.attributes.half_band_ripple = True + assert design.attributes.half_band_ripple + + +def test_constrict_ripple_percent(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.constrict_ripple = True + assert design.attributes.constrict_ripple_percent == "50%" + design.attributes.constrict_ripple_percent = "40%" + assert design.attributes.constrict_ripple_percent == "40%" + + +def test_ripple_constriction_band(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.constrict_ripple = True + assert len(RippleConstrictionBandSelect) == 3 + for ripple_constriction_band in RippleConstrictionBandSelect: + design.attributes.ripple_constriction_band = ripple_constriction_band + assert design.attributes.ripple_constriction_band == ripple_constriction_band + + +def test_single_point_ripple_inf_zeros(): + design = IdealDesign() + design.filter_type = FilterType.ELLIPTIC + design.attributes.single_point_ripple = True + assert len(SinglePointRippleInfZeros) == 2 + for single_point_ripple_inf_zeros in SinglePointRippleInfZeros: + design.attributes.single_point_ripple_inf_zeros = single_point_ripple_inf_zeros + assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros + + +def test_delay_equalizer(): + design = IdealDesign() + assert design.attributes.delay_equalizer is False + design.attributes.delay_equalizer = True + assert design.attributes.delay_equalizer + + +def test_delay_equalizer_order(): + design = IdealDesign() + design.attributes.delay_equalizer = True + assert design.attributes.delay_equalizer_order == 2 + + for i in range(0, 21): + design.attributes.delay_equalizer_order = i + assert design.attributes.delay_equalizer_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.delay_equalizer_order = 21 + assert info.value.args[0] == "The maximum order is 20" + + +def test_standard_delay_equ_pass_band_attenuation(): + design = IdealDesign() + design.attributes.delay_equalizer = True + assert design.attributes.standard_delay_equ_pass_band_attenuation + design.attributes.standard_delay_equ_pass_band_attenuation = False + assert design.attributes.standard_delay_equ_pass_band_attenuation is False + + +def test_standard_delay_equ_pass_band_attenuation_value_db(): + design = IdealDesign() + design.attributes.delay_equalizer = True + design.attributes.standard_delay_equ_pass_band_attenuation = False + assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" + design.attributes.standard_delay_equ_pass_band_attenuation_value_db = "4" + assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "4" diff --git a/examples/02-HFSS/HFSS_Dipole.py b/examples/02-HFSS/HFSS_Dipole.py index 93700435f3a..7a7b1ff5378 100644 --- a/examples/02-HFSS/HFSS_Dipole.py +++ b/examples/02-HFSS/HFSS_Dipole.py @@ -11,7 +11,6 @@ import os import pyaedt - project_name = pyaedt.generate_unique_project_name(project_name="dipole") ########################################################## @@ -19,7 +18,7 @@ # ~~~~~~~~~~~~~~~~ # Set AEDT version. -aedt_version = "2024.1" +aedt_version = "2024.2" ############################################################################### # Set non-graphical mode @@ -40,9 +39,7 @@ # Launch HFSS # ~~~~~~~~~~~ # Launch HFSS 2023 R2 in graphical mode. - hfss = pyaedt.Hfss(projectname=project_name, solution_type="Modal") - ############################################################################### # Define variable # ~~~~~~~~~~~~~~~ diff --git a/examples/Filtersolutions/filltersolutionsexample.py b/examples/Filtersolutions/filltersolutionsexample.py new file mode 100644 index 00000000000..685a436da8b --- /dev/null +++ b/examples/Filtersolutions/filltersolutionsexample.py @@ -0,0 +1,20 @@ +import pyaedt +import matplotlib.pyplot as plt + +from pyaedt.filtersolutions import FilterClass +from pyaedt.filtersolutions import FilterType +from pyaedt.filtersolutions import FilterImplementation +from pyaedt.filtersolutions import FrequencyResponseColumn +from pyaedt.filtersolutions import DiplexerType +from pyaedt.filtersolutions import StopbandDefinition + + +#if __name__ == "__main__": + +design = pyaedt.FilterSolutions(projectname= "fs1", implementation_type= FilterImplementation.LUMPED) +design.attributes.filter_type = FilterType.ELLIPTIC +design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY +print(design.attributes.stop_band_definition) + + + diff --git a/pyaedt.code-workspace b/pyaedt.code-workspace new file mode 100644 index 00000000000..fd3b45f96dd --- /dev/null +++ b/pyaedt.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "git.ignoreLimitWarning": true + } +} \ No newline at end of file diff --git a/pyaedt/__init__.py b/pyaedt/__init__.py index dbfbf26f363..a95bd73c1f4 100644 --- a/pyaedt/__init__.py +++ b/pyaedt/__init__.py @@ -71,6 +71,7 @@ def custom_show_warning(message, category, filename, lineno, file=None, line=Non from pyaedt.generic.design_types import Desktop from pyaedt.generic.design_types import Edb from pyaedt.generic.design_types import Emit +from pyaedt.generic.design_types import FilterSolutions from pyaedt.generic.design_types import Hfss from pyaedt.generic.design_types import Icepak from pyaedt.generic.design_types import Maxwell2d diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py new file mode 100644 index 00000000000..1e192169b66 --- /dev/null +++ b/pyaedt/filtersolutions.py @@ -0,0 +1,116 @@ +import sys +import pyaedt +import pyaedt.filtersolutions_core +from pyaedt.filtersolutions_core.attributes import Attributes +from pyaedt.filtersolutions_core.attributes import FilterClass +from pyaedt.filtersolutions_core.attributes import FilterType +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.multiple_bands_table import MultipleBandsTable +from pyaedt.filtersolutions_core.ideal_response import FrequencyResponseColumn +from pyaedt.filtersolutions_core.ideal_response import IdealResponse +from pyaedt.filtersolutions_core.graph_setup import GraphSetup +from pyaedt.filtersolutions_core.lumped_nodes_and_leads import LumpedNodesandLeads +from pyaedt.filtersolutions_core.lumped_parasitics import LumpedParasitics +from pyaedt.filtersolutions_core.lumped_termination_impedance import LumpedTerminationImpedance +from pyaedt.filtersolutions_core.lumped_termination_impedance import TerminationType +from pyaedt.filtersolutions_core.lumped_topology import LumpedTopology +from pyaedt.filtersolutions_core.multiple_bands_table import MultipleBandsTable +from pyaedt.filtersolutions_core.transmission_zeros import TableFormat +from pyaedt.filtersolutions_core.transmission_zeros import TransmissionZeros +from pyaedt.filtersolutions_core.attributes import DiplexerType +from pyaedt.filtersolutions_core.attributes import StopbandDefinition + + + +class FilterSolutions(): + """Provides the FilterSolutions application interface. + + This class allows you to create an instance of FilterSolutions and + define the parameters for an ideal filter. + The class has access to ideal filter attributes and calcultaed output parameters. + + Parameters + ---------- + filter_name: str, optional + Name of the filter to select. The default is ``FilterSolutions API Session``. + filter_class: str, optional + The class (band definition) of filter. The full list of classes are listed in FilterClass enum. + The default is `LOW_PASS`. + filter_type: str, optional + The type (mathematical formulation) of filter. The full list of types are listed in FilterType enum. + The default is `BUTTERWORTH`. + + + Examples + -------- + Create an instance of FilterSolutions with a band pass elliptic ideal filter. + + >>> from pyaedt import fspy.ideal_filters + >>> from fspy.filter_design import FilterClass + >>> from fspy.filter_design import FilterType + + >>> design = fspy.ideal_filters.IdealDesign( + >>> filter_name = "filter_design", + >>> filter_class = FilterClass.BAND_PASS, + >>> filter_type = FilterType.ELLIPTIC, + >>> ) + """ + + def __init__( + self, + projectname=None, + implementation_type=None + ): + projectname=projectname + implementation_type=implementation_type + if implementation_type == FilterImplementation.LUMPED: + self._init_lumped_design() + else: + raise RuntimeError("The " + str(implementation_type) + " is not supported on this release.") + + + def _init_lumped_design(self): + """Provides the FilterSolutions application interface. + + This class allows you to create an instance of FilterSolutions and + define the parameters for a lumped filter. The class has access to ideal + and lumped filter attributes and calcultaed output parameters. + + Parameters + ---------- + filter_name: str, optional + Name of the filter to select. The default is ``FilterSolutions API Session``. + filter_class: str, optional + The class (band definition) of filter. The full list of classes are listed in FilterClass enum. + The default is `LOW_PASS`. + filter_type: str, optional + The type (mathematical formulation) of filter. The full list of types are listed in FilterType enum. + The default is `BUTTERWORTH`. + + + Examples + -------- + Create an instance of FilterSolutions with a band pass elliptic lumped filter. + + >>> from pyaedt import fspy.lumped_filters + >>> from fspy.filter_design import FilterClass + >>> from fspy.filter_design import FilterType + + >>> design = fspy.ideal_filters.LumpedDesign( + >>> filter_name = "filter_design", + >>> filter_class = FilterClass.BAND_PASS, + >>> filter_type = FilterType.ELLIPTIC, + >>> ) + """ + + self.attributes = Attributes() + self.ideal_response = IdealResponse() + self.graph_setup = GraphSetup() + self.topology = LumpedTopology() + self.parasitics = LumpedParasitics() + self.leads_and_nodes = LumpedNodesandLeads() + self.source_impedance_table = LumpedTerminationImpedance(TerminationType.SOURCE) + self.load_impedance_table = LumpedTerminationImpedance(TerminationType.LOAD) + self.multiple_bands_table = MultipleBandsTable() + self.transmission_zeros_ratio = TransmissionZeros(TableFormat.RATIO) + self.transmission_zeros_frequency = TransmissionZeros(TableFormat.FREQUENCY) diff --git a/pyaedt/filtersolutions_core/__init__.py b/pyaedt/filtersolutions_core/__init__.py new file mode 100644 index 00000000000..653ae843b1b --- /dev/null +++ b/pyaedt/filtersolutions_core/__init__.py @@ -0,0 +1,16 @@ +import sys + +import fspy.dll_interface + +_this = sys.modules[__name__] +_this._internal_dll_interface = None + + +def _dll_interface() -> fspy.dll_interface.DllInterface: + if _this._internal_dll_interface is None: + _this._internal_dll_interface = fspy.dll_interface.DllInterface(show_gui=False) + return _this._internal_dll_interface + + +def api_version() -> str: + return _dll_interface().api_version() diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py new file mode 100644 index 00000000000..04ec8cadd7a --- /dev/null +++ b/pyaedt/filtersolutions_core/attributes.py @@ -0,0 +1,1378 @@ +from ctypes import POINTER +from ctypes import byref +from ctypes import c_bool +from ctypes import c_char_p +from ctypes import c_int +from enum import Enum + +import pyaedt.filtersolutions_core as fspy + +class FilterType(Enum): + """Selects type of filter with the associated mathematical formulation. + + Attributes: + GAUSSIAN: Represents a Gaussian filter. + BESSEL: Represents a Bessel filter. + BUTTERWORTH: Represents a Butterworth filter. + LEGENDRE: Represents a Legendre filter. + CHEBYSHEV_I: Represents a Chevyshev type I filter. + CHEBYSHEV_II: Represents a Chevyshev type II filter. + HOURGLASS: Represents a Hourglass filter. + ELLIPTIC: Represents a elliptic filter. + Custom, rasied-cos, matched, and delay filter types are not available in this release. + """ + + GAUSSIAN = 0 + BESSEL = 1 + BUTTERWORTH = 2 + LEGENDRE = 3 + CHEBYSHEV_I = 4 + CHEBYSHEV_II = 5 + HOURGLASS = 6 + ELLIPTIC = 7 + + +# CUSTOM = 8 +# RAISED_COS = 9 +# MATCHED = 10 +# DELAY = 11 + + +class FilterClass(Enum): + """Selects class of filter for single band and multiple bands filters. + + Attributes: + LOW_PASS: Represents a low pass filter. + HIGH_PASS: Represents a high pass filter. + DIPLEXER_1: Represents a first group of diplexer filter. + BAND_PASS: Represents a band pass filter. + BAND_STOP: Represents a band stop filter. + DIPLEXER_2: Represents a second group of diplexer filter. + LOW_BAND: Represents a combined low pass and multi band filter. + BAND_HIGH: Represents a combined high pass and multi band filter. + BAND_BAND: Represents a multi band passfilter. + STOP_STOP: Represents a multi band stop filter. + """ + + LOW_PASS = 0 + HIGH_PASS = 1 + DIPLEXER_1 = 2 + BAND_PASS = 3 + BAND_STOP = 4 + DIPLEXER_2 = 5 + LOW_BAND = 6 + BAND_HIGH = 7 + BAND_BAND = 8 + STOP_STOP = 9 + + +class FilterImplementation(Enum): + """Selects implementations type of filter. This release covers only lumped filter technology. + + Attributes: + LUMPED: Represents a lumped implementation. + DISTRIB: Represents a distributed implementation. + ACTIVE: Represents a active implementation. + SWCAP: Represents a switched capacitor implementation. + DIGITAL: Represents a digital implementation. + """ + + LUMPED = 0 + DISTRIB = 1 + ACTIVE = 2 + SWCAP = 3 + DIGITAL = 4 + + +class DiplexerType(Enum): + """Selects topology of diplexers. + + Attributes: + HI_LO: Represents a high pass low pass diplexer type. + BP_1: Represents a band pass band pass diplexer type. + BP_2: Represents a band pass band pass diplexer type. + BP_BS: Represents a band pass band stop diplexer type. + TRIPLEXER_1: Represents a low pass, band pass, and high pass triplexer type. + TRIPLEXER_2: Represents a low pass, band pass, and high pass triplexer type. + """ + + HI_LO = 0 + BP_1 = 1 + BP_2 = 2 + BP_BS = 3 + TRIPLEXER_1 = 4 + TRIPLEXER_2 = 5 + + +class BesselRipplePercentage(Enum): + """Selects peak to peak group delay ripple magnitude as percent of average for Bessl filters. + Attributes: + ZERO: 0% + HALF: 0.5% + ONE: 1% + TWO: 2% + FIVE: 5% + TEN: 10% + """ + + ZERO = 0 + HALF = 1 + ONE = 2 + TWO = 3 + FIVE = 4 + TEN = 5 + + +class GaussianTransition(Enum): + """Selects transition attenuation in dB for Gaussian filters to improve group delay response. + Attributes: + TRANSITION_NONE: 0dB + TRANSITION_3_DB: 3dB + TRANSITION_6_DB: 6dB + TRANSITION_9_DB: 9dB + TRANSITION_12_DB: 12dB + TRANSITION_15_DB: 15dB + """ + + TRANSITION_NONE = 0 + TRANSITION_3_DB = 1 + TRANSITION_6_DB = 2 + TRANSITION_9_DB = 3 + TRANSITION_12_DB = 4 + TRANSITION_15_DB = 5 + + +class GaussianBesselReflection(Enum): + """Selects various synthesis methods for Gaussian and Bessel filters.""" + + OPTION_1 = 0 + OPTION_2 = 1 + OPTION_3 = 2 + + +class RippleConstrictionBandSelect(Enum): + """Selects the bands to apply the constrict ripple parameter. + Attributes: + STOP: stop band + PASS: pass band + BOTH: stop and pass bands + """ + + STOP = 0 + PASS = 1 + BOTH = 2 + + +class SinglePointRippleInfZeros(Enum): + """Selects either 1 or 3 non-infifnite zeros at single frequency point to confine ripple. + Attributes: + RIPPLE_INF_ZEROS_1: 1 zero + RIPPLE_INF_ZEROS_3: 3 zeros + """ + + RIPPLE_INF_ZEROS_1 = 0 + RIPPLE_INF_ZEROS_3 = 1 + + +class PassbandDefinition(Enum): + """Selects type of frequency entries to get either center frequency and bandwidth or corner frequencies.""" + + CENTER_FREQUENCY = 0 + CORNER_FREQUENCIES = 1 + + +class StopbandDefinition(Enum): + """Selects stop band parameter to be compared to pass band.""" + + RATIO = 0 + FREQUENCY = 1 + ATTENUATION_DB = 2 + + +class Attributes: + """Defines attributes and parameters of filters. + + This class allows you to construct all the necessary attributes for the FilterDesign class. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + + Methods + ---------- + _define_attributes_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_attributes_dll_functions() + + def _define_attributes_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.setFilterType.argtype = c_char_p + self._dll.setFilterType.restype = c_int + self._dll.getFilterType.argtypes = [c_char_p, c_int] + self._dll.getFilterType.restype = c_int + + self._dll.setFilterClass.argtype = c_char_p + self._dll.setFilterClass.restype = int + self._dll.getFilterClass.argtypes = [c_char_p, c_int] + self._dll.getFilterClass.restype = int + + self._dll.setFilterImplementation.argtype = c_char_p + self._dll.setFilterImplementation.restype = c_int + self._dll.getFilterImplementation.argtypes = [c_char_p, c_int] + self._dll.getFilterImplementation.restype = c_int + + self._dll.setMultipleBandsEnabled.argtype = c_bool + self._dll.setMultipleBandsEnabled.restype = c_int + self._dll.getMultipleBandsEnabled.argtype = POINTER(c_bool) + self._dll.getMultipleBandsEnabled.restype = c_int + + self._dll.setMultipleBandsLowPassFrequency.argtype = c_char_p + self._dll.setMultipleBandsLowPassFrequency.restype = c_int + self._dll.getMultipleBandsLowPassFrequency.argtypes = [c_char_p, c_int] + self._dll.getMultipleBandsLowPassFrequency.restype = c_int + + self._dll.setMultipleBandsHighPassFrequency.argtype = c_char_p + self._dll.setMultipleBandsHighPassFrequency.restype = c_int + self._dll.getMultipleBandsHighPassFrequency.argtypes = [c_char_p, c_int] + self._dll.getMultipleBandsHighPassFrequency.restype = c_int + + self._dll.setDiplexerType.argtype = c_char_p + self._dll.setDiplexerType.restype = c_int + self._dll.getDiplexerType.argtypes = [c_char_p, c_int] + self._dll.getDiplexerType.restype = c_int + + self._dll.setDiplexerType.argtype = c_char_p + self._dll.setDiplexerType.restype = c_int + self._dll.getDiplexerType.argtypes = [c_char_p, c_int] + self._dll.getDiplexerType.restype = c_int + + self._dll.setOrder.argtype = c_int + self._dll.setOrder.restype = c_int + self._dll.getOrder.argtype = POINTER(c_int) + self._dll.getOrder.restype = c_int + + self._dll.setMinimumOrderStopbandAttenuationdB.argtype = c_char_p + self._dll.setMinimumOrderStopbandAttenuationdB.restype = c_int + self._dll.getMinimumOrderStopbandAttenuationdB.argtypes = [c_char_p, c_int] + self._dll.getMinimumOrderStopbandAttenuationdB.restype = c_int + + self._dll.setMinimumOrderStopbandFrequency.argtype = c_char_p + self._dll.setMinimumOrderStopbandFrequency.restype = c_int + self._dll.getMinimumOrderStopbandFrequency.argtypes = [c_char_p, c_int] + self._dll.getMinimumOrderStopbandFrequency.restype = c_int + + self._dll.setIdealMinimumOrder.argtype = POINTER(c_int) + self._dll.setIdealMinimumOrder.restype = c_int + + self._dll.getErrorMessage.argtypes = [c_char_p, c_int] + self._dll.getErrorMessage.restype = c_int + + self._dll.setPassbandDef.argtype = c_int + self._dll.setPassbandDef.restype = c_int + self._dll.getPassbandDef.argtype = POINTER(c_int) + self._dll.getPassbandDef.restype = c_int + + self._dll.setCenterFrequency.argtype = c_char_p + self._dll.setCenterFrequency.restype = c_int + self._dll.getCenterFrequency.argtypes = [c_char_p, c_int] + self._dll.getCenterFrequency.restype = c_int + + self._dll.setPassbandFrequency.argtype = c_char_p + self._dll.setPassbandFrequency.restype = c_int + self._dll.getPassbandFrequency.argtypes = [c_char_p, c_int] + self._dll.getPassbandFrequency.restype = c_int + + self._dll.setLowerFrequency.argtype = c_char_p + self._dll.setLowerFrequency.restype = c_int + self._dll.getLowerFrequency.argtypes = [c_char_p, c_int] + self._dll.getLowerFrequency.restype = c_int + + self._dll.setUpperFrequency.argtype = c_char_p + self._dll.setUpperFrequency.restype = c_int + self._dll.getUpperFrequency.argtypes = [c_char_p, c_int] + self._dll.getUpperFrequency.restype = c_int + + self._dll.setStopbandDef.argtype = c_int + self._dll.setStopbandDef.restype = c_int + self._dll.getStopbandDef.argtype = POINTER(c_int) + self._dll.getStopbandDef.restype = c_int + + self._dll.setStopbandRatio.argtype = c_char_p + self._dll.setStopbandRatio.restype = c_int + self._dll.getStopbandRatio.argtypes = [c_char_p, c_int] + self._dll.getStopbandRatio.restype = c_int + + self._dll.setStopbandFrequency.argtype = c_char_p + self._dll.setStopbandFrequency.restype = c_int + self._dll.getStopbandFrequency.argtypes = [c_char_p, c_int] + self._dll.getStopbandFrequency.restype = c_int + + self._dll.setStopbandAttenuationdB.argtype = c_char_p + self._dll.setStopbandAttenuationdB.restype = c_int + self._dll.getStopbandAttenuationdB.argtypes = [c_char_p, c_int] + self._dll.getStopbandAttenuationdB.restype = c_int + + self._dll.setStandardCutoffEnabled.argtype = c_bool + self._dll.setStandardCutoffEnabled.restype = c_int + self._dll.getStandardCutoffEnabled.argtype = POINTER(c_bool) + self._dll.getStandardCutoffEnabled.restype = c_int + + self._dll.setCutoffAttenuationdB.argtype = c_char_p + self._dll.setCutoffAttenuationdB.restype = c_int + self._dll.getCutoffAttenuationdB.argtypes = [c_char_p, c_int] + self._dll.getCutoffAttenuationdB.restype = c_int + + self._dll.setBesselNormalizedDelay.argtype = c_bool + self._dll.setBesselNormalizedDelay.restype = c_int + self._dll.getBesselNormalizedDelay.argtype = POINTER(c_bool) + self._dll.getBesselNormalizedDelay.restype = c_int + + self._dll.setBesselEquiRippleDelayPeriod.argtype = c_char_p + self._dll.setBesselEquiRippleDelayPeriod.restype = c_int + self._dll.getBesselEquiRippleDelayPeriod.argtypes = [c_char_p, c_int] + self._dll.getBesselEquiRippleDelayPeriod.restype = c_int + + self._dll.setBesselRipplePercentage.argtype = c_int + self._dll.setBesselRipplePercentage.restype = c_int + self._dll.getBesselRipplePercentage.argtype = POINTER(c_int) + self._dll.getBesselRipplePercentage.restype = c_int + + self._dll.setPassbandRipple.argtype = c_char_p + self._dll.setPassbandRipple.restype = c_int + self._dll.getPassbandRipple.argtypes = [c_char_p, c_int] + self._dll.getPassbandRipple.restype = c_int + + self._dll.setArithSymmetry.argtype = c_bool + self._dll.setArithSymmetry.restype = c_int + self._dll.getArithSymmetry.argtype = POINTER(c_bool) + self._dll.getArithSymmetry.restype = c_int + + self._dll.setAsymmetric.argtype = c_bool + self._dll.setAsymmetric.restype = c_int + self._dll.getAsymmetric.argtype = POINTER(c_bool) + self._dll.getAsymmetric.restype = c_int + + self._dll.setAsymmetricLowOrder.argtype = c_int + self._dll.setAsymmetricLowOrder.restype = c_int + self._dll.getAsymmetricLowOrder.argtype = POINTER(c_int) + self._dll.getAsymmetricLowOrder.restype = c_int + + self._dll.setAsymmetricHighOrder.argtype = c_int + self._dll.setAsymmetricHighOrder.restype = c_int + self._dll.getAsymmetricHighOrder.argtype = POINTER(c_int) + self._dll.getAsymmetricHighOrder.restype = c_int + + self._dll.setAsymmetricLowStopbandRatio.argtype = c_char_p + self._dll.setAsymmetricLowStopbandRatio.restype = c_int + self._dll.getAsymmetricLowStopbandRatio.argtypes = [c_char_p, c_int] + self._dll.getAsymmetricLowStopbandRatio.restype = c_int + + self._dll.setAsymmetricHighStopbandRatio.argtype = c_char_p + self._dll.setAsymmetricHighStopbandRatio.restype = c_int + self._dll.getAsymmetricHighStopbandRatio.argtypes = [c_char_p, c_int] + self._dll.getAsymmetricHighStopbandRatio.restype = c_int + + self._dll.setAsymmetricLowStopbandAttenuationdB.argtype = c_char_p + self._dll.setAsymmetricLowStopbandAttenuationdB.restype = c_int + self._dll.getAsymmetricLowStopbandAttenuationdB.argtypes = [c_char_p, c_int] + self._dll.getAsymmetricLowStopbandAttenuationdB.restype = c_int + + self._dll.setAsymmetricHighStopbandAttenuationdB.argtype = c_char_p + self._dll.setAsymmetricHighStopbandAttenuationdB.restype = c_int + self._dll.getAsymmetricHighStopbandAttenuationdB.argtypes = [c_char_p, c_int] + self._dll.getAsymmetricHighStopbandAttenuationdB.restype = c_int + + self._dll.setGaussianTransition.argtype = c_char_p + self._dll.setGaussianTransition.restype = c_int + self._dll.getGaussianTransition.argtypes = [c_char_p, c_int] + self._dll.getGaussianTransition.restype = c_int + + self._dll.setGaussianBesselReflection.argtype = c_int + self._dll.setGaussianBesselReflection.restype = c_int + self._dll.getGaussianBesselReflection.argtype = POINTER(c_int) + self._dll.getGaussianBesselReflection.restype = c_int + + self._dll.setEvenOrderMode.argtype = c_bool + self._dll.setEvenOrderMode.restype = c_int + self._dll.getEvenOrderMode.argtype = POINTER(c_bool) + self._dll.getEvenOrderMode.restype = c_int + + self._dll.setEvenReflZeroTo0.argtype = c_bool + self._dll.setEvenReflZeroTo0.restype = c_int + self._dll.getEvenReflZeroTo0.argtype = POINTER(c_bool) + self._dll.getEvenReflZeroTo0.restype = c_int + + self._dll.setEvenTrnZeroToInf.argtype = c_bool + self._dll.setEvenTrnZeroToInf.restype = c_int + self._dll.getEvenTrnZeroToInf.argtype = POINTER(c_bool) + self._dll.getEvenTrnZeroToInf.restype = c_int + + self._dll.setConstrictRipple.argtype = c_bool + self._dll.setConstrictRipple.restype = c_int + self._dll.getConstrictRipple.argtype = POINTER(c_bool) + self._dll.getConstrictRipple.restype = c_int + + self._dll.setSinglePointRipple.argtype = c_bool + self._dll.setSinglePointRipple.restype = c_int + self._dll.getSinglePointRipple.argtype = POINTER(c_bool) + self._dll.getSinglePointRipple.restype = c_int + + self._dll.setHalfBandRipple.argtype = c_bool + self._dll.setHalfBandRipple.restype = c_int + self._dll.getHalfBandRipple.argtype = POINTER(c_bool) + self._dll.getHalfBandRipple.restype = c_int + + self._dll.setRippleConstrictionPercent.argtype = c_char_p + self._dll.setRippleConstrictionPercent.restype = c_int + self._dll.getRippleConstrictionPercent.argtypes = [c_char_p, c_int] + self._dll.getRippleConstrictionPercent.restype = c_int + + self._dll.setRippleConstrictionBandSelect.argtype = c_char_p + self._dll.setRippleConstrictionBandSelect.restype = c_int + self._dll.getRippleConstrictionBandSelect.argtypes = [c_char_p, c_int] + self._dll.getRippleConstrictionBandSelect.restype = c_int + + self._dll.setSinglePointRippleNoninfiniteZeros.argtype = c_char_p + self._dll.setSinglePointRippleNoninfiniteZeros.restype = c_int + self._dll.getSinglePointRippleNoninfiniteZeros.argtypes = [c_char_p, c_int] + self._dll.getSinglePointRippleNoninfiniteZeros.restype = c_int + + self._dll.setDelayEqualizer.argtype = c_bool + self._dll.setDelayEqualizer.restype = c_int + self._dll.getDelayEqualizer.argtype = POINTER(c_bool) + self._dll.getDelayEqualizer.restype = c_int + + self._dll.setDelayEqualizerOrder.argtype = c_int + self._dll.setDelayEqualizerOrder.restype = c_int + self._dll.getDelayEqualizerOrder.argtype = POINTER(c_int) + self._dll.getDelayEqualizerOrder.restype = c_int + + self._dll.setStandardDelayEquCut.argtype = c_bool + self._dll.setStandardDelayEquCut.restype = c_int + self._dll.getStandardDelayEquCut.argtype = POINTER(c_bool) + self._dll.getStandardDelayEquCut.restype = c_int + + self._dll.setDelayEquCutoffAttenuationdB.argtype = c_char_p + self._dll.setDelayEquCutoffAttenuationdB.restype = c_int + self._dll.getDelayEquCutoffAttenuationdB.argtypes = [c_char_p, c_int] + self._dll.getDelayEquCutoffAttenuationdB.restype = c_int + + @property + def filter_type(self) -> FilterType: + """The type (mathematical formulation) of filter. The full list of types are listed in FilterType enum. + The default is `BUTTERWORTH`. + + Returns + ------- + :enum:`FilterType` + """ + type_string = self._dll_interface.get_string(self._dll.getFilterType) + return self._dll_interface.string_to_enum(FilterType, type_string) + + @filter_type.setter + def filter_type(self, filter_type: FilterType): + if filter_type: + string_value = self._dll_interface.enum_to_string(filter_type) + self._dll_interface.set_string(self._dll.setFilterType, string_value) + + @property + def filter_class(self) -> FilterClass: + """The class (band definition) of filter. The full list of classes are listed in FilterClass enum. + The default is `LOW_PASS`. + + Returns + ------- + :enum:`FilterClass` + """ + type_string = self._dll_interface.get_string(self._dll.getFilterClass) + return self._dll_interface.string_to_enum(FilterClass, type_string) + + @filter_class.setter + def filter_class(self, filter_class: FilterClass): + if filter_class: + string_value = self._dll_interface.enum_to_string(filter_class) + self._dll_interface.set_string(self._dll.setFilterClass, string_value) + + @property + def filter_implementation(self) -> FilterImplementation: + """The technology used to implement the filter. + The full list of implementations are listed in FilterImplementation enum. + The default is `LUMPED`. + + Returns + ------- + :enum:'FilterImplementation' + """ + type_string = self._dll_interface.get_string(self._dll.getFilterImplementation) + return self._dll_interface.string_to_enum(FilterImplementation, type_string) + + @filter_implementation.setter + def filter_implementation(self, filter_implementation: FilterImplementation): + if filter_implementation: + string_value = self._dll_interface.enum_to_string(filter_implementation) + self._dll_interface.set_string(self._dll.setFilterImplementation, string_value) + + @property + def diplexer_type(self) -> DiplexerType: + """The type of diplexer topology. Only applicable to lumped filters. + The full list of diplexer types are listed in DiplexerType enum. + The default is `HI_LO` for `DIPLEXER_1` filter class. + The default is `BP_BS` for `DIPLEXER_2` filter class. + + Returns + ------- + :enum:`DiplexerType` + """ + type_string = self._dll_interface.get_string(self._dll.getDiplexerType) + return self._dll_interface.string_to_enum(DiplexerType, type_string) + + @diplexer_type.setter + def diplexer_type(self, diplexer_type: DiplexerType): + string_value = self._dll_interface.enum_to_string(diplexer_type) + self._dll_interface.set_string(self._dll.setDiplexerType, string_value) + + @property + def filter_multiple_bands_enabled(self) -> bool: + """Whether to enable the multiple bands table. The default is `False`. + + Returns + ------- + bool + """ + filter_multiple_bands_enabled = c_bool() + status = self._dll.getMultipleBandsEnabled(byref(filter_multiple_bands_enabled)) + fspy._dll_interface().raise_error(status) + return bool(filter_multiple_bands_enabled.value) + + @filter_multiple_bands_enabled.setter + def filter_multiple_bands_enabled(self, filter_multiple_bands_enabled: bool): + status = self._dll.setMultipleBandsEnabled(filter_multiple_bands_enabled) + fspy._dll_interface().raise_error(status) + + @property + def filter_multiple_bands_low_pass_frequency(self) -> str: + """The multiple bands low pass frequency of combined low pass and band pass filters. The default is `1GHz`. + + Returns + ------- + str + """ + filter_multiple_bands_low_pass_freq_string = self._dll_interface.get_string( + self._dll.getMultipleBandsLowPassFrequency + ) + return filter_multiple_bands_low_pass_freq_string + + @filter_multiple_bands_low_pass_frequency.setter + def filter_multiple_bands_low_pass_frequency(self, filter_multiple_bands_low_pass_freq_string): + self._dll_interface.set_string( + self._dll.setMultipleBandsLowPassFrequency, + filter_multiple_bands_low_pass_freq_string, + ) + + @property + def filter_multiple_bands_high_pass_frequency(self) -> str: + """The multiple bands high pass frequency of combined high pass and band pass filters. The default is `1GHz`. + + Returns + ------- + str + """ + filter_multiple_bands_high_pass_freq_string = self._dll_interface.get_string( + self._dll.getMultipleBandsHighPassFrequency + ) + return filter_multiple_bands_high_pass_freq_string + + @filter_multiple_bands_high_pass_frequency.setter + def filter_multiple_bands_high_pass_frequency(self, filter_multiple_bands_high_pass_freq_string): + self._dll_interface.set_string( + self._dll.setMultipleBandsHighPassFrequency, + filter_multiple_bands_high_pass_freq_string, + ) + + @property + def order(self) -> int: + """Order of filter. The default is `5`. + + Returns + ------- + int + """ + order = c_int() + status = self._dll.getOrder(byref(order)) + fspy._dll_interface().raise_error(status) + return int(order.value) + + @order.setter + def order(self, order: int): + status = self._dll.setOrder(order) + fspy._dll_interface().raise_error(status) + + @property + def minimum_order_stop_band_attenuation_db(self) -> str: + """Filter stop band attenuation in dB for calculation of the filter minimum order. + The default is `50`. + + Returns + ------- + str + """ + minimum_order_stop_band_attenuation_db_string = self._dll_interface.get_string( + self._dll.getMinimumOrderStopbandAttenuationdB + ) + return minimum_order_stop_band_attenuation_db_string + + @minimum_order_stop_band_attenuation_db.setter + def minimum_order_stop_band_attenuation_db(self, minimum_order_stop_band_attenuation_db_string): + self._dll_interface.set_string( + self._dll.setMinimumOrderStopbandAttenuationdB, + minimum_order_stop_band_attenuation_db_string, + ) + + @property + def minimum_order_stop_band_frequency(self) -> str: + """Filter stop band frequency for calculation of the filter minimum order. + The default is `10 GHz`. + + Returns + ------- + str + """ + minimum_order_stop_band_frequency_string = self._dll_interface.get_string( + self._dll.getMinimumOrderStopbandFrequency + ) + return minimum_order_stop_band_frequency_string + + @minimum_order_stop_band_frequency.setter + def minimum_order_stop_band_frequency(self, minimum_order_stop_band_frequency_string): + self._dll_interface.set_string( + self._dll.setMinimumOrderStopbandFrequency, + minimum_order_stop_band_frequency_string, + ) + + @property + def ideal_minimum_order(self) -> int: + """Filter minimum order for the defined stop band frequency and attenuation parameters. + + Returns + ------- + int + """ + minimum_order = c_int() + status = self._dll.setIdealMinimumOrder(byref(minimum_order)) + fspy._dll_interface().raise_error(status) + return int(minimum_order.value) + + @property + def pass_band_definition(self) -> PassbandDefinition: + """Pass band frequency entry options. + The default is `CENTER_FREQUENCY`. + + Returns + ------- + :enum: PassbandDefinition + """ + index = c_int() + pass_band_definition = list(PassbandDefinition) + status = self._dll.getPassbandDef(byref(index)) + fspy._dll_interface().raise_error(status) + pass_band_definition = pass_band_definition[index.value] + return pass_band_definition + + @pass_band_definition.setter + def pass_band_definition(self, column: PassbandDefinition): + status = self._dll.setPassbandDef(column.value) + fspy._dll_interface().raise_error(status) + + @property + def pass_band_center_frequency(self) -> str: + """Filter pass band or center frequency. + The default is `1 GHz`. + + Returns + ------- + str + """ + center_freq_string = self._dll_interface.get_string(self._dll.getCenterFrequency) + return center_freq_string + + @pass_band_center_frequency.setter + def pass_band_center_frequency(self, center_freq_string): + self._dll_interface.set_string(self._dll.setCenterFrequency, center_freq_string) + + @property + def pass_band_width_frequency(self) -> str: + """Pass band width frequency for band pass or band stop filters. + The default is `200 MHz`. + + Returns + ------- + str + """ + pass_band_freq_string = self._dll_interface.get_string(self._dll.getPassbandFrequency) + return pass_band_freq_string + + @pass_band_width_frequency.setter + def pass_band_width_frequency(self, pass_band_freq_string): + self._dll_interface.set_string(self._dll.setPassbandFrequency, pass_band_freq_string) + + @property + def lower_frequency(self) -> str: + """Filter lower corner frequency. + The default is `905 MHz`. + + Returns + ------- + str + """ + lower_freq_string = self._dll_interface.get_string(self._dll.getLowerFrequency) + return lower_freq_string + + @lower_frequency.setter + def lower_frequency(self, lower_freq_string): + self._dll_interface.set_string(self._dll.setLowerFrequency, lower_freq_string) + + @property + def upper_frequency(self) -> str: + """Filter upper corner frequency. + The default is `1.105 MHz`. + + Returns + ------- + str + """ + upper_freq_string = self._dll_interface.get_string(self._dll.getUpperFrequency) + return upper_freq_string + + @upper_frequency.setter + def upper_frequency(self, upper_freq_string): + self._dll_interface.set_string(self._dll.setUpperFrequency, upper_freq_string) + + @property + def stop_band_definition(self) -> StopbandDefinition: + """Stop band parameter entry option. + The default is `RATIO`. + + Returns + ------- + :enum: StopbandDefinition + """ + index = c_int() + stop_band_definition = list(StopbandDefinition) + status = self._dll.getStopbandDef(byref(index)) + fspy._dll_interface().raise_error(status) + stop_band_definition = stop_band_definition[index.value] + return stop_band_definition + + @stop_band_definition.setter + def stop_band_definition(self, column: StopbandDefinition): + status = self._dll.setStopbandDef(column.value) + fspy._dll_interface().raise_error(status) + + @property + def stop_band_ratio(self) -> str: + """Filter stop band ratio. + The default is `1.2`. + + Returns + ------- + str + """ + stop_band_ratio_string = self._dll_interface.get_string(self._dll.getStopbandRatio) + return stop_band_ratio_string + + @stop_band_ratio.setter + def stop_band_ratio(self, stop_band_ratio_string): + self._dll_interface.set_string(self._dll.setStopbandRatio, stop_band_ratio_string) + + @property + def stop_band_frequency(self) -> str: + """Filter stop band frequency. + The default is `1.2 GHz`. + + Returns + ------- + str + """ + stop_band_frequency_string = self._dll_interface.get_string(self._dll.getStopbandFrequency) + return stop_band_frequency_string + + @stop_band_frequency.setter + def stop_band_frequency(self, stop_band_frequency_string): + self._dll_interface.set_string(self._dll.setStopbandFrequency, stop_band_frequency_string) + + @property + def stop_band_attenuation_db(self) -> str: + """Filter stop band attenuation in dB. + The default is `60 dB`. + + Returns + ------- + str + """ + stop_band_attenuation_db_string = self._dll_interface.get_string(self._dll.getStopbandAttenuationdB) + return stop_band_attenuation_db_string + + @stop_band_attenuation_db.setter + def stop_band_attenuation_db(self, stop_band_attenuation_db_string): + self._dll_interface.set_string(self._dll.setStopbandAttenuationdB, stop_band_attenuation_db_string) + + @property + def standard_pass_band_attenuation(self) -> bool: + """Filter standard cut status. + The default is `True`. + + Returns + ------- + bool + """ + standard_pass_band_attenuation = c_bool() + status = self._dll.getStandardCutoffEnabled(byref(standard_pass_band_attenuation)) + fspy._dll_interface().raise_error(status) + return bool(standard_pass_band_attenuation.value) + + @standard_pass_band_attenuation.setter + def standard_pass_band_attenuation(self, standard_pass_band_attenuation: bool): + status = self._dll.setStandardCutoffEnabled(standard_pass_band_attenuation) + fspy._dll_interface().raise_error(status) + + @property + def standard_pass_band_attenuation_value_db(self) -> str: + """Filter cut off attenuation in dB. + The default is `3.01 dB`. + + Returns + ------- + str + """ + standard_pass_band_attenuation_value_db_string = self._dll_interface.get_string( + self._dll.getCutoffAttenuationdB + ) + return standard_pass_band_attenuation_value_db_string + + @standard_pass_band_attenuation_value_db.setter + def standard_pass_band_attenuation_value_db(self, standard_pass_band_attenuation_value_db_string): + self._dll_interface.set_string( + self._dll.setCutoffAttenuationdB, + standard_pass_band_attenuation_value_db_string, + ) + + @property + def bessel_normalized_delay(self) -> bool: + """Bessel filter normalized delay status. + The default is `False`. + + Returns + ------- + bool + """ + bessel_normalized_delay = c_bool() + status = self._dll.getBesselNormalizedDelay(byref(bessel_normalized_delay)) + fspy._dll_interface().raise_error(status) + return bool(bessel_normalized_delay.value) + + @bessel_normalized_delay.setter + def bessel_normalized_delay(self, bessel_normalized_delay: bool): + status = self._dll.setBesselNormalizedDelay(bessel_normalized_delay) + fspy._dll_interface().raise_error(status) + + @property + def bessel_normalized_delay_period(self) -> str: + """Bessel filter normalized delay period. + The default is `2`. + + Returns + ------- + str + """ + bessel_normalized_delay_period_string = self._dll_interface.get_string(self._dll.getBesselEquiRippleDelayPeriod) + return bessel_normalized_delay_period_string + + @bessel_normalized_delay_period.setter + def bessel_normalized_delay_period(self, bessel_normalized_delay_period_string): + self._dll_interface.set_string( + self._dll.setBesselEquiRippleDelayPeriod, + bessel_normalized_delay_period_string, + ) + + @property + def bessel_normalized_delay_percentage(self) -> int: + """Bessel filter ripple percentage. + The default is `0`. + + Returns + ------- + int + """ + index = c_int() + bessel_normalized_delay_percentage = list(BesselRipplePercentage) + status = self._dll.getBesselRipplePercentage(byref(index)) + fspy._dll_interface().raise_error(status) + bessel_normalized_delay_percentage_string = bessel_normalized_delay_percentage[index.value] + return bessel_normalized_delay_percentage_string + + @bessel_normalized_delay_percentage.setter + def bessel_normalized_delay_percentage(self, column: BesselRipplePercentage): + status = self._dll.setBesselRipplePercentage(column.value) + fspy._dll_interface().raise_error(status) + + @property + def pass_band_ripple(self) -> str: + """Filter pass band ripple in dB. + The default is `0.05 dB`. + + Returns + ------- + str + """ + pass_band_ripple_string = self._dll_interface.get_string(self._dll.getPassbandRipple) + return pass_band_ripple_string + + @pass_band_ripple.setter + def pass_band_ripple(self, pass_band_ripple_string): + self._dll_interface.set_string(self._dll.setPassbandRipple, pass_band_ripple_string) + + @property + def arith_symmetry(self) -> bool: + """Filter arithmetic symmetry status. + The default is `False`. + + Returns + ------- + bool + """ + arith_symmetry = c_bool() + status = self._dll.getArithSymmetry(byref(arith_symmetry)) + fspy._dll_interface().raise_error(status) + return bool(arith_symmetry.value) + + @arith_symmetry.setter + def arith_symmetry(self, arith_symmetry: bool): + status = self._dll.setArithSymmetry(arith_symmetry) + fspy._dll_interface().raise_error(status) + + @property + def asymmetric(self) -> bool: + """Filter asymmetric status. + The default is `False`. + + Returns + ------- + bool + """ + asymmetric = c_bool() + status = self._dll.getAsymmetric(byref(asymmetric)) + fspy._dll_interface().raise_error(status) + return bool(asymmetric.value) + + @asymmetric.setter + def asymmetric(self, asymmetric: bool): + status = self._dll.setAsymmetric(asymmetric) + fspy._dll_interface().raise_error(status) + + @property + def asymmetric_low_order(self) -> int: + """Filter asymmetry lower frequency order. + The default is `5`. + + Returns + ------- + int + """ + asymmetric_low_order = c_int() + status = self._dll.getAsymmetricLowOrder(byref(asymmetric_low_order)) + fspy._dll_interface().raise_error(status) + return int(asymmetric_low_order.value) + + @asymmetric_low_order.setter + def asymmetric_low_order(self, asymmetric_low_order: int): + status = self._dll.setAsymmetricLowOrder(asymmetric_low_order) + fspy._dll_interface().raise_error(status) + + @property + def asymmetric_high_order(self) -> int: + """Filter asymmetry higher frequency order. + The default is `5`. + + Returns + ------- + int + """ + asymmetric_high_order = c_int() + status = self._dll.getAsymmetricHighOrder(byref(asymmetric_high_order)) + fspy._dll_interface().raise_error(status) + return int(asymmetric_high_order.value) + + @asymmetric_high_order.setter + def asymmetric_high_order(self, asymmetric_high_order: int): + status = self._dll.setAsymmetricHighOrder(asymmetric_high_order) + fspy._dll_interface().raise_error(status) + + @property + def asymmetric_low_stop_band_ratio(self) -> str: + """Filter asymmetry lower stop band ratio. + The default is `1.2`. + + Returns + ------- + str + """ + asymmetric_low_stop_band_ratio_string = self._dll_interface.get_string(self._dll.getAsymmetricLowStopbandRatio) + return asymmetric_low_stop_band_ratio_string + + @asymmetric_low_stop_band_ratio.setter + def asymmetric_low_stop_band_ratio(self, asymmetric_low_stop_band_ratio_string): + self._dll_interface.set_string( + self._dll.setAsymmetricLowStopbandRatio, + asymmetric_low_stop_band_ratio_string, + ) + + @property + def asymmetric_high_stop_band_ratio(self) -> str: + """Filter asymmetry higher stop band ratio. + The default is `1.2`. + + Returns + ------- + str + """ + asymmetric_high_stop_band_ratio_string = self._dll_interface.get_string( + self._dll.getAsymmetricHighStopbandRatio + ) + return asymmetric_high_stop_band_ratio_string + + @asymmetric_high_stop_band_ratio.setter + def asymmetric_high_stop_band_ratio(self, asymmetric_high_stop_band_ratio_string): + self._dll_interface.set_string( + self._dll.setAsymmetricHighStopbandRatio, + asymmetric_high_stop_band_ratio_string, + ) + + @property + def asymmetric_low_stop_band_attenuation_db(self) -> str: + """Filter asymmetry lower stop band attenuation in dB. + The default is `60 dB`. + + Returns + ------- + str + """ + asymmetric_low_stop_band_attenuation_db_string = self._dll_interface.get_string( + self._dll.getAsymmetricLowStopbandAttenuationdB + ) + return asymmetric_low_stop_band_attenuation_db_string + + @asymmetric_low_stop_band_attenuation_db.setter + def asymmetric_low_stop_band_attenuation_db(self, asymmetric_low_stop_band_attenuation_db_string): + self._dll_interface.set_string( + self._dll.setAsymmetricLowStopbandAttenuationdB, + asymmetric_low_stop_band_attenuation_db_string, + ) + + @property + def asymmetric_high_stop_band_attenuation_db(self) -> str: + """Filter asymmetry higher stop band attenuation in dB. + The default is `60 dB`. + + Returns + ------- + str + """ + asymmetric_high_stop_band_attenuation_db_string = self._dll_interface.get_string( + self._dll.getAsymmetricHighStopbandAttenuationdB + ) + return asymmetric_high_stop_band_attenuation_db_string + + @asymmetric_high_stop_band_attenuation_db.setter + def asymmetric_high_stop_band_attenuation_db(self, asymmetric_high_stop_band_attenuation_db_string): + self._dll_interface.set_string( + self._dll.setAsymmetricHighStopbandAttenuationdB, + asymmetric_high_stop_band_attenuation_db_string, + ) + + @property + def gaussian_transition(self) -> GaussianTransition: + """Gaussian filter transition option. + The default is `TRANSITION_NONE`. + + Returns + ------- + :enum: GaussianTransition + """ + type_string = self._dll_interface.get_string(self._dll.getGaussianTransition) + type_string = "TRANSITION_" + type_string + return self._dll_interface.string_to_enum(GaussianTransition, type_string) + + @gaussian_transition.setter + def gaussian_transition(self, gaussian_transition: GaussianTransition): + string_value = self._dll_interface.enum_to_string(gaussian_transition) + self._dll_interface.set_string(self._dll.setGaussianTransition, string_value) + + @property + def gaussian_bessel_reflection(self) -> GaussianBesselReflection: + """Gaussian or Bessel filter reflection option. + The default is `OPTION_1`. + + Returns + ------- + :enum: GaussianBesselReflection + """ + index = c_int() + gaussian_bessel_reflection = list(GaussianBesselReflection) + status = self._dll.getGaussianBesselReflection(byref(index)) + fspy._dll_interface().raise_error(status) + gaussian_bessel_reflection = gaussian_bessel_reflection[index.value] + return gaussian_bessel_reflection + + @gaussian_bessel_reflection.setter + def gaussian_bessel_reflection(self, column: GaussianBesselReflection): + status = self._dll.setGaussianBesselReflection(column.value) + fspy._dll_interface().raise_error(status) + + @property + def even_order(self) -> bool: + """Filter even order mode status for filter with even orders. + The default is `True`. + + Returns + ------- + bool + """ + even_order = c_bool() + status = self._dll.getEvenOrderMode(byref(even_order)) + fspy._dll_interface().raise_error(status) + return bool(even_order.value) + + @even_order.setter + def even_order(self, even_order: bool): + status = self._dll.setEvenOrderMode(even_order) + fspy._dll_interface().raise_error(status) + + @property + def even_order_refl_zero(self) -> bool: + """Filter even order reflection zeros to 0 status. + The default is `True`. + + Returns + ------- + bool + """ + even_order_refl_zero = c_bool() + status = self._dll.getEvenReflZeroTo0(byref(even_order_refl_zero)) + fspy._dll_interface().raise_error(status) + return bool(even_order_refl_zero.value) + + @even_order_refl_zero.setter + def even_order_refl_zero(self, even_order_refl_zero: bool): + status = self._dll.setEvenReflZeroTo0(even_order_refl_zero) + fspy._dll_interface().raise_error(status) + + @property + def even_order_trn_zero(self) -> bool: + """Filter even order reflection zeros to infinite status. + The default is `True`. + + Returns + ------- + bool + """ + even_order_trn_zero = c_bool() + status = self._dll.getEvenTrnZeroToInf(byref(even_order_trn_zero)) + fspy._dll_interface().raise_error(status) + return bool(even_order_trn_zero.value) + + @even_order_trn_zero.setter + def even_order_trn_zero(self, even_order_trn_zero: bool): + status = self._dll.setEvenTrnZeroToInf(even_order_trn_zero) + fspy._dll_interface().raise_error(status) + + @property + def constrict_ripple(self) -> bool: + """Filter equiripple constriction status. + The default is `False`. + + Returns + ------- + bool + """ + constrict_ripple = c_bool() + status = self._dll.getConstrictRipple(byref(constrict_ripple)) + fspy._dll_interface().raise_error(status) + return bool(constrict_ripple.value) + + @constrict_ripple.setter + def constrict_ripple(self, constrict_ripple: bool): + status = self._dll.setConstrictRipple(constrict_ripple) + fspy._dll_interface().raise_error(status) + + @property + def single_point_ripple(self) -> bool: + """Filter ripple confinement to a single frequency point status. + The default is `False`. + + Returns + ------- + bool + """ + single_point_ripple = c_bool() + status = self._dll.getSinglePointRipple(byref(single_point_ripple)) + fspy._dll_interface().raise_error(status) + return bool(single_point_ripple.value) + + @single_point_ripple.setter + def single_point_ripple(self, single_point_ripple: bool): + self._dll.setSinglePointRipple(single_point_ripple) + + @property + def half_band_ripple(self) -> bool: + """Filter ripple with half of the zeros in the given band status. + The default is `False`. + + Returns + ------- + bool + """ + half_band_point_ripple = c_bool() + status = self._dll.getHalfBandRipple(byref(half_band_point_ripple)) + fspy._dll_interface().raise_error(status) + return bool(half_band_point_ripple.value) + + @half_band_ripple.setter + def half_band_ripple(self, half_band_ripple: bool): + status = self._dll.setHalfBandRipple(half_band_ripple) + fspy._dll_interface().raise_error(status) + + @property + def constrict_ripple_percent(self) -> str: + """Filter ripple constriction percentage. + The default is `False`. + + Returns + ------- + str + """ + constrict_ripple_percent_string = self._dll_interface.get_string(self._dll.getRippleConstrictionPercent) + return constrict_ripple_percent_string + + @constrict_ripple_percent.setter + def constrict_ripple_percent(self, constrict_ripple_percent_string): + self._dll_interface.set_string(self._dll.setRippleConstrictionPercent, constrict_ripple_percent_string) + + @property + def ripple_constriction_band(self) -> RippleConstrictionBandSelect: + """Filter ripple constriction band option. + The default is `STOP`. + + Returns + ------- + :enum: RippleConstrictionBandSelect + """ + type_string = self._dll_interface.get_string(self._dll.getRippleConstrictionBandSelect) + return self._dll_interface.string_to_enum(RippleConstrictionBandSelect, type_string) + + @ripple_constriction_band.setter + def ripple_constriction_band(self, ripple_constriction_band: RippleConstrictionBandSelect): + string_value = self._dll_interface.enum_to_string(ripple_constriction_band) + self._dll_interface.set_string(self._dll.setRippleConstrictionBandSelect, string_value) + + @property + def single_point_ripple_inf_zeros(self) -> SinglePointRippleInfZeros: + """Filter number of single point ripple infinite zeros. + The default is `RIPPLE_INF_ZEROS_1`. + + Returns + ------- + :enum: SinglePointRippleInfZeros + """ + type_string = self._dll_interface.get_string(self._dll.getSinglePointRippleNoninfiniteZeros) + type_string = "RIPPLE_INF_ZEROS_" + type_string + return self._dll_interface.string_to_enum(SinglePointRippleInfZeros, type_string) + + @single_point_ripple_inf_zeros.setter + def single_point_ripple_inf_zeros(self, single_point_ripple_inf_zeros: SinglePointRippleInfZeros): + string_value = self._dll_interface.enum_to_string(single_point_ripple_inf_zeros) + self._dll_interface.set_string(self._dll.setSinglePointRippleNoninfiniteZeros, string_value) + + @property + def delay_equalizer(self) -> bool: + """Filter delay equalizer status. + The default is `False`. + + Returns + ------- + bool + """ + delay_equalizer = c_bool() + status = self._dll.getDelayEqualizer(byref(delay_equalizer)) + fspy._dll_interface().raise_error(status) + return bool(delay_equalizer.value) + + @delay_equalizer.setter + def delay_equalizer(self, delay_equalizer: bool): + self._dll.setDelayEqualizer(delay_equalizer) + + @property + def delay_equalizer_order(self) -> int: + """Filter delay equalizer order. + The default is `2`. + + Returns + ------- + int + """ + delay_equalizer_order = c_int() + status = self._dll.getDelayEqualizerOrder(byref(delay_equalizer_order)) + fspy._dll_interface().raise_error(status) + return int(delay_equalizer_order.value) + + @delay_equalizer_order.setter + def delay_equalizer_order(self, delay_equalizer_order: int): + status = self._dll.setDelayEqualizerOrder(delay_equalizer_order) + fspy._dll_interface().raise_error(status) + + @property + def standard_delay_equ_pass_band_attenuation(self) -> bool: + """Filter standard delay equalizer attenuation status. + The default is `True`. + + Returns + ------- + bool + """ + standard_dealy_equ_cut = c_bool() + status = self._dll.getStandardDelayEquCut(byref(standard_dealy_equ_cut)) + fspy._dll_interface().raise_error(status) + return bool(standard_dealy_equ_cut.value) + + @standard_delay_equ_pass_band_attenuation.setter + def standard_delay_equ_pass_band_attenuation(self, standard_delay_equ_pass_band_attenuation: bool): + status = self._dll.setStandardDelayEquCut(standard_delay_equ_pass_band_attenuation) + fspy._dll_interface().raise_error(status) + + @property + def standard_delay_equ_pass_band_attenuation_value_db(self) -> str: + """Filter standard delay equalizer cut Off attenuation in dB. + The default is `3.01 dB`. + + Returns + ------- + str + """ + delay_equcutoff_attenuation_db_string = self._dll_interface.get_string(self._dll.getDelayEquCutoffAttenuationdB) + return delay_equcutoff_attenuation_db_string + + @standard_delay_equ_pass_band_attenuation_value_db.setter + def standard_delay_equ_pass_band_attenuation_value_db( + self, standard_delay_equ_pass_band_attenuation_value_db_string + ): + self._dll_interface.set_string( + self._dll.setDelayEquCutoffAttenuationdB, + standard_delay_equ_pass_band_attenuation_value_db_string, + ) diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py new file mode 100644 index 00000000000..f5e7705bca6 --- /dev/null +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -0,0 +1,155 @@ +import ctypes +import os +import sys +import threading +import time +from enum import Enum +from typing import Callable + + +class DllInterface: + """Interfaces with the FilterSolutions C++ API DLL.""" + + def __init__(self, show_gui=True): + self._init_dll_path() + self._init_dll(show_gui) + + def restore_defaults(self): + """Restore the state of the API, including all options and values, to the initial startup state.""" + status = self._dll.startApplication(self.show_gui) + self.raise_error(status) + + def _init_dll_path(self): + """Set DLL path and print to screen the status of DLL access.""" + relative_path = "../../../../build_output/64Debug/nuhertz/FilterSolutionsAPI.dll" + self.dll_path = os.path.join(os.path.dirname(__file__), relative_path) + if not os.path.isfile(self.dll_path): + self.dll_path = os.path.join( + os.environ["ANSYSEM_ROOT242"], "nuhertz/FilterSolutionsAPI.dll" + ) # pragma: no cover + print("DLL Path:", self.dll_path) + if not os.path.isfile(self.dll_path): + raise RuntimeError(f"The FilterSolutions API DLL was not found at {self.dll_path}") # pragma: no cover + + def _init_dll(self, show_gui): + """Load DLL and initiate application parameters to default values.""" + + self._dll = ctypes.cdll.LoadLibrary(self.dll_path) + self._define_dll_functions() + self.show_gui = show_gui + if show_gui: # pragma: no cover + self._app_thread = threading.Thread(target=self._app_thread_task) + self._app_thread.start() + # TODO: Need some way to confirm that the GUI has completed initialization, + # otherwise some subsequent API calls will fail. For now, sleep a few seconds. + time.sleep(5) + else: + status = self._dll.startApplication(False) + self.raise_error(status) + + print("DLL Loaded:", self.api_version()) + print("API Ready") + print("") + + def _app_thread_task(self): # pragma: no cover + """Print the status of running application thread.""" + print("Starting Application::Run thread") + status = self._dll.startApplication(self.show_gui) + self.raise_error(status) + + def _define_dll_functions(self): + """Define DLL function.""" + self._dll.getVersion.argtypes = [ctypes.c_char_p, ctypes.c_int] + self._dll.getVersion.restype = ctypes.c_int + + def get_string(self, dll_function: Callable, max_size=100) -> str: + """ + Call a DLL function that returns a string. + + Parameters + ---------- + dll_function: Callable + DLL function to be called. It must be a function that returns a string. + max_size: int + The maximum number of string characters to return. This will be used for the string buffer size. + + Returns + ------- + str + The requested string. If 'status' , Error message is returned. + """ + text_buffer = ctypes.create_string_buffer(max_size) + status = dll_function(text_buffer, max_size) + self.raise_error(status) + text = text_buffer.value.decode("utf-8") + return text + + def set_string(self, dll_function: Callable, string: str): + """ + Call a DLL function that sets a string. + + Parameters + ---------- + dll_function: Callable + DLL function to be called. It must be a function that set a string. + string: str + String to be set. + """ + bytes_value = bytes(string, "ascii") + status = dll_function(bytes_value) + self.raise_error(status) + + def string_to_enum(self, enum_type: Enum, string: str) -> Enum: + """ + Convert string to the defined string by Enum. + + Parameters + ---------- + enum_type: Enum + Enum to be called. + string: str + String to be converted. + + Returns + ------- + str + Converted entered string to the Enum string. + """ + fixed_string = string.upper().replace(" ", "_") + return enum_type[fixed_string] + + def enum_to_string(self, enum_value: Enum) -> str: + """ + Convert the defined string by Enum to string. + + Parameters + ---------- + enum_type: Enum + Enum to be called. + string: str + String to be converted. + + Returns + ------- + str + Converted Enum string to the compatible string. + """ + fixed_string = str(enum_value.name).replace("_", " ").lower() + return fixed_string + + def api_version(self) -> str: + """ + Return the version of API. + + Returns + ------- + str + API version. + """ + version = self.get_string(self._dll.getVersion) + return version + + def raise_error(self, error_status): + if error_status != 0: + error_message = self.get_string(self._dll.getErrorMessage, 4096) + raise RuntimeError(error_message) diff --git a/pyaedt/filtersolutions_core/graph_setup.py b/pyaedt/filtersolutions_core/graph_setup.py new file mode 100644 index 00000000000..a79223143fc --- /dev/null +++ b/pyaedt/filtersolutions_core/graph_setup.py @@ -0,0 +1,108 @@ +from ctypes import c_char_p +from ctypes import c_int + +import pyaedt.filtersolutions_core as fspy + + +class GraphSetup: + """Defines minimum and maximum of freuquncy and time parameters of filter responses. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + + Methods + ---------- + _define_graph_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_graph_dll_functions() + + def _define_graph_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.setPlotMinimumFrequency.argtype = c_char_p + self._dll.setPlotMinimumFrequency.restype = c_int + self._dll.getPlotMinimumFrequency.argtypes = [c_char_p, c_int] + self._dll.getPlotMinimumFrequency.restype = c_int + + self._dll.setPlotMaximumFrequency.argtype = c_char_p + self._dll.setPlotMaximumFrequency.restype = c_int + self._dll.getPlotMaximumFrequency.argtypes = [c_char_p, c_int] + self._dll.getPlotMaximumFrequency.restype = c_int + + self._dll.setPlotMinimumTime.argtype = c_char_p + self._dll.setPlotMinimumTime.restype = c_int + self._dll.getPlotMinimumTime.argtypes = [c_char_p, c_int] + self._dll.getPlotMinimumTime.restype = c_int + + self._dll.setPlotMaximumTime.argtype = c_char_p + self._dll.setPlotMaximumTime.restype = c_int + self._dll.getPlotMaximumTime.argtypes = [c_char_p, c_int] + self._dll.getPlotMaximumTime.restype = c_int + + @property + def minimum_frequency(self) -> str: + """Minimum frequency value for exporting frequency and S parameters responses. The default is 200 MHz. + + Returns + ------- + str + """ + min_freq_string = self._dll_interface.get_string(self._dll.getPlotMinimumFrequency) + return min_freq_string + + @minimum_frequency.setter + def minimum_frequency(self, min_freq_string): + self._dll_interface.set_string(self._dll.setPlotMinimumFrequency, min_freq_string) + + @property + def maximum_frequency(self) -> str: + """Maximum frequency value for exporting frequency and S parameters responses. The default is 5 GHz. + + Returns + ------- + str + """ + max_freq_string = self._dll_interface.get_string(self._dll.getPlotMaximumFrequency) + return max_freq_string + + @maximum_frequency.setter + def maximum_frequency(self, max_freq_string): + self._dll_interface.set_string(self._dll.setPlotMaximumFrequency, max_freq_string) + + @property + def minimum_time(self) -> str: + """Minimum time value for exporting time response. The default is 0 s. + + Returns + ------- + str + """ + min_time_string = self._dll_interface.get_string(self._dll.getPlotMinimumTime) + return min_time_string + + @minimum_time.setter + def minimum_time(self, min_time_string): + self._dll_interface.set_string(self._dll.setPlotMinimumTime, min_time_string) + + @property + def maximum_time(self) -> str: + """Maximum time value for exporting time response. The default is 10 ns. + + Returns + ------- + str + """ + max_time_string = self._dll_interface.get_string(self._dll.getPlotMaximumTime) + return max_time_string + + @maximum_time.setter + def maximum_time(self, max_time_string): + self._dll_interface.set_string(self._dll.setPlotMaximumTime, max_time_string) diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py new file mode 100644 index 00000000000..1d3291532bf --- /dev/null +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -0,0 +1,441 @@ +import math +from ctypes import POINTER +from ctypes import byref +from ctypes import c_bool +from ctypes import c_char_p +from ctypes import c_double +from ctypes import c_int +from enum import Enum + +import pyaedt.filtersolutions_core as fspy +from pyaedt.filtersolutions_core.graph_setup import GraphSetup + + +class FrequencyResponseColumn(Enum): + """Selects frequency response parameter. + + Attributes: + MAGNITUDE_DB: Represents the frequency response magnitude in dB. + PHASE_DEG: Represents the frequency response phase in degree. + GROUP_DELAY: Represents the frequency response group delay. + PHASE_RAD: Represents the frequency response phase in radian. + MAGNITUDE_ARITH: Represents the frequency response magnitude. + MAGNITUDE_REAL: Represents the real part of frequency response magnitude . + MAGNITUDE_IMAG: Represents the imaginary part of frequency response magnitude. + PHASE_DEV_DEG: Represents the frequency response phase deviation in degree. + PHASE_DEV_RAD: Represents the frequency response phase deviation in radian. + FREQUENCY: Represents the frequency response frequency parameter. + """ + + MAGNITUDE_DB = 0 + PHASE_DEG = 1 + GROUP_DELAY = 2 + PHASE_RAD = 4 + MAGNITUDE_ARITH = 3 + MAGNITUDE_REAL = 5 + MAGNITUDE_IMAG = 6 + PHASE_DEV_DEG = 7 + PHASE_DEV_RAD = 8 + FREQUENCY = 9 + + +class TimeResponseColumn(Enum): + """Selects time response parameter. + + Attributes: + STEP_RESPONSE: Represents the step time response. + RAMP_RESPONSE: Represents the ramp time response. + IMPULSE_RESPONSE: Represents the impulse time response. + STEP_RESPONSE_DB: Represents the step time response in dB. + RAMP_RESPONSE_DB: Represents the ramp time response in dB. + IMPULSE_RESPONSE_DB: Represents the impulse time response in dB. + TIME: Represents time response the time parameter. + """ + + STEP_RESPONSE = 0 + RAMP_RESPONSE = 1 + IMPULSE_RESPONSE = 2 + STEP_RESPONSE_DB = 3 + RAMP_RESPONSE_DB = 4 + IMPULSE_RESPONSE_DB = 5 + TIME = 6 + + +class SParametersResponseColumn(Enum): + """Selects S parameter. + + Attributes: + S21_DB: Represents the S21 parameter in dB. + S11_DB: Represents the S11 parameter in dB. + S21_ARITH: Represents the S21 parameter. + S11_ARITH: Represents the S11 parameter. + FREQUENCY: Represents the S parameters frequency parameter. + """ + + S21_DB = 0 + S11_DB = 1 + S21_ARITH = 3 + S11_ARITH = 4 + FREQUENCY = 5 + + +class PoleZerosResponseColumn(Enum): + """Selects pole zero x and y coordinates of transmission (TX) or reflection (RX) zeros. + + Attributes: + TX_ZERO_DEN_X: Represents the x coordinate of filter transmission zero denominator. + TX_ZERO_DEN_Y: Represents the y coordinate of filter transmission zero denominator. + PROTO_TX_ZERO_DEN_X: Represents the x coordinate of prototype filter transmission zero denominator. + PROTO_TX_ZERO_DEN_Y: Represents the y coordinate of prototype filter transmission zero denominator. + TX_ZERO_NUM_X: Represents the x coordinate of filter transmission zero numerator. + TX_ZERO_NUM_Y: Represents the y coordinate of filter transmission zero numerator. + PROTO_TX_ZERO_NUM_X: Represents the x coordinate of prototype filter transmission zero numerator. + PROTO_TX_ZERO_NUM_Y: Represents the y coordinate of prototype filter transmission zero numerator. + RX_ZERO_DEN_X: Represents the x coordinate of filter reflection zero denominator. + RX_ZERO_DEN_Y: Represents the y coordinate of filter reflection zero denominator. + PROTO_RX_ZERO_DEN_X: Represents the x coordinate of prototype filter reflection zero denominator. + PROTO_RX_ZERO_DEN_Y: Represents the y coordinate of prototype filter reflection zero denominator. + RX_ZERO_NUM_X: Represents the x coordinate of filter reflection zero numerator. + RX_ZERO_NUM_Y: Represents the y coordinate of filter reflection zero numerator. + PROTO_RX_ZERO_NUM_X: Represents the x coordinate of prototype filter reflection zero numerator. + PROTO_RX_ZERO_NUM_Y: Represents the y coordinate of prototype filter reflection zero numerator. + """ + + TX_ZERO_DEN_X = 0 + TX_ZERO_DEN_Y = 1 + PROTO_TX_ZERO_DEN_X = 2 + PROTO_TX_ZERO_DEN_Y = 3 + TX_ZERO_NUM_X = 4 + TX_ZERO_NUM_Y = 5 + PROTO_TX_ZERO_NUM_X = 6 + PROTO_TX_ZERO_NUM_Y = 7 + RX_ZERO_DEN_X = 8 + RX_ZERO_DEN_Y = 9 + PROTO_RX_ZERO_DEN_X = 10 + PROTO_RX_ZERO_DEN_Y = 11 + RX_ZERO_NUM_X = 12 + RX_ZERO_NUM_Y = 13 + PROTO_RX_ZERO_NUM_X = 14 + PROTO_RX_ZERO_NUM_Y = 15 + + +class IdealResponse: + """Exports the data for available ideal filter responses. + Includes `frequency`, `time`, `S parameters`, `transfer function`, or `pole zero location` responses. + + This class allows you to construct all the necessary ideal response attributes for the FilterDesign class. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + graph_setup: GraphSetup + an instance of GraphSetup class + + Methods + ---------- + _define_response_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_response_dll_functions() + self.graph_setup = GraphSetup() + + def _define_response_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.getIdealFrequencyResponseSize.argtype = POINTER(c_int) + self._dll.getIdealFrequencyResponseSize.restype = c_int + self._dll.getIdealFrequencyResponse.argtypes = [POINTER(c_double), c_int, c_int] + self._dll.getIdealFrequencyResponse.restype = c_int + + self._dll.getIdealTimeResponseSize.argtype = POINTER(c_int) + self._dll.getIdealTimeResponseSize.restype = c_int + self._dll.getIdealTimeResponse.argtypes = [POINTER(c_double), c_int, c_int] + self._dll.getIdealTimeResponse.restype = c_int + + self._dll.getIdealSParamatersResponseSize.argtype = POINTER(c_int) + self._dll.getIdealSParamatersResponseSize.restype = c_int + self._dll.getIdealSParamatersResponse.argtypes = [ + POINTER(c_double), + c_int, + c_int, + ] + self._dll.getIdealSParamatersResponse.restype = c_int + + self._dll.getIdealPoleZerosResponseSize.argtypes = [POINTER(c_int), c_int] + self._dll.getIdealPoleZerosResponseSize.restype = c_int + self._dll.getIdealPoleZerosResponse.argtypes = [POINTER(c_double), c_int, c_int] + self._dll.getIdealPoleZerosResponse.restype = c_int + + self._dll.getIdealTransferFunctionResponseSize.argtype = POINTER(c_int) + self._dll.getIdealTransferFunctionResponseSize.restype = c_int + self._dll.getIdealTransferFunctionResponse.argtypes = [c_char_p, c_int] + self._dll.getIdealTransferFunctionResponse.restype = c_int + + self._dll.setVSGAnalsyis.argtype = c_bool + self._dll.setVSGAnalsyis.restype = c_int + self._dll.getVSGAnalsyis.argtype = POINTER(c_bool) + self._dll.getVSGAnalsyis.restype = c_int + + def _frequency_response_getter(self, column: FrequencyResponseColumn): + """Export the ideal filter frequency response. + + Parameters + ---------- + column: FrequencyResponseColumn + Defined parameter to be exported. + + Returns + ------- + list + The requested parameter array. + """ + size = c_int() + status = self._dll.getIdealFrequencyResponseSize(byref(size)) + fspy._dll_interface().raise_error(status) + array = (c_double * size.value)() + status = self._dll.getIdealFrequencyResponse(array, size.value, column.value) + fspy._dll_interface().raise_error(status) + values = [float(val) for val in array] + return values + + def _time_response_getter(self, column: TimeResponseColumn): + """Export the ideal filter time response. + + Parameters + ---------- + column: TimeResponseColumn + Defined parameter to be exported. + + Returns + ------- + list + The requested parameter array. + """ + size = c_int() + status = self._dll.getIdealTimeResponseSize(byref(size)) + fspy._dll_interface().raise_error(status) + array = (c_double * size.value)() + status = self._dll.getIdealTimeResponse(array, size.value, column.value) + fspy._dll_interface().raise_error(status) + values = [float(val) for val in array] + return values + + def _sparamaters_response_getter(self, column: SParametersResponseColumn): + """Export the ideal filter S parameters response. + + Parameters + ---------- + column: SParametersResponseColumn + Defined parameter to be exported. + + Returns + ------- + list + The requested parameter array. + """ + size = c_int() + status = self._dll.getIdealSParamatersResponseSize(byref(size)) + fspy._dll_interface().raise_error(status) + array = (c_double * size.value)() + status = self._dll.getIdealSParamatersResponse(array, size.value, column.value) + fspy._dll_interface().raise_error(status) + values = [float(val) for val in array] + return values + + def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): + """Export ideal pole zero location parameters. + + Parameters + ---------- + column: PoleZerosResponseColumn + Parameter to be exported. + + Returns + ------- + list + The requested parameter array. + """ + size = c_int() + status = self._dll.getIdealPoleZerosResponseSize(byref(size), column.value) + fspy._dll_interface().raise_error(status) + array = (c_double * size.value)() + status = self._dll.getIdealPoleZerosResponse(array, size.value, column.value) + fspy._dll_interface().raise_error(status) + values = [float(val) for val in array] + return values + + def transfer_function_response(self): + """Export ideal filter transfer function parameters. + + Returns + ------- + list + The requested parameter array. + """ + size = c_int() + status = self._dll.getIdealTransferFunctionResponseSize(byref(size)) + fspy._dll_interface().raise_error(status) + transfer_function_response_string = self._dll_interface.get_string( + self._dll.getIdealTransferFunctionResponse, max_size=size.value + ) + return transfer_function_response_string + + @property + def vsg_analysis_enabled(self) -> bool: + """Whether to include offset due to source resistor in frequency and time responses. The default is ``False``. + + Returns + ------- + bool + """ + + vsg_analysis_enabled = c_bool() + status = self._dll.getVSGAnalsyis(byref(vsg_analysis_enabled)) + fspy._dll_interface().raise_error(status) + return bool(vsg_analysis_enabled.value) + + @vsg_analysis_enabled.setter + def vsg_analysis_enabled(self, filter_vsg_analysis_enabled: bool): + status = self._dll.setVSGAnalsyis(filter_vsg_analysis_enabled) + fspy._dll_interface().raise_error(status) + + def frequency_response( + self, + y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + vsg_analysis_enabled=False, + ): + """Export the ideal filter frequency response for the given parameters. + + Parameters + ---------- + y_axis_parameter: FrequencyResponseColumn, optional + Defined parameter to be exported. The default is frequency response magnitude in dB. + minimum_frequency: str, optional + The default is 200 MHz. + maximum_frequency: str, optional + The default is 5 GHz. + vsg_analysis_enabled: bool, optional + The default is False. + + Returns + ------- + tuple: The tuple contains + list of str: + The defined frequency range. + list of str: + The requested parameter. + """ + self.graph_setup.minimum_frequency = minimum_frequency + self.graph_setup.maximum_frequency = maximum_frequency + self.vsg_analysis_enabled = vsg_analysis_enabled + frequency = self._frequency_response_getter(FrequencyResponseColumn.FREQUENCY) + frequency_hz = [] + for freq in frequency: + frequency_hz.append(freq / (2 * math.pi)) + parameter = self._frequency_response_getter(y_axis_parameter) + return frequency_hz, parameter + + def time_response( + self, + y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, + minimum_time="0 s", + maximum_time="10 ns", + vsg_analysis_enabled=False, + ): + """Export the ideal filter time response for the given parameters. + + Parameters + ---------- + y_axis_parameter: TimeResponseColumn, optional + Defined parameter to be exported. The default is step time response. + minimum_time: str, optional + The default is 0 s. + maximum_time: str, optional + The default is 10 ns. + vsg_analysis_enabled: bool, optional + The default is False. + + Returns + ------- + tuple: The tuple contains + list of str: + The defined range range. + list of str: + The requested parameter. + """ + self.graph_setup.minimum_time = minimum_time + self.graph_setup.maximum_time = maximum_time + self.vsg_analysis_enabled = vsg_analysis_enabled + time = self._time_response_getter(TimeResponseColumn.TIME) + parameter = self._time_response_getter(y_axis_parameter) + return time, parameter + + def s_parameters( + self, + y_axis_parameter=SParametersResponseColumn.S21_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + ): + """Export the ideal filter S parameters response for the given parameters. + + Parameters + ---------- + y_axis_parameter: SParametersResponseColumn, optional + Defined parameter to be exported. The default is S21 parameter response in dB. + minimum_frequency: str, optional + The default is 200 MHz. + maximum_frequency: str, optional + The default is 5 GHz. + vsg_analysis_enabled: bool, optional + The default is False. + + Returns + ------- + tuple: The tuple contains + list of str: + The defined frequency range. + list of str: + The requested parameter. + """ + self.graph_setup.minimum_frequency = minimum_frequency + self.graph_setup.maximum_frequency = maximum_frequency + frequency = self._sparamaters_response_getter(SParametersResponseColumn.FREQUENCY) + frequency_hz = [] + for freq in frequency: + frequency_hz.append(freq / (2 * math.pi)) + parameter = self._sparamaters_response_getter(y_axis_parameter) + return frequency_hz, parameter + + def pole_zero_locations( + self, + x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, + y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, + ): + """Export the ideal pole zero location for the given parameters. + + Parameters + ---------- + x_axis_parameter: PoleZerosResponseColumn, optional + Defined parameter to be exported. The default is x coordinate of filter transmission zero denominator. + y_axis_parameter: PoleZerosResponseColumn, optional + Defined parameter to be exported. The default is y coordinate of filter transmission zero denominator. + + Returns + ------- + tuple: The tuple contains + list of str: + The requested parameter. + list of str: + The requested parameter. + """ + x_parameter = self._pole_zeros_response_getter(x_axis_parameter) + y_parameter = self._pole_zeros_response_getter(y_axis_parameter) + return x_parameter, y_parameter diff --git a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py new file mode 100644 index 00000000000..52ebba8a0ff --- /dev/null +++ b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py @@ -0,0 +1,208 @@ +from ctypes import POINTER +from ctypes import byref +from ctypes import c_bool +from ctypes import c_char_p +from ctypes import c_int + +import pyaedt.filtersolutions_core as fspy + + +class LumpedNodesandLeads: + """Defines attributes of lumped element node capacitor and lead inductor. + + This class allows you to construct all the necessary node capacitor and + lead inductor attributes of lumped elements for the LumpedDesign class. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + + Methods + ---------- + _define_nodes_and_leads_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_nodes_and_leads_dll_functions() + + def _define_nodes_and_leads_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.setLumpedCNodeCapacitor.argtype = c_char_p + self._dll.setLumpedCNodeCapacitor.restype = c_int + self._dll.getLumpedCNodeCapacitor.argtypes = [c_char_p, c_int] + self._dll.getLumpedCNodeCapacitor.restype = c_int + + self._dll.setLumpedCLeadInductor.argtype = c_char_p + self._dll.setLumpedCLeadInductor.restype = c_int + self._dll.getLumpedCLeadInductor.argtypes = [c_char_p, c_int] + self._dll.getLumpedCLeadInductor.restype = c_int + + self._dll.setLumpedLNodeCapacitor.argtype = c_char_p + self._dll.setLumpedLNodeCapacitor.restype = c_int + self._dll.getLumpedLNodeCapacitor.argtypes = [c_char_p, c_int] + self._dll.getLumpedLNodeCapacitor.restype = c_int + + self._dll.setLumpedLLeadInductor.argtype = c_char_p + self._dll.setLumpedLLeadInductor.restype = c_int + self._dll.getLumpedLLeadInductor.argtypes = [c_char_p, c_int] + self._dll.getLumpedLLeadInductor.restype = c_int + + self._dll.setLumpedRNodeCapacitor.argtype = c_char_p + self._dll.setLumpedRNodeCapacitor.restype = c_int + self._dll.getLumpedRNodeCapacitor.argtypes = [c_char_p, c_int] + self._dll.getLumpedRNodeCapacitor.restype = c_int + + self._dll.setLumpedRLeadInductor.argtype = c_char_p + self._dll.setLumpedRLeadInductor.restype = c_int + self._dll.getLumpedRLeadInductor.argtypes = [c_char_p, c_int] + self._dll.getLumpedRLeadInductor.restype = c_int + + self._dll.setLumpedCNodeLedComensate.argtype = c_bool + self._dll.setLumpedCNodeLedComensate.restype = c_int + self._dll.getLumpedCNodeLedComensate.argtype = POINTER(c_bool) + self._dll.getLumpedCNodeLedComensate.restype = c_int + + self._dll.setLumpedLNodeLedComensate.argtype = c_bool + self._dll.setLumpedLNodeLedComensate.restype = c_int + self._dll.getLumpedLNodeLedComensate.argtype = POINTER(c_bool) + self._dll.getLumpedLNodeLedComensate.restype = c_int + + @property + def c_node_capacitor(self) -> str: + """Shunt capacitors value of non ideal capacitors nodes in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + c_node_capacitor = self._dll_interface.get_string(self._dll.getLumpedCNodeCapacitor) + return c_node_capacitor + + @c_node_capacitor.setter + def c_node_capacitor(self, c_node_capacitor): + self._dll_interface.set_string(self._dll.setLumpedCNodeCapacitor, c_node_capacitor) + + @property + def c_lead_inductor(self) -> str: + """Series inductors value of non ideal capacitors leades in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + c_lead_inductor = self._dll_interface.get_string(self._dll.getLumpedCLeadInductor) + return c_lead_inductor + + @c_lead_inductor.setter + def c_lead_inductor(self, c_lead_inductor): + self._dll_interface.set_string(self._dll.setLumpedCLeadInductor, c_lead_inductor) + + @property + def l_node_capacitor(self) -> str: + """Shunt capacitors value of non ideal inductors nodes in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + l_node_capacitor = self._dll_interface.get_string(self._dll.getLumpedLNodeCapacitor) + return l_node_capacitor + + @l_node_capacitor.setter + def l_node_capacitor(self, l_node_capacitor): + self._dll_interface.set_string(self._dll.setLumpedLNodeCapacitor, l_node_capacitor) + + @property + def l_lead_inductor(self) -> str: + """Series inductors value of non ideal inductors leades in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + l_lead_inductor = self._dll_interface.get_string(self._dll.getLumpedLLeadInductor) + return l_lead_inductor + + @l_lead_inductor.setter + def l_lead_inductor(self, l_lead_inductor): + self._dll_interface.set_string(self._dll.setLumpedLLeadInductor, l_lead_inductor) + + @property + def r_node_capacitor(self) -> str: + """Shunt capacitors value of non ideal resistors nodes in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + r_node_capacitor = self._dll_interface.get_string(self._dll.getLumpedRNodeCapacitor) + return r_node_capacitor + + @r_node_capacitor.setter + def r_node_capacitor(self, r_node_capacitor): + self._dll_interface.set_string(self._dll.setLumpedRNodeCapacitor, r_node_capacitor) + + @property + def r_lead_inductor(self) -> str: + """Series inductors value of non ideal resistors leades in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + r_lead_inductor = self._dll_interface.get_string(self._dll.getLumpedRLeadInductor) + return r_lead_inductor + + @r_lead_inductor.setter + def r_lead_inductor(self, r_lead_inductor): + self._dll_interface.set_string(self._dll.setLumpedRLeadInductor, r_lead_inductor) + + @property + def c_node_compensate(self) -> bool: + """Whether to check adjust capacitor values to compensate for node capacitance, when possible. + The default is `False`. + + Returns + ------- + bool + """ + c_node_compensate = c_bool() + status = self._dll.getLumpedCNodeLedComensate(byref(c_node_compensate)) + fspy._dll_interface().raise_error(status) + return bool(c_node_compensate.value) + + @c_node_compensate.setter + def c_node_compensate(self, c_node_compensate: bool): + status = self._dll.setLumpedCNodeLedComensate(c_node_compensate) + fspy._dll_interface().raise_error(status) + + @property + def l_node_compensate(self) -> bool: + """Whether to check adjust inductor values to compensate for lead inductance, when possible. + The default is `False`. + + Returns + ------- + bool + """ + l_node_compensate = c_bool() + status = self._dll.getLumpedLNodeLedComensate(byref(l_node_compensate)) + fspy._dll_interface().raise_error(status) + return bool(l_node_compensate.value) + + @l_node_compensate.setter + def l_node_compensate(self, l_node_compensate: bool): + status = self._dll.setLumpedLNodeLedComensate(l_node_compensate) + fspy._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/lumped_parasitics.py b/pyaedt/filtersolutions_core/lumped_parasitics.py new file mode 100644 index 00000000000..71337290e20 --- /dev/null +++ b/pyaedt/filtersolutions_core/lumped_parasitics.py @@ -0,0 +1,199 @@ +from ctypes import c_char_p +from ctypes import c_int + +import pyaedt.filtersolutions_core as fspy + + +class LumpedParasitics: + """Defines attributes of lumped element parasitics. + + This class allows you to construct all the necessary parasitics + attributes of lumped elements for the LumpedDesign class. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + + Methods + ---------- + _define_parasitics_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_parasitics_dll_functions() + + def _define_parasitics_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.setLumpedCapacitorQ.argtype = c_char_p + self._dll.setLumpedCapacitorQ.restype = c_int + self._dll.getLumpedCapacitorQ.argtypes = [c_char_p, c_int] + self._dll.getLumpedCapacitorQ.restype = c_int + + self._dll.setLumpedCapacitorRs.argtype = c_char_p + self._dll.setLumpedCapacitorRs.restype = c_int + self._dll.getLumpedCapacitorRs.argtypes = [c_char_p, c_int] + self._dll.getLumpedCapacitorRs.restype = c_int + + self._dll.setLumpedCapacitorRp.argtype = c_char_p + self._dll.setLumpedCapacitorRp.restype = c_int + self._dll.getLumpedCapacitorRp.argtypes = [c_char_p, c_int] + self._dll.getLumpedCapacitorRp.restype = c_int + + self._dll.setLumpedCapacitorLs.argtype = c_char_p + self._dll.setLumpedCapacitorLs.restype = c_int + self._dll.getLumpedCapacitorLs.argtypes = [c_char_p, c_int] + self._dll.getLumpedCapacitorLs.restype = c_int + + self._dll.setLumpedInductorQ.argtype = c_char_p + self._dll.setLumpedInductorQ.restype = c_int + self._dll.getLumpedInductorQ.argtypes = [c_char_p, c_int] + self._dll.getLumpedInductorQ.restype = c_int + + self._dll.setLumpedInductorRs.argtype = c_char_p + self._dll.setLumpedInductorRs.restype = c_int + self._dll.getLumpedInductorRs.argtypes = [c_char_p, c_int] + self._dll.getLumpedInductorRs.restype = c_int + + self._dll.setLumpedInductorRp.argtype = c_char_p + self._dll.setLumpedInductorRp.restype = c_int + self._dll.getLumpedInductorRp.argtypes = [c_char_p, c_int] + self._dll.getLumpedInductorRp.restype = c_int + + self._dll.setLumpedInductorCp.argtype = c_char_p + self._dll.setLumpedInductorCp.restype = c_int + self._dll.getLumpedInductorCp.argtypes = [c_char_p, c_int] + self._dll.getLumpedInductorCp.restype = c_int + + @property + def capacitor_q(self) -> str: + """Q factor value of non ideal capacitors in synthesized circuit + The default is `infinite`. + + Returns + ------- + str + """ + capacitor_q_string = self._dll_interface.get_string(self._dll.getLumpedCapacitorQ) + return capacitor_q_string + + @capacitor_q.setter + def capacitor_q(self, capacitor_q_string): + self._dll_interface.set_string(self._dll.setLumpedCapacitorQ, capacitor_q_string) + + @property + def capacitor_rs(self) -> str: + """Series resistor value of non ideal capacitors in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + capacitor_rs_string = self._dll_interface.get_string(self._dll.getLumpedCapacitorRs) + return capacitor_rs_string + + @capacitor_rs.setter + def capacitor_rs(self, capacitor_rs_string): + self._dll_interface.set_string(self._dll.setLumpedCapacitorRs, capacitor_rs_string) + + @property + def capacitor_rp(self) -> str: + """Shunt resistor value of non ideal capacitors in synthesized circuit + The default is `infinite`. + + Returns + ------- + str + """ + capacitor_rp_string = self._dll_interface.get_string(self._dll.getLumpedCapacitorRp) + return capacitor_rp_string + + @capacitor_rp.setter + def capacitor_rp(self, capacitor_rp_string): + self._dll_interface.set_string(self._dll.setLumpedCapacitorRp, capacitor_rp_string) + + @property + def capacitor_ls(self) -> str: + """Series inductance value of non ideal capacitors in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + capacitor_ls_string = self._dll_interface.get_string(self._dll.getLumpedCapacitorLs) + return capacitor_ls_string + + @capacitor_ls.setter + def capacitor_ls(self, capacitor_ls_string): + self._dll_interface.set_string(self._dll.setLumpedCapacitorLs, capacitor_ls_string) + + @property + def inductor_q(self) -> str: + """Q factor value of non ideal inductors in synthesized circuit + The default is `infinite`. + + Returns + ------- + str + """ + inductor_q_string = self._dll_interface.get_string(self._dll.getLumpedInductorQ) + return inductor_q_string + + @inductor_q.setter + def inductor_q(self, inductor_q_string): + self._dll_interface.set_string(self._dll.setLumpedInductorQ, inductor_q_string) + + @property + def inductor_rs(self) -> str: + """Series resistor value of non ideal inductors in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + inductor_rs_string = self._dll_interface.get_string(self._dll.getLumpedInductorRs) + return inductor_rs_string + + @inductor_rs.setter + def inductor_rs(self, inductor_rs_string): + self._dll_interface.set_string(self._dll.setLumpedInductorRs, inductor_rs_string) + + @property + def inductor_rp(self) -> str: + """Shunt resistor value of non ideal inductors in synthesized circuit + The default is `infinite`. + + Returns + ------- + str + """ + inductor_rp_string = self._dll_interface.get_string(self._dll.getLumpedInductorRp) + return inductor_rp_string + + @inductor_rp.setter + def inductor_rp(self, inductor_rp_string): + self._dll_interface.set_string(self._dll.setLumpedInductorRp, inductor_rp_string) + + @property + def inductor_cp(self) -> str: + """Shunt capacitor value of non ideal inductors in synthesized circuit + The default is `0`. + + Returns + ------- + str + """ + inductor_cp_string = self._dll_interface.get_string(self._dll.getLumpedInductorCp) + return inductor_cp_string + + @inductor_cp.setter + def inductor_cp(self, inductor_cp_string): + self._dll_interface.set_string(self._dll.setLumpedInductorCp, inductor_cp_string) diff --git a/pyaedt/filtersolutions_core/lumped_termination_impedance.py b/pyaedt/filtersolutions_core/lumped_termination_impedance.py new file mode 100644 index 00000000000..32910454f21 --- /dev/null +++ b/pyaedt/filtersolutions_core/lumped_termination_impedance.py @@ -0,0 +1,382 @@ +from ctypes import POINTER +from ctypes import byref +from ctypes import c_bool +from ctypes import c_char_p +from ctypes import c_int +from ctypes import create_string_buffer +from enum import Enum + +import pyaedt.filtersolutions_core as fspy + + +class ComplexTerminationDefinition(Enum): + """Selects type of complex presentation. + Attributes: + POLAR: Represents polar definition. + CARTESIAN: Represents Cartesian definition. + PARALLEL: Represents parallel definition with real entry parallel to imaginary entry. + REAL: Represents only real impedance definition. + """ + + POLAR = 0 + CARTESIAN = 1 + PARALLEL = 2 + REAL = 3 + + +class ComplexReactanceType(Enum): + """Selects type of complex impedance as reactance, equivalent inductance, or equivalent capacitqnce. + + Attributes: + REAC: Represents pure reactance of complex impedance. + IND: Represents equivalent inductance in Henrys. + CAP: Represents equivalent capacitance in Farads. + """ + + REAC = 0 + IND = 1 + CAP = 2 + + +class TerminationType(Enum): + """Selects either source or load complex impedance table. + + Attributes: + SOURCE: Represents source impedenace table. + LOAD: Represents load impedenace table. + """ + + SOURCE = 0 + LOAD = 1 + + +class LumpedTerminationImpedance: + """Manipulates access to the entries of source and load complex impedance tables. + + This class allows you to enter, edit or remove the entries of source and load complex impedance tables. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + table_type: TerminationType + Whether selects source or load complex impedance table. + + Methods + ---------- + _define_termination_impedance_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self, table_type): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_termination_impedance_dll_functions() + self.table_type = table_type + + def _define_termination_impedance_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.getComplexTableRowCount.argtypes = [POINTER(c_int), c_bool] + self._dll.getComplexTableRowCount.restype = c_int + + self._dll.getComplexTableRow.argtypes = [ + c_int, + c_char_p, + c_char_p, + c_char_p, + c_bool, + c_int, + ] + self._dll.getComplexTableRow.restype = c_int + + self._dll.updateComplexTableRow.argtypes = [ + c_int, + c_char_p, + c_char_p, + c_char_p, + c_bool, + ] + self._dll.updateComplexTableRow.restype = c_int + + self._dll.appendComplexTableRow.argtypes = [ + c_char_p, + c_char_p, + c_char_p, + c_bool, + ] + self._dll.appendComplexTableRow.restype = c_int + + self._dll.insertComplexTableRow.argtypes = [ + c_int, + c_char_p, + c_char_p, + c_char_p, + c_bool, + ] + self._dll.insertComplexTableRow.restype = c_int + + self._dll.removeComplexTableRow.argtypes = [c_int, c_bool] + self._dll.removeComplexTableRow.restype = c_int + + self._dll.setLumpedComplexDefinition.argtypes = [c_char_p, c_bool] + self._dll.setLumpedComplexDefinition.restype = c_int + self._dll.getLumpedComplexDefinition.argtypes = [c_char_p, c_bool, c_int] + self._dll.getLumpedComplexDefinition.restype = c_int + + self._dll.setLumpedComplexReactanceType.argtypes = [c_char_p, c_bool] + self._dll.setLumpedComplexReactanceType.restype = c_int + self._dll.getLumpedComplexReactanceType.argtypes = [c_char_p, c_bool, c_int] + self._dll.getLumpedComplexReactanceType.restype = c_int + + self._dll.setLumpedComplexImpCompensateEnabled.argtypes = [c_bool, c_bool] + self._dll.setLumpedComplexImpCompensateEnabled.restype = c_int + self._dll.getLumpedComplexImpCompensateEnabled.argtypes = [ + POINTER(c_bool), + c_bool, + ] + self._dll.getLumpedComplexImpCompensateEnabled.restype = c_int + + self._dll.setLumpedComplexCompOrder.argtypes = [c_int, c_bool] + self._dll.setLumpedComplexCompOrder.restype = c_int + self._dll.getLumpedComplexCompOrder.argtypes = [POINTER(c_int), c_bool] + self._dll.getLumpedComplexCompOrder.restype = c_int + + def table_type_to_bool(self): + """Set a flag to recognize source and load complex tables. + + Returns + ------- + bool + """ + if self.table_type.value == TerminationType.SOURCE.value: + return False + else: + return True + + @property + def row_count(self) -> int: + """The count of accumulated complex impedances in the complex impedances tables. + The default is `3`. + + Returns + ------- + int + """ + table_row_count = c_int() + status = self._dll.getComplexTableRowCount(byref(table_row_count), self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + return int(table_row_count.value) + + def row(self, row_index): + """Export frequencies and complex impedances at given index of the complex impedances tables. + + Parameters + ---------- + row_index: int + The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + + Returns + ------- + tuple: The tuple contains + str: + Frequency value. + str: + First term of the complex impedances. + str: + Second term of the complex impedances. + """ + frequency_value_buffer = create_string_buffer(100) + real_value_buffer = create_string_buffer(100) + imag_value_buffer = create_string_buffer(100) + status = self._dll.getComplexTableRow( + row_index, + frequency_value_buffer, + real_value_buffer, + imag_value_buffer, + self.table_type_to_bool(), + 100, + ) + fspy._dll_interface().raise_error(status) + frequency_value_string = frequency_value_buffer.value.decode("utf-8") + real_value_string = real_value_buffer.value.decode("utf-8") + imag_value_string = imag_value_buffer.value.decode("utf-8") + return frequency_value_string, real_value_string, imag_value_string + + def update_row(self, row_index, frequency="", real="", imag=""): + """Update frequencies and complex impedances at given index of the complex impedances tables. + + Parameters + ---------- + row_index: int + The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + frequency: str, optional + The default is blank. + real: str, optional + First term of the complex impedances. + The default is blank. + imag: str, optional + Second term of the complex impedances. + The default is blank. + """ + frequency_bytes_value = bytes(frequency, "ascii") + real_bytes_value = bytes(real, "ascii") + imag_bytes_value = bytes(imag, "ascii") + status = self._dll.updateComplexTableRow( + row_index, + frequency_bytes_value, + real_bytes_value, + imag_bytes_value, + self.table_type_to_bool(), + ) + fspy._dll_interface().raise_error(status) + + def append_row(self, frequency, real, imag): + """Append frequencies and complex impedances at the end row of the source and load complex tables. + + Parameters + ---------- + frequency: str + real: str + First term of the complex impedances. + imag: str + Second term of the complex impedances. + """ + frequency_bytes_value = bytes(frequency, "ascii") + real_bytes_value = bytes(real, "ascii") + imag_bytes_value = bytes(imag, "ascii") + status = self._dll.appendComplexTableRow( + frequency_bytes_value, + real_bytes_value, + imag_bytes_value, + self.table_type_to_bool(), + ) + fspy._dll_interface().raise_error(status) + + def insert_row(self, row_index, frequency, real, imag): + """Insert frequencies and complex impedances at given index of the complex impedances tables. + + Parameters + ---------- + row_index: int + The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + frequency: str + real: str + First term of the complex impedances. + imag: str + Second term of the complex impedances. + """ + frequency_bytes_value = bytes(frequency, "ascii") + real_bytes_value = bytes(real, "ascii") + imag_bytes_value = bytes(imag, "ascii") + status = self._dll.insertComplexTableRow( + row_index, + frequency_bytes_value, + real_bytes_value, + imag_bytes_value, + self.table_type_to_bool(), + ) + fspy._dll_interface().raise_error(status) + + def remove_row(self, row_index): + """Remove frequencies and complex impedances at given indexof the complex impedances tables. + + Parameters + ---------- + row_index: int + The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + """ + status = self._dll.removeComplexTableRow(row_index, self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + + @property + def complex_definition(self) -> ComplexTerminationDefinition: + """The definition type of complex impedances in the complex impedance tables. + The default is `Cartesian`. + + Returns + ------- + :enum: ComplexTerminationDefinition + """ + type_string_buffer = create_string_buffer(100) + status = self._dll.getLumpedComplexDefinition( + type_string_buffer, + self.table_type_to_bool(), + 100, + ) + fspy._dll_interface().raise_error(status) + type_string = type_string_buffer.value.decode("utf-8") + return self._dll_interface.string_to_enum(ComplexTerminationDefinition, type_string) + + @complex_definition.setter + def complex_definition(self, complex_definition: ComplexTerminationDefinition): + string_value = self._dll_interface.enum_to_string(complex_definition) + string_bytes_value = bytes(string_value, "ascii") + status = self._dll.setLumpedComplexDefinition(string_bytes_value, self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + + @property + def reactance_type(self) -> ComplexReactanceType: + """The reactance type of complex impedances in the complex impedance tables. + The default is `reactance`. + + Returns + ------- + :enum: ComplexReactanceType + """ + + type_string_buffer = create_string_buffer(100) + status = self._dll.getLumpedComplexReactanceType( + type_string_buffer, + self.table_type_to_bool(), + 100, + ) + fspy._dll_interface().raise_error(status) + type_string = type_string_buffer.value.decode("utf-8") + return self._dll_interface.string_to_enum(ComplexReactanceType, type_string) + + @reactance_type.setter + def reactance_type(self, reactance_type: ComplexReactanceType): + string_value = self._dll_interface.enum_to_string(reactance_type) + string_bytes_value = bytes(string_value, "ascii") + status = self._dll.setLumpedComplexReactanceType(string_bytes_value, self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + + @property + def compensation_enabled(self) -> bool: + """Whether to enable the impedance compnesation option. + The default is `False`. + + Returns + ------- + bool + """ + compensation_enabled = c_bool() + status = self._dll.getLumpedComplexImpCompensateEnabled(byref(compensation_enabled), self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + return bool(compensation_enabled.value) + + @compensation_enabled.setter + def compensation_enabled(self, compensation_enabled: bool): + status = self._dll.setLumpedComplexImpCompensateEnabled(compensation_enabled, self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + + @property + def compensation_order(self) -> int: + """The order of impedance compnesation. + The default is `2`. + + Returns + ------- + int + """ + compensation_order = c_int() + status = self._dll.getLumpedComplexCompOrder(byref(compensation_order), self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) + return int(compensation_order.value) + + @compensation_order.setter + def compensation_order(self, compensation_order: int): + status = self._dll.setLumpedComplexCompOrder(compensation_order, self.table_type_to_bool()) + fspy._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py new file mode 100644 index 00000000000..cc9f10846a1 --- /dev/null +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -0,0 +1,546 @@ +from ctypes import POINTER +from ctypes import byref +from ctypes import c_bool +from ctypes import c_char_p +from ctypes import c_int + +import pyaedt.filtersolutions_core as fspy + + +class LumpedTopology: + """Defines attributes and parameters of lumped filters.""" + + """Defines attributes of lumped element parasitics. + + This class allows you to construct all the necessary attributes for the LumpedDesign class. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + + Methods + ---------- + _define_topology_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_topology_dll_functions() + + def _define_topology_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.setLumpedGeneratorResistor.argtype = c_char_p + self._dll.setLumpedGeneratorResistor.restype = c_int + self._dll.getLumpedGeneratorResistor.argtypes = [c_char_p, c_int] + self._dll.getLumpedGeneratorResistor.restype = c_int + + self._dll.setLumpedLoadResistor.argtype = c_char_p + self._dll.setLumpedLoadResistor.restype = c_int + self._dll.getLumpedLoadResistor.argtypes = [c_char_p, c_int] + self._dll.getLumpedLoadResistor.restype = c_int + + self._dll.setLumpedCurrentSource.argtype = c_bool + self._dll.setLumpedCurrentSource.restype = c_int + self._dll.getLumpedCurrentSource.argtype = POINTER(c_bool) + self._dll.getLumpedCurrentSource.restype = c_int + + self._dll.setLumpedFirstElementShunt.argtype = c_bool + self._dll.setLumpedFirstElementShunt.restype = c_int + self._dll.getLumpedFirstElementShunt.argtype = POINTER(c_bool) + self._dll.getLumpedFirstElementShunt.restype = c_int + + self._dll.setLumpedBridgeT.argtype = c_bool + self._dll.setLumpedBridgeT.restype = c_int + self._dll.getLumpedBridgeT.argtype = POINTER(c_bool) + self._dll.getLumpedBridgeT.restype = c_int + + self._dll.setLumpedBridgeTLow.argtype = c_bool + self._dll.setLumpedBridgeTLow.restype = c_int + self._dll.getLumpedBridgeTLow.argtype = POINTER(c_bool) + self._dll.getLumpedBridgeTLow.restype = c_int + + self._dll.setLumpedBridgeTHigh.argtype = c_bool + self._dll.setLumpedBridgeTHigh.restype = c_int + self._dll.getLumpedBridgeTHigh.argtype = POINTER(c_bool) + self._dll.getLumpedBridgeTHigh.restype = c_int + + self._dll.setLumpedEqualInductors.argtype = c_bool + self._dll.setLumpedEqualInductors.restype = c_int + self._dll.getLumpedEqualInductors.argtype = POINTER(c_bool) + self._dll.getLumpedEqualInductors.restype = c_int + + self._dll.setLumpedEqualCapacitors.argtype = c_bool + self._dll.setLumpedEqualCapacitors.restype = c_int + self._dll.getLumpedEqualCapacitors.argtype = POINTER(c_bool) + self._dll.getLumpedEqualCapacitors.restype = c_int + + self._dll.setLumpedEqualLegs.argtype = c_bool + self._dll.setLumpedEqualLegs.restype = c_int + self._dll.getLumpedEqualLegs.argtype = POINTER(c_bool) + self._dll.getLumpedEqualLegs.restype = c_int + + self._dll.setLumpedHighLowPass.argtype = c_bool + self._dll.setLumpedHighLowPass.restype = c_int + self._dll.getLumpedHighLowPass.argtype = POINTER(c_bool) + self._dll.getLumpedHighLowPass.restype = c_int + + self._dll.setLumpedHighLowPassMinInd.argtype = c_bool + self._dll.setLumpedHighLowPassMinInd.restype = c_int + self._dll.getLumpedHighLowPassMinInd.argtype = POINTER(c_bool) + self._dll.getLumpedHighLowPassMinInd.restype = c_int + + self._dll.setLumpedZigZag.argtype = c_bool + self._dll.setLumpedZigZag.restype = c_int + self._dll.getLumpedZigZag.argtype = POINTER(c_bool) + self._dll.getLumpedZigZag.restype = c_int + + self._dll.setLumpedMinInd.argtype = c_bool + self._dll.setLumpedMinInd.restype = c_int + self._dll.getLumpedMinInd.argtype = POINTER(c_bool) + self._dll.getLumpedMinInd.restype = c_int + + self._dll.setLumpedMinCap.argtype = c_bool + self._dll.setLumpedMinCap.restype = c_int + self._dll.getLumpedMinCap.argtype = POINTER(c_bool) + self._dll.getLumpedMinCap.restype = c_int + + self._dll.setLumpedSourceRes.argtype = c_bool + self._dll.setLumpedSourceRes.restype = c_int + self._dll.getLumpedSourceRes.argtype = POINTER(c_bool) + self._dll.getLumpedSourceRes.restype = c_int + + self._dll.setLumpedTrapTopology.argtype = c_bool + self._dll.setLumpedTrapTopology.restype = c_int + self._dll.getLumpedTrapTopology.argtype = POINTER(c_bool) + self._dll.getLumpedTrapTopology.restype = c_int + + self._dll.setLumpedNodeCapGround.argtype = c_bool + self._dll.setLumpedNodeCapGround.restype = c_int + self._dll.getLumpedNodeCapGround.argtype = POINTER(c_bool) + self._dll.getLumpedNodeCapGround.restype = c_int + + self._dll.setLumpedMatchImpedance.argtype = c_bool + self._dll.setLumpedMatchImpedance.restype = c_int + self._dll.getLumpedMatchImpedance.argtype = POINTER(c_bool) + self._dll.getLumpedMatchImpedance.restype = c_int + + self._dll.setLumpedComplexTermination.argtype = c_bool + self._dll.setLumpedComplexTermination.restype = c_int + self._dll.getLumpedComplexTermination.argtype = POINTER(c_bool) + self._dll.getLumpedComplexTermination.restype = c_int + + self._dll.setLumpedComplexElementTuneEnabled.argtype = c_bool + self._dll.setLumpedComplexElementTuneEnabled.restype = c_int + self._dll.getLumpedComplexElementTuneEnabled.argtype = POINTER(c_bool) + self._dll.getLumpedComplexElementTuneEnabled.restype = c_int + + self._dll.getLumpedCircuitResponseSize.argtype = POINTER(c_int) + self._dll.getLumpedCircuitResponseSize.restype = c_int + self._dll.getLumpedCircuitResponse.argtypes = [c_char_p, c_int] + self._dll.getLumpedCircuitResponse.restype = c_int + + @property + def generator_resistor(self) -> str: + """Generator resistor. The default is `50`. + + Returns + ------- + str + """ + generator_resistor_string = self._dll_interface.get_string(self._dll.getLumpedGeneratorResistor) + return generator_resistor_string + + @generator_resistor.setter + def generator_resistor(self, generator_resistor_string): + self._dll_interface.set_string(self._dll.setLumpedGeneratorResistor, generator_resistor_string) + + @property + def load_resistor(self) -> str: + """Load resistor. The default is `50`. + + Returns + ------- + str + """ + load_resistor_string = self._dll_interface.get_string(self._dll.getLumpedLoadResistor) + return load_resistor_string + + @load_resistor.setter + def load_resistor(self, load_resistor_string): + self._dll_interface.set_string(self._dll.setLumpedLoadResistor, load_resistor_string) + + @property + def current_source(self) -> bool: + """Whether to implement current source in synthesized circuit . The default is `False`. + + Returns + ------- + bool + """ + current_source = c_bool() + status = self._dll.getLumpedCurrentSource(byref(current_source)) + fspy._dll_interface().raise_error(status) + return bool(current_source.value) + + @current_source.setter + def current_source(self, current_source: bool): + status = self._dll.setLumpedCurrentSource(current_source) + fspy._dll_interface().raise_error(status) + + @property + def first_shunt(self) -> bool: + """Whether to implement shunt element(s) as first element(s) in synthesized circuit . + The default is `True` for shunt element(s). + If `False` implements series element(s) as first element(s) in synthesized circuit . + + Returns + ------- + bool + """ + first_shunt = c_bool() + status = self._dll.getLumpedFirstElementShunt(byref(first_shunt)) + fspy._dll_interface().raise_error(status) + return bool(first_shunt.value) + + @first_shunt.setter + def first_shunt(self, first_shunt: bool): + status = self._dll.setLumpedFirstElementShunt(first_shunt) + fspy._dll_interface().raise_error(status) + + @property + def bridge_t(self) -> bool: + """Whether to implement bridgeT topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + bridge_t = c_bool() + status = self._dll.getLumpedBridgeT(byref(bridge_t)) + fspy._dll_interface().raise_error(status) + return bool(bridge_t.value) + + @bridge_t.setter + def bridge_t(self, bridge_t: bool): + status = self._dll.setLumpedBridgeT(bridge_t) + fspy._dll_interface().raise_error(status) + + @property + def bridge_t_low(self) -> bool: + """Whether to implement bridgeT topology for lower frequency band in synthesized diplexer. + The default is `False` + + Returns + ------- + bool + """ + bridge_t_low = c_bool() + status = self._dll.getLumpedBridgeTLow(byref(bridge_t_low)) + fspy._dll_interface().raise_error(status) + return bool(bridge_t_low.value) + + @bridge_t_low.setter + def bridge_t_low(self, bridge_t_low: bool): + status = self._dll.setLumpedBridgeTLow(bridge_t_low) + fspy._dll_interface().raise_error(status) + + @property + def bridge_t_high(self) -> bool: + """Whether to implement bridgeT topology for higher frequency band in synthesized diplexer. + The default is `False` + + Returns + ------- + bool + """ + bridge_t_high = c_bool() + status = self._dll.getLumpedBridgeTHigh(byref(bridge_t_high)) + fspy._dll_interface().raise_error(status) + return bool(bridge_t_high.value) + + @bridge_t_high.setter + def bridge_t_high(self, bridge_t_high: bool): + status = self._dll.setLumpedBridgeTHigh(bridge_t_high) + fspy._dll_interface().raise_error(status) + + @property + def equal_inductors(self) -> bool: + """Whether to implement equal inductors topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + equal_inductors = c_bool() + status = self._dll.getLumpedEqualInductors(byref(equal_inductors)) + fspy._dll_interface().raise_error(status) + return bool(equal_inductors.value) + + @equal_inductors.setter + def equal_inductors(self, equal_inductors: bool): + status = self._dll.setLumpedEqualInductors(equal_inductors) + fspy._dll_interface().raise_error(status) + + @property + def equal_capacitors(self) -> bool: + """Whether to implement equal capacitors topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + equal_capacitors = c_bool() + status = self._dll.getLumpedEqualCapacitors(byref(equal_capacitors)) + fspy._dll_interface().raise_error(status) + return bool(equal_capacitors.value) + + @equal_capacitors.setter + def equal_capacitors(self, equal_capacitors: bool): + status = self._dll.setLumpedEqualCapacitors(equal_capacitors) + fspy._dll_interface().raise_error(status) + + @property + def equal_legs(self) -> bool: + """Whether to implement equal pairs shunt or series legs topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + equal_legs = c_bool() + status = self._dll.getLumpedEqualLegs(byref(equal_legs)) + fspy._dll_interface().raise_error(status) + return bool(equal_legs.value) + + @equal_legs.setter + def equal_legs(self, equal_legs: bool): + status = self._dll.setLumpedEqualLegs(equal_legs) + fspy._dll_interface().raise_error(status) + + @property + def high_low_pass(self) -> bool: + """Whether to implement high and low pass topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + high_low_pass = c_bool() + status = self._dll.getLumpedHighLowPass(byref(high_low_pass)) + fspy._dll_interface().raise_error(status) + return bool(high_low_pass.value) + + @high_low_pass.setter + def high_low_pass(self, high_low_pass: bool): + status = self._dll.setLumpedHighLowPass(high_low_pass) + fspy._dll_interface().raise_error(status) + + @property + def high_low_pass_min_ind(self) -> bool: + """Whether to implement high and low pass topology with minimum inductors in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + high_low_pass_min_ind = c_bool() + status = self._dll.getLumpedHighLowPassMinInd(byref(high_low_pass_min_ind)) + fspy._dll_interface().raise_error(status) + return bool(high_low_pass_min_ind.value) + + @high_low_pass_min_ind.setter + def high_low_pass_min_ind(self, high_low_pass_min_ind: bool): + status = self._dll.setLumpedHighLowPassMinInd(high_low_pass_min_ind) + fspy._dll_interface().raise_error(status) + + @property + def zig_zag(self) -> bool: + """Whether to implement zig zag topology with minimum inductors in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + zig_zag = c_bool() + status = self._dll.getLumpedZigZag(byref(zig_zag)) + fspy._dll_interface().raise_error(status) + return bool(zig_zag.value) + + @zig_zag.setter + def zig_zag(self, zig_zag: bool): + status = self._dll.setLumpedZigZag(zig_zag) + fspy._dll_interface().raise_error(status) + + @property + def min_ind(self) -> bool: + """Whether to implement minimum inductors topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + min_ind = c_bool() + status = self._dll.getLumpedMinInd(byref(min_ind)) + fspy._dll_interface().raise_error(status) + return bool(min_ind.value) + + @min_ind.setter + def min_ind(self, min_ind: bool): + status = self._dll.setLumpedMinInd(min_ind) + fspy._dll_interface().raise_error(status) + + @property + def min_cap(self) -> bool: + """Whether to implement minimum capacitors topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + min_cap = c_bool() + status = self._dll.getLumpedMinCap(byref(min_cap)) + fspy._dll_interface().raise_error(status) + return bool(min_cap.value) + + @min_cap.setter + def min_cap(self, min_cap: bool): + status = self._dll.setLumpedMinCap(min_cap) + fspy._dll_interface().raise_error(status) + + @property + def set_source_res(self) -> bool: + """Whether to set matched source resistor for zig zag topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + set_source_res = c_bool() + status = self._dll.getLumpedSourceRes(byref(set_source_res)) + fspy._dll_interface().raise_error(status) + return bool(set_source_res.value) + + @set_source_res.setter + def set_source_res(self, set_source_res: bool): + status = self._dll.setLumpedSourceRes(set_source_res) + fspy._dll_interface().raise_error(status) + + @property + def trap_topology(self) -> bool: + """Whether to implement trap topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + trap_topology = c_bool() + status = self._dll.getLumpedTrapTopology(byref(trap_topology)) + fspy._dll_interface().raise_error(status) + return bool(trap_topology.value) + + @trap_topology.setter + def trap_topology(self, trap_topology: bool): + status = self._dll.setLumpedTrapTopology(trap_topology) + fspy._dll_interface().raise_error(status) + + @property + def node_cap_ground(self) -> bool: + """Whether to implement parasitic capacitors to ground topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + node_cap_ground = c_bool() + status = self._dll.getLumpedNodeCapGround(byref(node_cap_ground)) + fspy._dll_interface().raise_error(status) + return bool(node_cap_ground.value) + + @node_cap_ground.setter + def node_cap_ground(self, node_cap_ground: bool): + status = self._dll.setLumpedNodeCapGround(node_cap_ground) + fspy._dll_interface().raise_error(status) + + @property + def match_impedance(self) -> bool: + """Whether to implement automatic matched impedance topology in synthesized circuit . + The default is `False` + + Returns + ------- + bool + """ + match_impedance = c_bool() + status = self._dll.getLumpedMatchImpedance(byref(match_impedance)) + fspy._dll_interface().raise_error(status) + return bool(match_impedance.value) + + @match_impedance.setter + def match_impedance(self, match_impedance: bool): + status = self._dll.setLumpedMatchImpedance(match_impedance) + fspy._dll_interface().raise_error(status) + + @property + def complex_termination(self) -> bool: + """Whether to select lumped filter complex termination. + The default is `False` + + Returns + ------- + bool + """ + complex_termination = c_bool() + status = self._dll.getLumpedComplexTermination(byref(complex_termination)) + fspy._dll_interface().raise_error(status) + return bool(complex_termination.value) + + @complex_termination.setter + def complex_termination(self, complex_termination: bool): + status = self._dll.setLumpedComplexTermination(complex_termination) + fspy._dll_interface().raise_error(status) + + @property + def complex_element_tune_enabled(self) -> bool: + """Whether to enable the element tune option. + The default is `True`. + + Returns + ------- + bool + """ + complex_element_tune_enabled = c_bool() + status = self._dll.getLumpedComplexElementTuneEnabled(byref(complex_element_tune_enabled)) + fspy._dll_interface().raise_error(status) + return bool(complex_element_tune_enabled.value) + + @complex_element_tune_enabled.setter + def complex_element_tune_enabled(self, complex_element_tune_enabled: bool): + status = self._dll.setLumpedComplexElementTuneEnabled(complex_element_tune_enabled) + fspy._dll_interface().raise_error(status) + + def circuit_response(self): + """Execute real filter synthesis""" + size = c_int() + status = self._dll.getLumpedCircuitResponseSize(byref(size)) + fspy._dll_interface().raise_error(status) + circuit_response_string = self._dll_interface.get_string( + self._dll.getLumpedCircuitResponse, max_size=size.value + ) + return circuit_response_string diff --git a/pyaedt/filtersolutions_core/multiple_bands_table.py b/pyaedt/filtersolutions_core/multiple_bands_table.py new file mode 100644 index 00000000000..ecbb4649a72 --- /dev/null +++ b/pyaedt/filtersolutions_core/multiple_bands_table.py @@ -0,0 +1,145 @@ +from ctypes import POINTER +from ctypes import byref +from ctypes import c_char_p +from ctypes import c_int +from ctypes import create_string_buffer + +import pyaedt.filtersolutions_core as fspy + + +class MultipleBandsTable: + """Manipulates access to the entries of multiple bands table. + + This class allows you to enter, edit or remove the entries of multiple bands table. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + + Methods + ---------- + _define_multiple_bands_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_multiple_bands_dll_functions() + + def _define_multiple_bands_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.getMultipleBandsTableRowCount.argtype = POINTER(c_int) + self._dll.getMultipleBandsTableRowCount.restype = c_int + + self._dll.getMultipleBandsTableRow.argtypes = [c_int, c_char_p, c_char_p, c_int] + self._dll.getMultipleBandsTableRow.restype = c_int + + self._dll.updateMultipleBandsTableRow.argtypes = [c_int, c_char_p, c_char_p] + self._dll.updateMultipleBandsTableRow.restype = c_int + + self._dll.appendMultipleBandsTableRow.argtypes = [c_char_p, c_char_p] + self._dll.appendMultipleBandsTableRow.restype = c_int + + self._dll.insertMultipleBandsTableRow.argtypes = [c_int, c_char_p, c_char_p] + self._dll.insertMultipleBandsTableRow.restype = c_int + + self._dll.removeMultipleBandsTableRow.argtype = c_int + self._dll.removeMultipleBandsTableRow.restype = c_int + + @property + def row_count(self) -> int: + """The count of accumulated frequenices in the multiple bands table. + The default is `2`. + + Returns + ------- + int + """ + table_row_count = c_int() + status = self._dll.getMultipleBandsTableRowCount(byref(table_row_count)) + fspy._dll_interface().raise_error(status) + return int(table_row_count.value) + + def row(self, row_index): + """Export lower and upper frequencies at given index. + + Parameters + ---------- + row_index: int + The row index on multiple bands table. Starting value is 0 and maximum value is 6. + + Returns + ------- + tuple: The tuple contains + str: + Lower frequency value. + str: + upper frequency value. + """ + lower_value_buffer = create_string_buffer(100) + upper_value_buffer = create_string_buffer(100) + status = self._dll.getMultipleBandsTableRow(row_index, lower_value_buffer, upper_value_buffer, 100) + fspy._dll_interface().raise_error(status) + lower_value_string = lower_value_buffer.value.decode("utf-8") + upper_value_string = upper_value_buffer.value.decode("utf-8") + return lower_value_string, upper_value_string + + def update_row(self, row_index, lower_frequency="", upper_frequency=""): + """Update lower and upper frequencies at given index. + + Parameters + ---------- + row_index: int + The row index on multiple bands table. Starting value is 0 and maximum value is 6. + lower_frequency: str, optional + The default is blank. + upper_frequency: str, optional + The default is blank. + """ + lower_bytes_value = bytes(lower_frequency, "ascii") + upper_bytes_value = bytes(upper_frequency, "ascii") + status = self._dll.updateMultipleBandsTableRow(row_index, lower_bytes_value, upper_bytes_value) + fspy._dll_interface().raise_error(status) + + def append_row(self, lower_frequency, upper_frequency): + """Append lower and upper frequencies at the end row of multiple bands table. + + Parameters + ---------- + lower_frequency: str + upper_frequency: str + """ + lower_bytes_value = bytes(lower_frequency, "ascii") + upper_bytes_value = bytes(upper_frequency, "ascii") + status = self._dll.appendMultipleBandsTableRow(lower_bytes_value, upper_bytes_value) + fspy._dll_interface().raise_error(status) + + def insert_row(self, row_index, lower_frequency, upper_frequency): + """Insert lower and upper frequencies at given index. + + Parameters + ---------- + row_index: int + The row index on multiple bands table. Starting value is 0 and maximum value is 6. + lower_frequency: str + upper_frequency: str + """ + lower_bytes_value = bytes(lower_frequency, "ascii") + upper_bytes_value = bytes(upper_frequency, "ascii") + status = self._dll.insertMultipleBandsTableRow(row_index, lower_bytes_value, upper_bytes_value) + fspy._dll_interface().raise_error(status) + + def remove_row(self, row_index): + """Remove lower and upper frequencies at given index. + + Parameters + ---------- + row_index: int + The row index on multiple bands table. Starting value is 0 and maximum value is 6. + """ + status = self._dll.removeMultipleBandsTableRow(row_index) + fspy._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/transmission_zeros.py b/pyaedt/filtersolutions_core/transmission_zeros.py new file mode 100644 index 00000000000..4d06c64ea1e --- /dev/null +++ b/pyaedt/filtersolutions_core/transmission_zeros.py @@ -0,0 +1,234 @@ +from ctypes import POINTER +from ctypes import byref +from ctypes import c_bool +from ctypes import c_char_p +from ctypes import c_int +from ctypes import create_string_buffer +from enum import Enum + +import pyaedt.filtersolutions_core as fspy + + +class TableFormat(Enum): + """Enumeration of transmission zeros table. + + Attributes: + RATIO: Represents transmission zeros ratio table. + FREQUENCY: Represents transmission zeros frequency table. + """ + + RATIO = 0 + FREQUENCY = 1 + + +class TransmissionZeros: + """Manipulates access to the entries of ratio and frequency of tranmsission zeros table. + + This class allows you to enter, edit or remove the entries of ratio and frequency of tranmsission zeros table. + + Attributes + ---------- + _dll: CDLL + FilterSolutions C++ API DLL. + _dll_interface: DllInterface + an instance of DllInterface class + table_format: TableFormat + Whether selects ratio or frequency transmission zeros table. + + Methods + ---------- + _define_transmission_zeros_dll_functions: + Define argument types of DLL function. + """ + + def __init__(self, table_format): + self._dll = fspy._dll_interface()._dll + self._dll_interface = fspy._dll_interface() + self._define_transmission_zeros_dll_functions() + self.table_format = table_format + + def _define_transmission_zeros_dll_functions(self): + """Define C++ API DLL functions.""" + self._dll.getTransmissionZerosTableRowCount.argtypes = [POINTER(c_int), c_bool] + self._dll.getTransmissionZerosTableRowCount.restype = c_int + + self._dll.getTransmissionZerosTableRow.argtypes = [ + c_int, + c_char_p, + c_char_p, + c_bool, + c_int, + ] + self._dll.getTransmissionZerosTableRow.restype = c_int + + self._dll.updateTransmissionZerosTableRow.argtypes = [ + c_int, + c_char_p, + c_char_p, + c_bool, + ] + self._dll.updateTransmissionZerosTableRow.restype = c_int + + self._dll.appendTransmissionZerosTableRow.argtypes = [ + c_char_p, + c_char_p, + c_bool, + ] + self._dll.appendTransmissionZerosTableRow.restype = c_int + + self._dll.insertTransmissionZerosTableRow.argtypes = [ + c_int, + c_char_p, + c_char_p, + c_bool, + ] + self._dll.insertTransmissionZerosTableRow.restype = c_int + + self._dll.removeTransmissionZerosTableRow.argtypes = [c_int, c_bool] + self._dll.removeTransmissionZerosTableRow.restype = c_int + + self._dll.clearTransmissionZerosTableRow.argtype = c_bool + self._dll.clearTransmissionZerosTableRow.restype = c_int + + self._dll.defaultPositionEnabled.argtype = c_bool + self._dll.defaultPositionEnabled.restype = c_int + + def table_format_to_bool(self): + """Set a flag to recognize ratio or frequency transmission zeros tables. + + Returns + ------- + bool + """ + if self.table_format.value == TableFormat.FREQUENCY.value: + return False + else: + return True + + @property + def row_count(self) -> int: + """The count of accumulated transmission zeros in the transmission zeros table. + The default is `2`. + + Returns + ------- + int + """ + table_row_count = c_int() + status = self._dll.getTransmissionZerosTableRowCount(byref(table_row_count), self.table_format_to_bool()) + fspy._dll_interface().raise_error(status) + return int(table_row_count.value) + + def row(self, row_index): + """Export ratios or frequencies at given index of the transmission zeros table. + + Parameters + ---------- + row_index: int + The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + + Returns + ------- + tuple: The tuple contains + str: + Transmission zero ratio or frequency value. + str: + Position of the element creating transmission zero in the associated circuit. + """ + zero_value_buffer = create_string_buffer(100) + position_value_buffer = create_string_buffer(100) + status = self._dll.getTransmissionZerosTableRow( + row_index, + zero_value_buffer, + position_value_buffer, + self.table_format_to_bool(), + 100, + ) + fspy._dll_interface().raise_error(status) + zero_value_string = zero_value_buffer.value.decode("utf-8") + position_value_string = position_value_buffer.value.decode("utf-8") + return zero_value_string, position_value_string + + def update_row(self, row_index, zero="", position=""): + """Update ratios or frequencies at given index of the transmission zeros table. + + Parameters + ---------- + row_index: int + The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + zero: str, optional + Transmission zero ratio or frequency value. + The default is blank. + position: str, optional + Position of the element creating transmission zero in the associated circuit. + The default is blank. + """ + zero_bytes_value = bytes(zero, "ascii") + position_bytes_value = bytes(position, "ascii") + status = self._dll.updateTransmissionZerosTableRow( + row_index, + zero_bytes_value, + position_bytes_value, + self.table_format_to_bool(), + ) + fspy._dll_interface().raise_error(status) + + def append_row(self, zero, position=""): + """Append ratios or frequencies at the end row of transmission zeros table. + + Parameters + ---------- + zero: str + Transmission zero ratio or frequency value. + position: str + Position of the element creating transmission zero in the associated circuit. + """ + zero_bytes_value = bytes(zero, "ascii") + position_bytes_value = bytes(position, "ascii") + status = self._dll.appendTransmissionZerosTableRow( + zero_bytes_value, position_bytes_value, self.table_format_to_bool() + ) + fspy._dll_interface().raise_error(status) + + def insert_row(self, row_index, zero, position=""): + """Insert ratios or frequencies at given index of the transmission zeros table. + + Parameters + ---------- + row_index: int + The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + zero: str + Transmission zero ratio or frequency value. + position: str + Position of the element creating transmission zero in the associated circuit. + """ + zero_bytes_value = bytes(zero, "ascii") + position_bytes_value = bytes(position, "ascii") + status = self._dll.insertTransmissionZerosTableRow( + row_index, + zero_bytes_value, + position_bytes_value, + self.table_format_to_bool(), + ) + fspy._dll_interface().raise_error(status) + + def remove_row(self, row_index): + """Remove ratios or frequencies at given index of the transmission zeros table. + + Parameters + ---------- + row_index: int + The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + """ + status = self._dll.removeTransmissionZerosTableRow(row_index, self.table_format_to_bool()) + fspy._dll_interface().raise_error(status) + + def clear_row(self): + """Clear all entries of the transmission zeros table.""" + status = self._dll.clearTransmissionZerosTableRow(self.table_format_to_bool()) + fspy._dll_interface().raise_error(status) + + def default_position(self): + """Restore default position of transmissison zeros.""" + status = self._dll.defaultPositionEnabled(self.table_format_to_bool()) + fspy._dll_interface().raise_error(status) diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index 8d0b889d94f..a4713869798 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -127,6 +127,18 @@ def Circuit( ) +def FilterSolutions( + projectname=None, + implementation_type=None, +): + + from pyaedt.filtersolutions import FilterSolutions as app + return app( + projectname=projectname, + implementation_type=implementation_type, + + ) + def Hfss( projectname=None, designname=None, From d1647cfc4cee278bf2adbcb311bed0e0aa199acc Mon Sep 17 00:00:00 2001 From: raghajaf Date: Wed, 15 May 2024 13:44:38 -0400 Subject: [PATCH 02/26] FEAT Draft FilterSolutions feature: Test folde is updated --- .../resources/bridge_t.ckt | 0 .../resources/bridge_t_high.ckt | 0 .../resources/bridge_t_low.ckt | 0 .../resources/c_lead_inductor.ckt | 0 .../resources/c_node_capacitor.ckt | 0 .../resources/c_node_compensate.ckt | 0 .../resources/capacitor_ls.ckt | 0 .../resources/capacitor_q.ckt | 0 .../resources/capacitor_rp.ckt | 0 .../resources/capacitor_rs.ckt | 0 .../resources/complex.ckt | 0 .../resources/current_source.ckt | 0 .../resources/diplexer1_bp_1.ckt | 0 .../resources/diplexer1_bp_2.ckt | 0 .../resources/diplexer1_bp_bs.ckt | 0 .../resources/diplexer1_hi_lo.ckt | 0 .../resources/diplexer2_bp_bs.ckt | 0 .../resources/diplexer2_triplexer_1.ckt | 0 .../resources/diplexer2_triplexer_2.ckt | 0 .../resources/equal_capacitors.ckt | 0 .../resources/equal_inductors.ckt | 0 .../resources/equal_legs.ckt | 0 .../resources/first_series.ckt | 0 .../resources/first_shunt.ckt | 0 .../resources/generator_resistor.ckt | 0 .../resources/high_low_pass.ckt | 0 .../resources/high_low_pass_min_ind.ckt | 0 .../resources/inductor_cp.ckt | 0 .../resources/inductor_q.ckt | 0 .../resources/inductor_rp.ckt | 0 .../resources/inductor_rs.ckt | 0 .../resources/l_lead_inductor.ckt | 0 .../resources/l_node_capacitor.ckt | 0 .../resources/l_node_compensate.ckt | 0 .../resources/laod_resistor.ckt | 0 .../resources/match_impedance.ckt | 0 .../resources/min_cap.ckt | 0 .../resources/min_ind.ckt | 0 .../resources/multiband.ckt | 0 .../resources/netlist.ckt | 0 .../resources/node_cap_ground.ckt | 0 .../resources/pspice.ckt | 0 .../resources/r_lead_inductor.ckt | 0 .../resources/r_node_capacitor.ckt | 0 .../resources/set_source_res.ckt | 0 .../resources/source_res.ckt | 0 .../resources/transferfunction.ckt | 0 .../resources/trap_topology.ckt | 0 .../resources/zig_zag.ckt | 0 .../test_filter/resource.py | 0 .../test_filter/test_attributes.py | 0 .../test_filter/test_dll_interface.py | 0 .../test_filter/test_filter_design.py | 0 .../test_filter/test_graph_setup.py | 0 .../test_filter/test_ideal_response.py | 0 .../test_filter/test_multiple_bands_table.py | 0 .../test_filter/test_transmission_zeros.py | 0 .../test_lumped_filter/resource.py | 0 .../test_lumped_implementation.py | 0 .../test_lumped_nodes_and_leads.py | 0 .../test_lumped_parasitics.py | 0 .../test_lumped_termination_impedance.py | 0 .../test_lumped_topology.py | 0 .../test_raise_error.py | 0 _unittest/test_46_attributes.py | 409 ------------------ 65 files changed, 409 deletions(-) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/bridge_t.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/bridge_t_high.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/bridge_t_low.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/c_lead_inductor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/c_node_capacitor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/c_node_compensate.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/capacitor_ls.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/capacitor_q.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/capacitor_rp.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/capacitor_rs.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/complex.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/current_source.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer1_bp_1.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer1_bp_2.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer1_bp_bs.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer1_hi_lo.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer2_bp_bs.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer2_triplexer_1.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/diplexer2_triplexer_2.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/equal_capacitors.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/equal_inductors.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/equal_legs.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/first_series.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/first_shunt.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/generator_resistor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/high_low_pass.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/high_low_pass_min_ind.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/inductor_cp.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/inductor_q.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/inductor_rp.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/inductor_rs.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/l_lead_inductor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/l_node_capacitor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/l_node_compensate.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/laod_resistor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/match_impedance.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/min_cap.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/min_ind.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/multiband.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/netlist.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/node_cap_ground.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/pspice.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/r_lead_inductor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/r_node_capacitor.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/set_source_res.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/source_res.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/transferfunction.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/trap_topology.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/resources/zig_zag.ckt (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/resource.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_attributes.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_dll_interface.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_filter_design.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_graph_setup.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_ideal_response.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_multiple_bands_table.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_filter/test_transmission_zeros.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_lumped_filter/resource.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_lumped_filter/test_lumped_implementation.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_lumped_filter/test_lumped_nodes_and_leads.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_lumped_filter/test_lumped_parasitics.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_lumped_filter/test_lumped_termination_impedance.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_lumped_filter/test_lumped_topology.py (100%) rename _unittest/{test_45 FilterSolutions => test_45_FilterSolutions}/test_raise_error.py (100%) delete mode 100644 _unittest/test_46_attributes.py diff --git a/_unittest/test_45 FilterSolutions/resources/bridge_t.ckt b/_unittest/test_45_FilterSolutions/resources/bridge_t.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/bridge_t.ckt rename to _unittest/test_45_FilterSolutions/resources/bridge_t.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/bridge_t_high.ckt b/_unittest/test_45_FilterSolutions/resources/bridge_t_high.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/bridge_t_high.ckt rename to _unittest/test_45_FilterSolutions/resources/bridge_t_high.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/bridge_t_low.ckt b/_unittest/test_45_FilterSolutions/resources/bridge_t_low.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/bridge_t_low.ckt rename to _unittest/test_45_FilterSolutions/resources/bridge_t_low.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/c_lead_inductor.ckt b/_unittest/test_45_FilterSolutions/resources/c_lead_inductor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/c_lead_inductor.ckt rename to _unittest/test_45_FilterSolutions/resources/c_lead_inductor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/c_node_capacitor.ckt b/_unittest/test_45_FilterSolutions/resources/c_node_capacitor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/c_node_capacitor.ckt rename to _unittest/test_45_FilterSolutions/resources/c_node_capacitor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/c_node_compensate.ckt b/_unittest/test_45_FilterSolutions/resources/c_node_compensate.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/c_node_compensate.ckt rename to _unittest/test_45_FilterSolutions/resources/c_node_compensate.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_ls.ckt b/_unittest/test_45_FilterSolutions/resources/capacitor_ls.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/capacitor_ls.ckt rename to _unittest/test_45_FilterSolutions/resources/capacitor_ls.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_q.ckt b/_unittest/test_45_FilterSolutions/resources/capacitor_q.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/capacitor_q.ckt rename to _unittest/test_45_FilterSolutions/resources/capacitor_q.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_rp.ckt b/_unittest/test_45_FilterSolutions/resources/capacitor_rp.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/capacitor_rp.ckt rename to _unittest/test_45_FilterSolutions/resources/capacitor_rp.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/capacitor_rs.ckt b/_unittest/test_45_FilterSolutions/resources/capacitor_rs.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/capacitor_rs.ckt rename to _unittest/test_45_FilterSolutions/resources/capacitor_rs.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/complex.ckt b/_unittest/test_45_FilterSolutions/resources/complex.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/complex.ckt rename to _unittest/test_45_FilterSolutions/resources/complex.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/current_source.ckt b/_unittest/test_45_FilterSolutions/resources/current_source.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/current_source.ckt rename to _unittest/test_45_FilterSolutions/resources/current_source.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_1.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer1_bp_1.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer1_bp_1.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer1_bp_1.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_2.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer1_bp_2.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer1_bp_2.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer1_bp_2.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_bp_bs.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer1_bp_bs.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer1_bp_bs.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer1_bp_bs.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer1_hi_lo.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer1_hi_lo.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer1_hi_lo.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer1_hi_lo.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer2_bp_bs.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer2_bp_bs.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer2_bp_bs.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer2_bp_bs.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_1.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer2_triplexer_1.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_1.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer2_triplexer_1.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_2.ckt b/_unittest/test_45_FilterSolutions/resources/diplexer2_triplexer_2.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/diplexer2_triplexer_2.ckt rename to _unittest/test_45_FilterSolutions/resources/diplexer2_triplexer_2.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/equal_capacitors.ckt b/_unittest/test_45_FilterSolutions/resources/equal_capacitors.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/equal_capacitors.ckt rename to _unittest/test_45_FilterSolutions/resources/equal_capacitors.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/equal_inductors.ckt b/_unittest/test_45_FilterSolutions/resources/equal_inductors.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/equal_inductors.ckt rename to _unittest/test_45_FilterSolutions/resources/equal_inductors.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/equal_legs.ckt b/_unittest/test_45_FilterSolutions/resources/equal_legs.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/equal_legs.ckt rename to _unittest/test_45_FilterSolutions/resources/equal_legs.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/first_series.ckt b/_unittest/test_45_FilterSolutions/resources/first_series.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/first_series.ckt rename to _unittest/test_45_FilterSolutions/resources/first_series.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/first_shunt.ckt b/_unittest/test_45_FilterSolutions/resources/first_shunt.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/first_shunt.ckt rename to _unittest/test_45_FilterSolutions/resources/first_shunt.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/generator_resistor.ckt b/_unittest/test_45_FilterSolutions/resources/generator_resistor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/generator_resistor.ckt rename to _unittest/test_45_FilterSolutions/resources/generator_resistor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/high_low_pass.ckt b/_unittest/test_45_FilterSolutions/resources/high_low_pass.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/high_low_pass.ckt rename to _unittest/test_45_FilterSolutions/resources/high_low_pass.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/high_low_pass_min_ind.ckt b/_unittest/test_45_FilterSolutions/resources/high_low_pass_min_ind.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/high_low_pass_min_ind.ckt rename to _unittest/test_45_FilterSolutions/resources/high_low_pass_min_ind.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_cp.ckt b/_unittest/test_45_FilterSolutions/resources/inductor_cp.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/inductor_cp.ckt rename to _unittest/test_45_FilterSolutions/resources/inductor_cp.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_q.ckt b/_unittest/test_45_FilterSolutions/resources/inductor_q.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/inductor_q.ckt rename to _unittest/test_45_FilterSolutions/resources/inductor_q.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_rp.ckt b/_unittest/test_45_FilterSolutions/resources/inductor_rp.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/inductor_rp.ckt rename to _unittest/test_45_FilterSolutions/resources/inductor_rp.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/inductor_rs.ckt b/_unittest/test_45_FilterSolutions/resources/inductor_rs.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/inductor_rs.ckt rename to _unittest/test_45_FilterSolutions/resources/inductor_rs.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/l_lead_inductor.ckt b/_unittest/test_45_FilterSolutions/resources/l_lead_inductor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/l_lead_inductor.ckt rename to _unittest/test_45_FilterSolutions/resources/l_lead_inductor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/l_node_capacitor.ckt b/_unittest/test_45_FilterSolutions/resources/l_node_capacitor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/l_node_capacitor.ckt rename to _unittest/test_45_FilterSolutions/resources/l_node_capacitor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/l_node_compensate.ckt b/_unittest/test_45_FilterSolutions/resources/l_node_compensate.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/l_node_compensate.ckt rename to _unittest/test_45_FilterSolutions/resources/l_node_compensate.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/laod_resistor.ckt b/_unittest/test_45_FilterSolutions/resources/laod_resistor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/laod_resistor.ckt rename to _unittest/test_45_FilterSolutions/resources/laod_resistor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/match_impedance.ckt b/_unittest/test_45_FilterSolutions/resources/match_impedance.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/match_impedance.ckt rename to _unittest/test_45_FilterSolutions/resources/match_impedance.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/min_cap.ckt b/_unittest/test_45_FilterSolutions/resources/min_cap.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/min_cap.ckt rename to _unittest/test_45_FilterSolutions/resources/min_cap.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/min_ind.ckt b/_unittest/test_45_FilterSolutions/resources/min_ind.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/min_ind.ckt rename to _unittest/test_45_FilterSolutions/resources/min_ind.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/multiband.ckt b/_unittest/test_45_FilterSolutions/resources/multiband.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/multiband.ckt rename to _unittest/test_45_FilterSolutions/resources/multiband.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/netlist.ckt b/_unittest/test_45_FilterSolutions/resources/netlist.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/netlist.ckt rename to _unittest/test_45_FilterSolutions/resources/netlist.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/node_cap_ground.ckt b/_unittest/test_45_FilterSolutions/resources/node_cap_ground.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/node_cap_ground.ckt rename to _unittest/test_45_FilterSolutions/resources/node_cap_ground.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/pspice.ckt b/_unittest/test_45_FilterSolutions/resources/pspice.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/pspice.ckt rename to _unittest/test_45_FilterSolutions/resources/pspice.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/r_lead_inductor.ckt b/_unittest/test_45_FilterSolutions/resources/r_lead_inductor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/r_lead_inductor.ckt rename to _unittest/test_45_FilterSolutions/resources/r_lead_inductor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/r_node_capacitor.ckt b/_unittest/test_45_FilterSolutions/resources/r_node_capacitor.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/r_node_capacitor.ckt rename to _unittest/test_45_FilterSolutions/resources/r_node_capacitor.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/set_source_res.ckt b/_unittest/test_45_FilterSolutions/resources/set_source_res.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/set_source_res.ckt rename to _unittest/test_45_FilterSolutions/resources/set_source_res.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/source_res.ckt b/_unittest/test_45_FilterSolutions/resources/source_res.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/source_res.ckt rename to _unittest/test_45_FilterSolutions/resources/source_res.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/transferfunction.ckt b/_unittest/test_45_FilterSolutions/resources/transferfunction.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/transferfunction.ckt rename to _unittest/test_45_FilterSolutions/resources/transferfunction.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/trap_topology.ckt b/_unittest/test_45_FilterSolutions/resources/trap_topology.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/trap_topology.ckt rename to _unittest/test_45_FilterSolutions/resources/trap_topology.ckt diff --git a/_unittest/test_45 FilterSolutions/resources/zig_zag.ckt b/_unittest/test_45_FilterSolutions/resources/zig_zag.ckt similarity index 100% rename from _unittest/test_45 FilterSolutions/resources/zig_zag.ckt rename to _unittest/test_45_FilterSolutions/resources/zig_zag.ckt diff --git a/_unittest/test_45 FilterSolutions/test_filter/resource.py b/_unittest/test_45_FilterSolutions/test_filter/resource.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/resource.py rename to _unittest/test_45_FilterSolutions/test_filter/resource.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_attributes.py rename to _unittest/test_45_FilterSolutions/test_filter/test_attributes.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_dll_interface.py rename to _unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_filter_design.py b/_unittest/test_45_FilterSolutions/test_filter/test_filter_design.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_filter_design.py rename to _unittest/test_45_FilterSolutions/test_filter/test_filter_design.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_graph_setup.py rename to _unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_ideal_response.py rename to _unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_multiple_bands_table.py rename to _unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py diff --git a/_unittest/test_45 FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_filter/test_transmission_zeros.py rename to _unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/resource.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/resource.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_lumped_filter/resource.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/resource.py diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_implementation.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_implementation.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_implementation.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_implementation.py diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_parasitics.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py diff --git a/_unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_lumped_filter/test_lumped_topology.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py diff --git a/_unittest/test_45 FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py similarity index 100% rename from _unittest/test_45 FilterSolutions/test_raise_error.py rename to _unittest/test_45_FilterSolutions/test_raise_error.py diff --git a/_unittest/test_46_attributes.py b/_unittest/test_46_attributes.py deleted file mode 100644 index 124cfa8f1b1..00000000000 --- a/_unittest/test_46_attributes.py +++ /dev/null @@ -1,409 +0,0 @@ -import pytest -from fspy.attributes import BesselRipplePercentage -from fspy.attributes import GaussianBesselReflection -from fspy.attributes import GaussianTransition -from fspy.attributes import PassbandDefinition -from fspy.attributes import RippleConstrictionBandSelect -from fspy.attributes import SinglePointRippleInfZeros -from fspy.attributes import StopbandDefinition -from fspy.filter_design import FilterClass -from fspy.filter_design import FilterType -from fspy.ideal_design import IdealDesign - - -def test_order(): - design = IdealDesign() - assert design.attributes.order == 5 - - with pytest.raises(RuntimeError) as info: - design.attributes.order = 0 - assert info.value.args[0] == "The minimum order is 1" - - for i in range(1, 22): - design.attributes.order = i - assert design.attributes.order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.order = 22 - assert info.value.args[0] == "The maximum order is 21" - - -def test_minimum_order_stop_band_att(): - design = IdealDesign() - assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" - design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" - assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" - - -def test_minimum_order_stop_band_freq(): - design = IdealDesign() - assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" - design.attributes.minimum_order_stop_band_frequency = "500 MHz" - assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" - - -def test_minimum_order(): - design = IdealDesign() - assert design.attributes.order == 5 - design.attributes.ideal_minimum_order - assert design.attributes.order == 3 - - -def test_pass_band_definition(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - assert len(PassbandDefinition) == 2 - assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY - for pbd in PassbandDefinition: - design.attributes.pass_band_definition = pbd - assert design.attributes.pass_band_definition == pbd - - -def test_pass_band_center_frequency(): - design = IdealDesign() - assert design.attributes.pass_band_center_frequency == "1G" - design.attributes.pass_band_center_frequency = "500M" - assert design.attributes.pass_band_center_frequency == "500M" - - -def test_pass_band_frequency(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - assert design.attributes.pass_band_width_frequency == "200M" - design.attributes.pass_band_width_frequency = "500M" - assert design.attributes.pass_band_width_frequency == "500M" - - -def test_lower_frequency(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES - assert design.attributes.lower_frequency == "905 M" - design.attributes.lower_frequency = "800M" - assert design.attributes.lower_frequency == "800M" - - -def test_upper_frequency(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES - assert design.attributes.upper_frequency == "1.105 G" - design.attributes.upper_frequency = "1.2 G" - assert design.attributes.upper_frequency == "1.2 G" - - -def test_stop_band_definition(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - assert len(StopbandDefinition) == 3 - assert design.attributes.stop_band_definition == StopbandDefinition.RATIO - for sbd in StopbandDefinition: - design.attributes.stop_band_definition = sbd - assert design.attributes.stop_band_definition == sbd - - -def test_stop_band_ratio(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - assert design.attributes.stop_band_ratio == "1.2" - design.attributes.stop_band_ratio = "1.5" - assert design.attributes.stop_band_ratio == "1.5" - - -def test_stop_band_frequency(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY - assert design.attributes.stop_band_frequency == "1.2 G" - design.attributes.stop_band_frequency = "1.5 G" - assert design.attributes.stop_band_frequency == "1.5 G" - - -def test_stop_band_attenuation(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB - assert design.attributes.stop_band_attenuation_db == "60" - design.attributes.stop_band_attenuation_db = "40 dB" - assert design.attributes.stop_band_attenuation_db == "40" - - -def test_standard_pass_band_attenuation(): - design = IdealDesign() - assert design.attributes.standard_pass_band_attenuation - design.attributes.standard_pass_band_attenuation = False - assert design.attributes.standard_pass_band_attenuation is False - - -def test_standard_pass_band_attenuation_value_db(): - design = IdealDesign() - design.attributes.standard_pass_band_attenuation = False - assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" - design.attributes.standard_pass_band_attenuation_value_db = "4" - assert design.attributes.standard_pass_band_attenuation_value_db == "4" - - -def test_bessel_normalized_delay(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL - assert design.attributes.bessel_normalized_delay is False - design.attributes.bessel_normalized_delay = True - assert design.attributes.bessel_normalized_delay - - -def test_bessel_normalized_delay_period(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL - design.attributes.bessel_normalized_delay = True - assert design.attributes.bessel_normalized_delay_period == "2" - design.attributes.bessel_normalized_delay_period = "3" - assert design.attributes.bessel_normalized_delay_period == "3" - - -def test_bessel_normalized_delay_percentage(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL - design.attributes.bessel_normalized_delay = True - assert len(BesselRipplePercentage) == 6 - for bessel_normalized_delay_percentage in BesselRipplePercentage: - design.attributes.bessel_normalized_delay_percentage = bessel_normalized_delay_percentage - assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage - - -def test_pass_band_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - assert design.attributes.pass_band_ripple == ".05" - design.attributes.pass_band_ripple = ".03" - assert design.attributes.pass_band_ripple == ".03" - - -def test_arith_symmetry(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.filter_class = FilterClass.BAND_PASS - assert design.attributes.arith_symmetry is False - design.attributes.arith_symmetry = True - assert design.attributes.arith_symmetry - - -def test_asymmetric(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - assert design.attributes.asymmetric is False - design.attributes.asymmetric = True - assert design.attributes.asymmetric - - -def test_asymmetric_low_order(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.attributes.asymmetric = True - assert design.attributes.asymmetric_low_order == 5 - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_low_order = 0 - assert info.value.args[0] == "The minimum order is 1" - - for i in range(1, 22): - design.attributes.asymmetric_low_order = i - assert design.attributes.asymmetric_low_order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_low_order = 22 - assert info.value.args[0] == "The maximum order is 21" - - -def test_asymmetric_high_order(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.attributes.asymmetric = True - assert design.attributes.asymmetric_high_order == 5 - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_high_order = 0 - assert info.value.args[0] == "The minimum order is 1" - - for i in range(1, 22): - design.attributes.asymmetric_high_order = i - assert design.attributes.asymmetric_high_order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_high_order = 22 - assert info.value.args[0] == "The maximum order is 21" - - -def test_asymmetric_low_stop_band_ratio(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_low_stop_band_ratio == "1.2" - design.attributes.asymmetric_low_stop_band_ratio = "1.5" - assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" - - -def test_asymmetric_high_stop_band_ratio(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_high_stop_band_ratio == "1.2" - design.attributes.asymmetric_high_stop_band_ratio = "1.5" - assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" - - -def test_asymmetric_low_stop_band_attenuation_db(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_low_stop_band_attenuation_db == "60" - design.attributes.asymmetric_low_stop_band_attenuation_db = "40" - assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" - - -def test_asymmetric_high_stop_band_attenuation_db(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_high_stop_band_attenuation_db == "60" - design.attributes.asymmetric_high_stop_band_attenuation_db = "40" - assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" - - -def test_gaussian_transition(): - design = IdealDesign() - design.filter_type = FilterType.GAUSSIAN - assert len(GaussianTransition) == 6 - for gaussian_transition in GaussianTransition: - design.attributes.gaussian_transition = gaussian_transition - assert design.attributes.gaussian_transition == gaussian_transition - - -def test_gaussian_bessel_reflection(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL - assert len(GaussianBesselReflection) == 3 - for gaussian_bessel_reflection in GaussianBesselReflection: - design.attributes.gaussian_bessel_reflection = gaussian_bessel_reflection - assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection - - -def test_even_order(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.order = 4 - assert design.attributes.even_order - design.attributes.even_order = False - assert design.attributes.even_order is False - - -def test_even_order_refl_zero(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.order = 4 - assert design.attributes.even_order_refl_zero - design.attributes.even_order_refl_zero = False - assert design.attributes.even_order_refl_zero is False - - -def test_even_order_trn_zero(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.order = 4 - assert design.attributes.even_order_trn_zero - design.attributes.even_order_trn_zero = False - assert design.attributes.even_order_trn_zero is False - - -def test_constrict_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - assert design.attributes.constrict_ripple is False - design.attributes.constrict_ripple = True - assert design.attributes.constrict_ripple - - -def test_single_point_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - assert design.attributes.single_point_ripple is False - design.attributes.single_point_ripple = True - assert design.attributes.single_point_ripple - - -def test_half_band_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - assert design.attributes.half_band_ripple is False - design.attributes.half_band_ripple = True - assert design.attributes.half_band_ripple - - -def test_constrict_ripple_percent(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.constrict_ripple = True - assert design.attributes.constrict_ripple_percent == "50%" - design.attributes.constrict_ripple_percent = "40%" - assert design.attributes.constrict_ripple_percent == "40%" - - -def test_ripple_constriction_band(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.constrict_ripple = True - assert len(RippleConstrictionBandSelect) == 3 - for ripple_constriction_band in RippleConstrictionBandSelect: - design.attributes.ripple_constriction_band = ripple_constriction_band - assert design.attributes.ripple_constriction_band == ripple_constriction_band - - -def test_single_point_ripple_inf_zeros(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.attributes.single_point_ripple = True - assert len(SinglePointRippleInfZeros) == 2 - for single_point_ripple_inf_zeros in SinglePointRippleInfZeros: - design.attributes.single_point_ripple_inf_zeros = single_point_ripple_inf_zeros - assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros - - -def test_delay_equalizer(): - design = IdealDesign() - assert design.attributes.delay_equalizer is False - design.attributes.delay_equalizer = True - assert design.attributes.delay_equalizer - - -def test_delay_equalizer_order(): - design = IdealDesign() - design.attributes.delay_equalizer = True - assert design.attributes.delay_equalizer_order == 2 - - for i in range(0, 21): - design.attributes.delay_equalizer_order = i - assert design.attributes.delay_equalizer_order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.delay_equalizer_order = 21 - assert info.value.args[0] == "The maximum order is 20" - - -def test_standard_delay_equ_pass_band_attenuation(): - design = IdealDesign() - design.attributes.delay_equalizer = True - assert design.attributes.standard_delay_equ_pass_band_attenuation - design.attributes.standard_delay_equ_pass_band_attenuation = False - assert design.attributes.standard_delay_equ_pass_band_attenuation is False - - -def test_standard_delay_equ_pass_band_attenuation_value_db(): - design = IdealDesign() - design.attributes.delay_equalizer = True - design.attributes.standard_delay_equ_pass_band_attenuation = False - assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" - design.attributes.standard_delay_equ_pass_band_attenuation_value_db = "4" - assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "4" From dc95a1ad495786ae493d83d033fd2575a0389ed4 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Wed, 15 May 2024 15:36:31 -0400 Subject: [PATCH 03/26] feat/pre-commit run --- .../test_filter/test_attributes.py | 2 +- .../test_filter/test_dll_interface.py | 2 +- .../test_filter/test_ideal_response.py | 2 +- .../test_filter/test_multiple_bands_table.py | 2 +- .../test_filter/test_transmission_zeros.py | 2 +- .../test_lumped_termination_impedance.py | 2 +- .../test_raise_error.py | 2 +- .../filltersolutionsexample.py | 0 pyaedt/filtersolutions.py | 29 +++++-------------- pyaedt/filtersolutions_core/attributes.py | 1 + pyaedt/filtersolutions_core/dll_interface.py | 3 +- pyaedt/filtersolutions_core/ideal_response.py | 2 +- .../filtersolutions_core/lumped_topology.py | 2 +- pyaedt/generic/design_types.py | 7 +++-- 14 files changed, 22 insertions(+), 36 deletions(-) rename examples/{Filtersolutions => 08-Filtersolutions}/filltersolutionsexample.py (100%) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 124cfa8f1b1..ef3f389f0d5 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -1,4 +1,3 @@ -import pytest from fspy.attributes import BesselRipplePercentage from fspy.attributes import GaussianBesselReflection from fspy.attributes import GaussianTransition @@ -9,6 +8,7 @@ from fspy.filter_design import FilterClass from fspy.filter_design import FilterType from fspy.ideal_design import IdealDesign +import pytest def test_order(): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index c4b05ceada2..d52cc1accb3 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -1,7 +1,7 @@ import fspy -import pytest from fspy.filter_design import FilterType from fspy.ideal_design import IdealDesign +import pytest def test_string_to_enum(): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index a939ca906fc..e4ab33b7dd7 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -1,11 +1,11 @@ from resource import resource_path -import pytest from fspy.ideal_design import IdealDesign from fspy.ideal_response import FrequencyResponseColumn from fspy.ideal_response import PoleZerosResponseColumn from fspy.ideal_response import SParametersResponseColumn from fspy.ideal_response import TimeResponseColumn +import pytest def test_frequency_response_getter(): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index 0393fa9d591..f45d1e5e1aa 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -1,5 +1,5 @@ -import pytest from fspy.ideal_design import IdealDesign +import pytest def test_row_count(): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index ee97317a452..866ac7a97b2 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -1,5 +1,5 @@ -import pytest from fspy.ideal_design import IdealDesign +import pytest def test_row_count(): diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index d891bb8edf5..3b6fb80f6ec 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -1,7 +1,7 @@ -import pytest from fspy.lumped_design import LumpedDesign from fspy.lumped_termination_impedance import ComplexReactanceType from fspy.lumped_termination_impedance import ComplexTerminationDefinition +import pytest def test_row_count(): diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index 91717719be6..6cc1aa9072c 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -1,5 +1,5 @@ -import pytest from fspy.ideal_design import IdealDesign +import pytest def test_raise_error(): diff --git a/examples/Filtersolutions/filltersolutionsexample.py b/examples/08-Filtersolutions/filltersolutionsexample.py similarity index 100% rename from examples/Filtersolutions/filltersolutionsexample.py rename to examples/08-Filtersolutions/filltersolutionsexample.py diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index 1e192169b66..a030386bfd5 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -1,14 +1,7 @@ -import sys -import pyaedt -import pyaedt.filtersolutions_core from pyaedt.filtersolutions_core.attributes import Attributes -from pyaedt.filtersolutions_core.attributes import FilterClass -from pyaedt.filtersolutions_core.attributes import FilterType from pyaedt.filtersolutions_core.attributes import FilterImplementation -from pyaedt.filtersolutions_core.multiple_bands_table import MultipleBandsTable -from pyaedt.filtersolutions_core.ideal_response import FrequencyResponseColumn -from pyaedt.filtersolutions_core.ideal_response import IdealResponse -from pyaedt.filtersolutions_core.graph_setup import GraphSetup +from pyaedt.filtersolutions_core.graph_setup import GraphSetup +from pyaedt.filtersolutions_core.ideal_response import IdealResponse from pyaedt.filtersolutions_core.lumped_nodes_and_leads import LumpedNodesandLeads from pyaedt.filtersolutions_core.lumped_parasitics import LumpedParasitics from pyaedt.filtersolutions_core.lumped_termination_impedance import LumpedTerminationImpedance @@ -17,12 +10,9 @@ from pyaedt.filtersolutions_core.multiple_bands_table import MultipleBandsTable from pyaedt.filtersolutions_core.transmission_zeros import TableFormat from pyaedt.filtersolutions_core.transmission_zeros import TransmissionZeros -from pyaedt.filtersolutions_core.attributes import DiplexerType -from pyaedt.filtersolutions_core.attributes import StopbandDefinition - -class FilterSolutions(): +class FilterSolutions: """Provides the FilterSolutions application interface. This class allows you to create an instance of FilterSolutions and @@ -56,19 +46,14 @@ class FilterSolutions(): >>> ) """ - def __init__( - self, - projectname=None, - implementation_type=None - ): - projectname=projectname - implementation_type=implementation_type + def __init__(self, projectname=None, implementation_type=None): + projectname = projectname + implementation_type = implementation_type if implementation_type == FilterImplementation.LUMPED: self._init_lumped_design() else: raise RuntimeError("The " + str(implementation_type) + " is not supported on this release.") - - + def _init_lumped_design(self): """Provides the FilterSolutions application interface. diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 04ec8cadd7a..d8c7daf06fc 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -7,6 +7,7 @@ import pyaedt.filtersolutions_core as fspy + class FilterType(Enum): """Selects type of filter with the associated mathematical formulation. diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index f5e7705bca6..a412d1641c9 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -1,9 +1,8 @@ import ctypes +from enum import Enum import os -import sys import threading import time -from enum import Enum from typing import Callable diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py index 1d3291532bf..25e363f9f4a 100644 --- a/pyaedt/filtersolutions_core/ideal_response.py +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -1,4 +1,3 @@ -import math from ctypes import POINTER from ctypes import byref from ctypes import c_bool @@ -6,6 +5,7 @@ from ctypes import c_double from ctypes import c_int from enum import Enum +import math import pyaedt.filtersolutions_core as fspy from pyaedt.filtersolutions_core.graph_setup import GraphSetup diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index cc9f10846a1..00d2fa2612e 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -534,7 +534,7 @@ def complex_element_tune_enabled(self) -> bool: def complex_element_tune_enabled(self, complex_element_tune_enabled: bool): status = self._dll.setLumpedComplexElementTuneEnabled(complex_element_tune_enabled) fspy._dll_interface().raise_error(status) - + def circuit_response(self): """Execute real filter synthesis""" size = c_int() diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index a4713869798..fe133f1b19c 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -133,12 +133,13 @@ def FilterSolutions( ): from pyaedt.filtersolutions import FilterSolutions as app - return app( - projectname=projectname, - implementation_type=implementation_type, + return app( + projectname=projectname, + implementation_type=implementation_type, ) + def Hfss( projectname=None, designname=None, From faccea3d8ebbdbc8c3eddadb34686d1d757103c8 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Fri, 17 May 2024 15:22:14 -0400 Subject: [PATCH 04/26] feat/changed folder to pyaedt --- .../test_filter/test_attributes.py | 252 +++++++++------ .../test_filter/test_dll_interface.py | 17 +- .../test_filter/test_filter_design.py | 83 ----- .../test_filter/test_graph_setup.py | 11 +- .../test_filter/test_ideal_response.py | 32 +- .../test_filter/test_multiple_bands_table.py | 28 +- .../test_filter/test_transmission_zeros.py | 20 +- .../test_lumped_implementation.py | 99 ------ .../test_lumped_nodes_and_leads.py | 35 ++- .../test_lumped_parasitics.py | 35 ++- .../test_lumped_termination_impedance.py | 28 +- .../test_lumped_topology.py | 297 ++++++++++++------ .../test_raise_error.py | 6 +- .../filltersolutionsexample.py | 24 +- pyaedt/filtersolutions_core/__init__.py | 6 +- pyaedt/filtersolutions_core/attributes.py | 89 +++--- pyaedt/filtersolutions_core/dll_interface.py | 2 +- pyaedt/filtersolutions_core/graph_setup.py | 6 +- pyaedt/filtersolutions_core/ideal_response.py | 28 +- .../lumped_nodes_and_leads.py | 14 +- .../filtersolutions_core/lumped_parasitics.py | 6 +- .../lumped_termination_impedance.py | 34 +- .../filtersolutions_core/lumped_topology.py | 84 ++--- .../multiple_bands_table.py | 18 +- .../transmission_zeros.py | 22 +- 25 files changed, 638 insertions(+), 638 deletions(-) delete mode 100644 _unittest/test_45_FilterSolutions/test_filter/test_filter_design.py delete mode 100644 _unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_implementation.py diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index ef3f389f0d5..6757cacbfa2 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -1,18 +1,94 @@ -from fspy.attributes import BesselRipplePercentage -from fspy.attributes import GaussianBesselReflection -from fspy.attributes import GaussianTransition -from fspy.attributes import PassbandDefinition -from fspy.attributes import RippleConstrictionBandSelect -from fspy.attributes import SinglePointRippleInfZeros -from fspy.attributes import StopbandDefinition -from fspy.filter_design import FilterClass -from fspy.filter_design import FilterType -from fspy.ideal_design import IdealDesign import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import BesselRipplePercentage +from pyaedt.filtersolutions_core.attributes import DiplexerType +from pyaedt.filtersolutions_core.attributes import FilterClass +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.attributes import FilterType +from pyaedt.filtersolutions_core.attributes import GaussianBesselReflection +from pyaedt.filtersolutions_core.attributes import GaussianTransition +from pyaedt.filtersolutions_core.attributes import PassbandDefinition +from pyaedt.filtersolutions_core.attributes import RippleConstrictionBandSelect +from pyaedt.filtersolutions_core.attributes import SinglePointRippleInfZeros +from pyaedt.filtersolutions_core.attributes import StopbandDefinition + + +def test_filter_type(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + assert design.attributes.filter_type == FilterType.BUTTERWORTH + + assert len(FilterType) == 8 + + for fimp in [FilterImplementation.LUMPED]: + design.attributes.filter_implementation = fimp + for ftype in FilterType: + design.attributes.filter_type = ftype + assert design.attributes.filter_type == ftype + + +def test_filter_class(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + assert design.attributes.filter_class == FilterClass.LOW_PASS + + # Only lumped supports all classes + # TODO: Confirm proper exceptions are raised when setting unsupported filter class for each implementation. + + assert len(FilterClass) == 10 + for index, fclass in enumerate(FilterClass): + if index > 5: + design.attributes.filter_multiple_bands_enabled = True + design.attributes.filter_class = fclass + assert design.attributes.filter_class == fclass + + +def test_filter_multiple_bands_enabled(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + assert design.attributes.filter_multiple_bands_enabled is False + design.attributes.filter_multiple_bands_enabled = True + assert design.attributes.filter_multiple_bands_enabled + + +def test_filter_multiple_bands_low_pass_frequency(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.attributes.filter_class = FilterClass.LOW_BAND + assert design.attributes.filter_multiple_bands_low_pass_frequency == "1G" + design.attributes.filter_multiple_bands_low_pass_frequency = "500M" + assert design.attributes.filter_multiple_bands_low_pass_frequency == "500M" + + +def test_filter_multiple_bands_high_pass_frequency(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.attributes.filter_class = FilterClass.BAND_HIGH + assert design.attributes.filter_multiple_bands_high_pass_frequency == "1G" + design.attributes.filter_multiple_bands_high_pass_frequency = "500M" + assert design.attributes.filter_multiple_bands_high_pass_frequency == "500M" + + +def test_filter_implementation(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + assert len(FilterImplementation) == 5 + for fimplementation in FilterImplementation: + design.attributes.filter_implementation = fimplementation + assert design.attributes.filter_implementation == fimplementation + + +def test_diplexer_type(): + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + assert len(DiplexerType) == 6 + for index, diplexer_type in enumerate(DiplexerType): + if index < 3: + design.attributes.filter_class = FilterClass.DIPLEXER_1 + elif index > 2: + design.attributes.filter_class = FilterClass.DIPLEXER_2 + design.attributes.diplexer_type = diplexer_type + assert design.attributes.diplexer_type == diplexer_type + def test_order(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 with pytest.raises(RuntimeError) as info: @@ -29,29 +105,29 @@ def test_order(): def test_minimum_order_stop_band_att(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" def test_minimum_order_stop_band_freq(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" design.attributes.minimum_order_stop_band_frequency = "500 MHz" assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" def test_minimum_order(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 design.attributes.ideal_minimum_order assert design.attributes.order == 3 def test_pass_band_definition(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS assert len(PassbandDefinition) == 2 assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY for pbd in PassbandDefinition: @@ -60,23 +136,23 @@ def test_pass_band_definition(): def test_pass_band_center_frequency(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.pass_band_center_frequency == "1G" design.attributes.pass_band_center_frequency = "500M" assert design.attributes.pass_band_center_frequency == "500M" def test_pass_band_frequency(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS assert design.attributes.pass_band_width_frequency == "200M" design.attributes.pass_band_width_frequency = "500M" assert design.attributes.pass_band_width_frequency == "500M" def test_lower_frequency(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES assert design.attributes.lower_frequency == "905 M" design.attributes.lower_frequency = "800M" @@ -84,8 +160,8 @@ def test_lower_frequency(): def test_upper_frequency(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES assert design.attributes.upper_frequency == "1.105 G" design.attributes.upper_frequency = "1.2 G" @@ -93,8 +169,8 @@ def test_upper_frequency(): def test_stop_band_definition(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC assert len(StopbandDefinition) == 3 assert design.attributes.stop_band_definition == StopbandDefinition.RATIO for sbd in StopbandDefinition: @@ -103,16 +179,16 @@ def test_stop_band_definition(): def test_stop_band_ratio(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.stop_band_ratio == "1.2" design.attributes.stop_band_ratio = "1.5" assert design.attributes.stop_band_ratio == "1.5" def test_stop_band_frequency(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY assert design.attributes.stop_band_frequency == "1.2 G" design.attributes.stop_band_frequency = "1.5 G" @@ -120,8 +196,8 @@ def test_stop_band_frequency(): def test_stop_band_attenuation(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB assert design.attributes.stop_band_attenuation_db == "60" design.attributes.stop_band_attenuation_db = "40 dB" @@ -129,14 +205,14 @@ def test_stop_band_attenuation(): def test_standard_pass_band_attenuation(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.standard_pass_band_attenuation design.attributes.standard_pass_band_attenuation = False assert design.attributes.standard_pass_band_attenuation is False def test_standard_pass_band_attenuation_value_db(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.standard_pass_band_attenuation = False assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" design.attributes.standard_pass_band_attenuation_value_db = "4" @@ -144,16 +220,16 @@ def test_standard_pass_band_attenuation_value_db(): def test_bessel_normalized_delay(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL assert design.attributes.bessel_normalized_delay is False design.attributes.bessel_normalized_delay = True assert design.attributes.bessel_normalized_delay def test_bessel_normalized_delay_period(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL design.attributes.bessel_normalized_delay = True assert design.attributes.bessel_normalized_delay_period == "2" design.attributes.bessel_normalized_delay_period = "3" @@ -161,8 +237,8 @@ def test_bessel_normalized_delay_period(): def test_bessel_normalized_delay_percentage(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL design.attributes.bessel_normalized_delay = True assert len(BesselRipplePercentage) == 6 for bessel_normalized_delay_percentage in BesselRipplePercentage: @@ -171,33 +247,33 @@ def test_bessel_normalized_delay_percentage(): def test_pass_band_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.pass_band_ripple == ".05" design.attributes.pass_band_ripple = ".03" assert design.attributes.pass_band_ripple == ".03" def test_arith_symmetry(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.filter_class = FilterClass.BAND_PASS assert design.attributes.arith_symmetry is False design.attributes.arith_symmetry = True assert design.attributes.arith_symmetry def test_asymmetric(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS assert design.attributes.asymmetric is False design.attributes.asymmetric = True assert design.attributes.asymmetric def test_asymmetric_low_order(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.asymmetric = True assert design.attributes.asymmetric_low_order == 5 @@ -215,8 +291,8 @@ def test_asymmetric_low_order(): def test_asymmetric_high_order(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.asymmetric = True assert design.attributes.asymmetric_high_order == 5 @@ -234,9 +310,9 @@ def test_asymmetric_high_order(): def test_asymmetric_low_stop_band_ratio(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True assert design.attributes.asymmetric_low_stop_band_ratio == "1.2" design.attributes.asymmetric_low_stop_band_ratio = "1.5" @@ -244,9 +320,9 @@ def test_asymmetric_low_stop_band_ratio(): def test_asymmetric_high_stop_band_ratio(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True assert design.attributes.asymmetric_high_stop_band_ratio == "1.2" design.attributes.asymmetric_high_stop_band_ratio = "1.5" @@ -254,9 +330,9 @@ def test_asymmetric_high_stop_band_ratio(): def test_asymmetric_low_stop_band_attenuation_db(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True assert design.attributes.asymmetric_low_stop_band_attenuation_db == "60" design.attributes.asymmetric_low_stop_band_attenuation_db = "40" @@ -264,9 +340,9 @@ def test_asymmetric_low_stop_band_attenuation_db(): def test_asymmetric_high_stop_band_attenuation_db(): - design = IdealDesign() - design.filter_class = FilterClass.BAND_PASS - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True assert design.attributes.asymmetric_high_stop_band_attenuation_db == "60" design.attributes.asymmetric_high_stop_band_attenuation_db = "40" @@ -274,8 +350,8 @@ def test_asymmetric_high_stop_band_attenuation_db(): def test_gaussian_transition(): - design = IdealDesign() - design.filter_type = FilterType.GAUSSIAN + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.GAUSSIAN assert len(GaussianTransition) == 6 for gaussian_transition in GaussianTransition: design.attributes.gaussian_transition = gaussian_transition @@ -283,8 +359,8 @@ def test_gaussian_transition(): def test_gaussian_bessel_reflection(): - design = IdealDesign() - design.filter_type = FilterType.BESSEL + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL assert len(GaussianBesselReflection) == 3 for gaussian_bessel_reflection in GaussianBesselReflection: design.attributes.gaussian_bessel_reflection = gaussian_bessel_reflection @@ -292,8 +368,8 @@ def test_gaussian_bessel_reflection(): def test_even_order(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.order = 4 assert design.attributes.even_order design.attributes.even_order = False @@ -301,8 +377,8 @@ def test_even_order(): def test_even_order_refl_zero(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.order = 4 assert design.attributes.even_order_refl_zero design.attributes.even_order_refl_zero = False @@ -310,8 +386,8 @@ def test_even_order_refl_zero(): def test_even_order_trn_zero(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.order = 4 assert design.attributes.even_order_trn_zero design.attributes.even_order_trn_zero = False @@ -319,32 +395,32 @@ def test_even_order_trn_zero(): def test_constrict_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.constrict_ripple is False design.attributes.constrict_ripple = True assert design.attributes.constrict_ripple def test_single_point_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.single_point_ripple is False design.attributes.single_point_ripple = True assert design.attributes.single_point_ripple def test_half_band_ripple(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.half_band_ripple is False design.attributes.half_band_ripple = True assert design.attributes.half_band_ripple def test_constrict_ripple_percent(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.constrict_ripple = True assert design.attributes.constrict_ripple_percent == "50%" design.attributes.constrict_ripple_percent = "40%" @@ -352,8 +428,8 @@ def test_constrict_ripple_percent(): def test_ripple_constriction_band(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.constrict_ripple = True assert len(RippleConstrictionBandSelect) == 3 for ripple_constriction_band in RippleConstrictionBandSelect: @@ -362,8 +438,8 @@ def test_ripple_constriction_band(): def test_single_point_ripple_inf_zeros(): - design = IdealDesign() - design.filter_type = FilterType.ELLIPTIC + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.single_point_ripple = True assert len(SinglePointRippleInfZeros) == 2 for single_point_ripple_inf_zeros in SinglePointRippleInfZeros: @@ -372,14 +448,14 @@ def test_single_point_ripple_inf_zeros(): def test_delay_equalizer(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.delay_equalizer is False design.attributes.delay_equalizer = True assert design.attributes.delay_equalizer def test_delay_equalizer_order(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True assert design.attributes.delay_equalizer_order == 2 @@ -393,7 +469,7 @@ def test_delay_equalizer_order(): def test_standard_delay_equ_pass_band_attenuation(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True assert design.attributes.standard_delay_equ_pass_band_attenuation design.attributes.standard_delay_equ_pass_band_attenuation = False @@ -401,7 +477,7 @@ def test_standard_delay_equ_pass_band_attenuation(): def test_standard_delay_equ_pass_band_attenuation_value_db(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True design.attributes.standard_delay_equ_pass_band_attenuation = False assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index d52cc1accb3..7f3736e02e3 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -1,19 +1,24 @@ -import fspy -from fspy.filter_design import FilterType -from fspy.ideal_design import IdealDesign import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.attributes import FilterType + + +def test_version(): + assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" + def test_string_to_enum(): - assert fspy._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN + assert pyaedt.filtersolutions_core._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN def test_enum_to_string(): - assert fspy._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" + assert pyaedt.filtersolutions_core._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" def test_raise_error(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_filter_design.py b/_unittest/test_45_FilterSolutions/test_filter/test_filter_design.py deleted file mode 100644 index 75ead20c190..00000000000 --- a/_unittest/test_45_FilterSolutions/test_filter/test_filter_design.py +++ /dev/null @@ -1,83 +0,0 @@ -import fspy -from fspy.filter_design import DiplexerType -from fspy.filter_design import FilterClass -from fspy.filter_design import FilterDesign -from fspy.filter_design import FilterImplementation -from fspy.filter_design import FilterType - - -def test_version(): - assert fspy.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" - - -def test_filter_type(): - design = FilterDesign() - assert design.filter_type == FilterType.BUTTERWORTH - - assert len(FilterType) == 8 - - for fimp in [FilterImplementation.LUMPED]: - design.filter_implementation = fimp - for ftype in FilterType: - design.filter_type = ftype - assert design.filter_type == ftype - - -def test_filter_class(): - design = FilterDesign() - assert design.filter_implementation == FilterImplementation.LUMPED - - # Only lumped supports all classes - # TODO: Confirm proper exceptions are raised when setting unsupported filter class for each implementation. - - assert len(FilterClass) == 10 - for index, fclass in enumerate(FilterClass): - if index > 5: - design.filter_multiple_bands_enabled = True - design.filter_class = fclass - assert design.filter_class == fclass - - -def test_filter_multiple_bands_enabled(): - design = FilterDesign() - assert design.filter_multiple_bands_enabled is False - design.filter_multiple_bands_enabled = True - assert design.filter_multiple_bands_enabled - - -def test_filter_multiple_bands_low_pass_frequency(): - design = FilterDesign() - design.filter_multiple_bands_enabled = True - design.filter_class = FilterClass.LOW_BAND - assert design.filter_multiple_bands_low_pass_frequency == "1G" - design.filter_multiple_bands_low_pass_frequency = "500M" - assert design.filter_multiple_bands_low_pass_frequency == "500M" - - -def test_filter_multiple_bands_high_pass_frequency(): - design = FilterDesign() - design.filter_multiple_bands_enabled = True - design.filter_class = FilterClass.BAND_HIGH - assert design.filter_multiple_bands_high_pass_frequency == "1G" - design.filter_multiple_bands_high_pass_frequency = "500M" - assert design.filter_multiple_bands_high_pass_frequency == "500M" - - -def test_filter_implementation(): - design = FilterDesign() - assert len(FilterImplementation) == 5 - for fimplementation in FilterImplementation: - design.filter_implementation = fimplementation - assert design.filter_implementation == fimplementation - - -def test_diplexer_type(): - design = FilterDesign() - assert len(DiplexerType) == 6 - for index, diplexer_type in enumerate(DiplexerType): - if index < 3: - design.filter_class = FilterClass.DIPLEXER_1 - elif index > 2: - design.filter_class = FilterClass.DIPLEXER_2 - design.diplexer_type = diplexer_type - assert design.diplexer_type == diplexer_type diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index a969ee6b572..6b9780e309d 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -1,29 +1,30 @@ -from fspy.ideal_design import IdealDesign +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation def test_minimum_frequency(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.minimum_frequency == "200 MHz" design.graph_setup.minimum_frequency = "500 MHz" assert design.graph_setup.minimum_frequency == "500 MHz" def test_maximum_frequency(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.maximum_frequency == "5 GHz" design.graph_setup.maximum_frequency = "2 GHz" assert design.graph_setup.maximum_frequency == "2 GHz" def test_minimum_time(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.minimum_time == "0" design.graph_setup.minimum_time = "5 ns" assert design.graph_setup.minimum_time == "5 ns" def test_maximum_time(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.maximum_time == "10n" design.graph_setup.maximum_time = "8 ns" assert design.graph_setup.maximum_time == "8 ns" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index e4ab33b7dd7..be19470bb48 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -1,15 +1,17 @@ from resource import resource_path -from fspy.ideal_design import IdealDesign -from fspy.ideal_response import FrequencyResponseColumn -from fspy.ideal_response import PoleZerosResponseColumn -from fspy.ideal_response import SParametersResponseColumn -from fspy.ideal_response import TimeResponseColumn import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.ideal_response import FrequencyResponseColumn +from pyaedt.filtersolutions_core.ideal_response import PoleZerosResponseColumn +from pyaedt.filtersolutions_core.ideal_response import SParametersResponseColumn +from pyaedt.filtersolutions_core.ideal_response import TimeResponseColumn + def test_frequency_response_getter(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) mag_db = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_DB) assert len(mag_db) == 500 @@ -64,7 +66,7 @@ def test_frequency_response_getter(): def test_time_response_getter(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) assert len(step_response) == 300 assert step_response[100] == pytest.approx(1.0006647872833518) @@ -103,7 +105,7 @@ def test_time_response_getter(): def test_sparameters_response_getter(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) assert len(s11_response_db) == 500 assert s11_response_db[100] == pytest.approx(-41.93847819973562) @@ -132,7 +134,7 @@ def test_sparameters_response_getter(): def test_pole_zeros_response_getter(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) assert len(pole_zero_den_x) == 5 assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) @@ -236,14 +238,14 @@ def test_pole_zeros_response_getter(): def test_filter_vsg_analysis_enabled(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.ideal_response.vsg_analysis_enabled is False design.ideal_response.vsg_analysis_enabled = True assert design.ideal_response.vsg_analysis_enabled def test_frequency_response(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) freq, mag_db = design.ideal_response.frequency_response( y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, minimum_frequency="200 MHz", @@ -261,7 +263,7 @@ def test_frequency_response(): def test_time_response(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) time, step_response = design.ideal_response.time_response( y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, minimum_time="0 ns", @@ -280,7 +282,7 @@ def test_time_response(): def test_s_parameters(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) freq, s21_db = design.ideal_response.s_parameters( y_axis_parameter=SParametersResponseColumn.S21_DB, minimum_frequency="200 MHz", @@ -297,7 +299,7 @@ def test_s_parameters(): def test_pole_zero_locations(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, @@ -317,7 +319,7 @@ def test_pole_zero_locations(): def test_transfer_function_response(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) list = design.ideal_response.transfer_function_response() list_file = open(resource_path("transferfunction.ckt")) lines_list = list.splitlines() diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index f45d1e5e1aa..937141f2b36 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -1,22 +1,24 @@ -from fspy.ideal_design import IdealDesign import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation + def test_row_count(): - design = IdealDesign() - design.filter_multiple_bands_enabled = True + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True assert design.multiple_bands_table.row_count == 2 def test_row(): - design = IdealDesign() - design.filter_multiple_bands_enabled = True + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True assert design.multiple_bands_table.row(0) == ("2G", "3G") def test_update_row(): - design = IdealDesign() - design.filter_multiple_bands_enabled = True + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True with pytest.raises(RuntimeError) as info: design.multiple_bands_table.update_row(0) assert info.value.args[0] == "It is not possible to update table with an empty value" @@ -29,8 +31,8 @@ def test_update_row(): def test_append_row(): - design = IdealDesign() - design.filter_multiple_bands_enabled = True + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True design.multiple_bands_table.append_row("100M", "500M") assert design.multiple_bands_table.row_count == 3 assert design.multiple_bands_table.row(2) == ("100M", "500M") @@ -43,8 +45,8 @@ def test_append_row(): def test_insert_row(): - design = IdealDesign() - design.filter_multiple_bands_enabled = True + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True design.multiple_bands_table.insert_row(0, "200M", "5G") assert design.multiple_bands_table.row(0) == ("200M", "5G") design.multiple_bands_table.insert_row(0, lower_frequency="500M", upper_frequency="2G") @@ -55,8 +57,8 @@ def test_insert_row(): def test_remove_row(): - design = IdealDesign() - design.filter_multiple_bands_enabled = True + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True design.multiple_bands_table.remove_row(0) assert design.multiple_bands_table.row(0) == ("4G", "5G") with pytest.raises(RuntimeError) as info: diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index 866ac7a97b2..7c86964927e 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -1,15 +1,17 @@ -from fspy.ideal_design import IdealDesign import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation + def test_row_count(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.transmission_zeros_frequency.row_count == 0 assert design.transmission_zeros_ratio.row_count == 0 def test_row(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" @@ -19,7 +21,7 @@ def test_row(): def test_update_row(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.update_row(0, zero="1.3G", position="2") assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" @@ -29,7 +31,7 @@ def test_update_row(): def test_append_row(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.append_row(zero="", position="") assert info.value.args[0] == "The input value is blank" @@ -50,7 +52,7 @@ def test_append_row(): def test_insert_row(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.insert_row(6, zero="1.3G", position="2") assert info.value.args[0] == "The given index 6 is larger than zeros order" @@ -75,7 +77,7 @@ def test_insert_row(): def test_remove_row(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.remove_row(2) assert info.value.args[0] == "The given index 2 is larger than zeros order" @@ -87,7 +89,7 @@ def test_remove_row(): def test_clear_row(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") design.transmission_zeros_frequency.clear_row() @@ -103,7 +105,7 @@ def test_clear_row(): def test_default_position(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") design.transmission_zeros_frequency.default_position() assert design.transmission_zeros_frequency.row(0) == ("1600M", "3") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_implementation.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_implementation.py deleted file mode 100644 index 20c82d98719..00000000000 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_implementation.py +++ /dev/null @@ -1,99 +0,0 @@ -from resource import resource_path - -from fspy.filter_design import DiplexerType -from fspy.filter_design import FilterClass -from fspy.lumped_design import LumpedDesign - - -def test_lumped_circuit_export(): - lumpdesign = LumpedDesign() - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("netlist.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -def test_lumped_diplexer1_hi_lo(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_1 - lumpdesign.diplexer_type = DiplexerType.HI_LO - assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 - assert lumpdesign.diplexer_type == DiplexerType.HI_LO - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("diplexer1_hi_lo.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -def test_lumped_diplexer1_bp_1(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_1 - lumpdesign.diplexer_type = DiplexerType.BP_1 - assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 - assert lumpdesign.diplexer_type == DiplexerType.BP_1 - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("diplexer1_bp_1.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -def test_lumped_diplexer1_bp_2(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_1 - lumpdesign.diplexer_type = DiplexerType.BP_2 - assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 - assert lumpdesign.diplexer_type == DiplexerType.BP_2 - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("diplexer1_bp_2.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -def test_lumped_diplexer2_bp_bs(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_2 - lumpdesign.diplexer_type = DiplexerType.BP_BS - assert lumpdesign.filter_class == FilterClass.DIPLEXER_2 - assert lumpdesign.diplexer_type == DiplexerType.BP_BS - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("diplexer2_bp_bs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -def test_lumped_diplexer2_triplexer_1(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_2 - lumpdesign.diplexer_type = DiplexerType.TRIPLEXER_1 - assert lumpdesign.filter_class == FilterClass.DIPLEXER_2 - assert lumpdesign.diplexer_type == DiplexerType.TRIPLEXER_1 - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("diplexer2_triplexer_1.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -def test_lumped_diplexer2_triplexer_2(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_2 - lumpdesign.diplexer_type = DiplexerType.TRIPLEXER_2 - assert lumpdesign.filter_class == FilterClass.DIPLEXER_2 - assert lumpdesign.diplexer_type == DiplexerType.TRIPLEXER_2 - netlist = lumpdesign.implementation.circuit_response() - netlist_file = open(resource_path("diplexer2_triplexer_2.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index 3dc71bfe81f..b4f188bee7b 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -1,14 +1,15 @@ from resource import resource_path -from fspy.lumped_design import LumpedDesign +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation def test_lumped_c_node_capacitor(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" lumpdesign.leads_and_nodes.c_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.c_node_capacitor == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("c_node_capacitor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -17,11 +18,11 @@ def test_lumped_c_node_capacitor(): def test_lumped_c_lead_inductor(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" lumpdesign.leads_and_nodes.c_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.c_lead_inductor == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("c_lead_inductor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -30,11 +31,11 @@ def test_lumped_c_lead_inductor(): def test_lumped_l_node_capacitor(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" lumpdesign.leads_and_nodes.l_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.l_node_capacitor == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("l_node_capacitor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -43,11 +44,11 @@ def test_lumped_l_node_capacitor(): def test_lumped_l_lead_inductor(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" lumpdesign.leads_and_nodes.l_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.l_lead_inductor == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("l_lead_inductor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -56,11 +57,11 @@ def test_lumped_l_lead_inductor(): def test_lumped_r_node_capacitor(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" lumpdesign.leads_and_nodes.r_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.r_node_capacitor == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("r_node_capacitor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -69,11 +70,11 @@ def test_lumped_r_node_capacitor(): def test_lumped_r_lead_inductor(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" lumpdesign.leads_and_nodes.r_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.r_lead_inductor == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("r_lead_inductor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -82,11 +83,11 @@ def test_lumped_r_lead_inductor(): def test_lumped_c_node_compensate(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_compensate is False lumpdesign.leads_and_nodes.c_node_compensate = True assert lumpdesign.leads_and_nodes.c_node_compensate - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("c_node_compensate.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -95,11 +96,11 @@ def test_lumped_c_node_compensate(): def test_lumped_l_node_compensate(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_compensate is False lumpdesign.leads_and_nodes.l_node_compensate = True assert lumpdesign.leads_and_nodes.l_node_compensate - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("l_node_compensate.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 19fa1d276f3..360a8ded62f 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -1,14 +1,15 @@ from resource import resource_path -from fspy.lumped_design import LumpedDesign +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation def test_lumped_capacitor_q(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_q == "Inf" lumpdesign.parasitics.capacitor_q = "100" assert lumpdesign.parasitics.capacitor_q == "100" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("capacitor_q.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -17,11 +18,11 @@ def test_lumped_capacitor_q(): def test_lumped_capacitor_rs(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rs == "0" lumpdesign.parasitics.capacitor_rs = "1" assert lumpdesign.parasitics.capacitor_rs == "1" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("capacitor_rs.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -30,11 +31,11 @@ def test_lumped_capacitor_rs(): def test_lumped_capacitor_rp(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rp == "Inf" lumpdesign.parasitics.capacitor_rp = "1000" assert lumpdesign.parasitics.capacitor_rp == "1000" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("capacitor_rp.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -43,11 +44,11 @@ def test_lumped_capacitor_rp(): def test_lumped_capacitor_ls(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_ls == "0" lumpdesign.parasitics.capacitor_ls = "1n" assert lumpdesign.parasitics.capacitor_ls == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("capacitor_ls.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -56,11 +57,11 @@ def test_lumped_capacitor_ls(): def test_lumped_inductor_q(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_q == "Inf" lumpdesign.parasitics.inductor_q = "100" assert lumpdesign.parasitics.inductor_q == "100" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("inductor_q.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -69,11 +70,11 @@ def test_lumped_inductor_q(): def test_lumped_inductor_rs(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rs == "0" lumpdesign.parasitics.inductor_rs = "1" assert lumpdesign.parasitics.inductor_rs == "1" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("inductor_rs.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -82,11 +83,11 @@ def test_lumped_inductor_rs(): def test_lumped_inductor_rp(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rp == "Inf" lumpdesign.parasitics.inductor_rp = "1000" assert lumpdesign.parasitics.inductor_rp == "1000" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("inductor_rp.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -95,11 +96,11 @@ def test_lumped_inductor_rp(): def test_lumped_inductor_cp(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_cp == "0" lumpdesign.parasitics.inductor_cp = "1n" assert lumpdesign.parasitics.inductor_cp == "1n" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("inductor_cp.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index 3b6fb80f6ec..73ce12fe885 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -1,25 +1,27 @@ -from fspy.lumped_design import LumpedDesign -from fspy.lumped_termination_impedance import ComplexReactanceType -from fspy.lumped_termination_impedance import ComplexTerminationDefinition import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.lumped_termination_impedance import ComplexReactanceType +from pyaedt.filtersolutions_core.lumped_termination_impedance import ComplexTerminationDefinition + def test_row_count(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.source_impedance_table.row_count == 3 assert lumpdesign.load_impedance_table.row_count == 3 def test_row(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.source_impedance_table.row(0) == ("0.100G", "1.000", "0.000") assert lumpdesign.load_impedance_table.row(0) == ("0.100G", "1.000", "0.000") def test_update_row(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True with pytest.raises(RuntimeError) as info: lumpdesign.source_impedance_table.update_row(0) @@ -42,7 +44,7 @@ def test_update_row(): def test_append_row(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.append_row("100M", "10", "20") assert lumpdesign.source_impedance_table.row_count == 4 @@ -54,7 +56,7 @@ def test_append_row(): def test_insert_row(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.insert_row(0, "2G", "50", "0") assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") @@ -63,7 +65,7 @@ def test_insert_row(): def test_remove_row(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.remove_row(0) assert lumpdesign.source_impedance_table.row(0) == ("1.000G", "1.000", "0.000") @@ -78,7 +80,7 @@ def test_remove_row(): def test_complex_definition(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert len(ComplexTerminationDefinition) == 4 assert lumpdesign.source_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN @@ -92,7 +94,7 @@ def test_complex_definition(): def test_reactance_type(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert len(ComplexReactanceType) == 3 assert lumpdesign.source_impedance_table.reactance_type == ComplexReactanceType.REAC @@ -106,7 +108,7 @@ def test_reactance_type(): def test_compensation_enabled(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.source_impedance_table.compensation_enabled is False lumpdesign.source_impedance_table.compensation_enabled = True @@ -117,7 +119,7 @@ def test_compensation_enabled(): def test_compensation_order(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.compensation_enabled = True assert lumpdesign.source_impedance_table.compensation_order == 2 diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 9574879f918..072850a55bb 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -1,18 +1,19 @@ -# from fspy.lumped_termination_impedance import TerminationType +# from pyaedt.filtersolutions_core.lumped_termination_impedance import TerminationType from resource import resource_path -from fspy.filter_design import DiplexerType -from fspy.filter_design import FilterClass -from fspy.filter_design import FilterType -from fspy.lumped_design import LumpedDesign +import pyaedt +from pyaedt.filtersolutions_core.attributes import DiplexerType +from pyaedt.filtersolutions_core.attributes import FilterClass +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.attributes import FilterType def test_lumped_generator_resistor_30(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.generator_resistor == "50" lumpdesign.topology.generator_resistor = "30" assert lumpdesign.topology.generator_resistor == "30" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("generator_resistor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -21,11 +22,11 @@ def test_lumped_generator_resistor_30(): def test_lumped_load_resistor_30(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.load_resistor == "50" lumpdesign.topology.load_resistor = "30" assert lumpdesign.topology.load_resistor == "30" - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("laod_resistor.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -34,11 +35,11 @@ def test_lumped_load_resistor_30(): def test_lumped_current_source(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.current_source is False lumpdesign.topology.current_source = True assert lumpdesign.topology.current_source - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("current_source.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -47,11 +48,11 @@ def test_lumped_current_source(): def test_lumped_first_shunt(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt lumpdesign.topology.first_shunt = True assert lumpdesign.topology.first_shunt - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("first_shunt.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -60,11 +61,11 @@ def test_lumped_first_shunt(): def test_lumped_first_series(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt lumpdesign.topology.first_shunt = False assert lumpdesign.topology.first_shunt is False - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("first_series.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -73,13 +74,13 @@ def test_lumped_first_series(): def test_lumped_bridge_t(): - lumpdesign = LumpedDesign() - lumpdesign.filter_type = FilterType.ELLIPTIC - assert lumpdesign.filter_type == FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.bridge_t is False lumpdesign.topology.bridge_t = True assert lumpdesign.topology.bridge_t - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("bridge_t.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -88,17 +89,17 @@ def test_lumped_bridge_t(): def test_lumped_bridge_t_low(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_1 - assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 - lumpdesign.diplexer_type = DiplexerType.HI_LO - assert lumpdesign.diplexer_type == DiplexerType.HI_LO - lumpdesign.filter_type = FilterType.ELLIPTIC - assert lumpdesign.filter_type == FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.bridge_t_low is False lumpdesign.topology.bridge_t_low = True assert lumpdesign.topology.bridge_t_low - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("bridge_t_low.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -107,17 +108,17 @@ def test_lumped_bridge_t_low(): def test_lumped_bridge_t_high(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.DIPLEXER_1 - assert lumpdesign.filter_class == FilterClass.DIPLEXER_1 - lumpdesign.diplexer_type = DiplexerType.HI_LO - assert lumpdesign.diplexer_type == DiplexerType.HI_LO - lumpdesign.filter_type = FilterType.ELLIPTIC - assert lumpdesign.filter_type == FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.bridge_t_high is False lumpdesign.topology.bridge_t_high = True assert lumpdesign.topology.bridge_t_high - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("bridge_t_high.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -126,13 +127,13 @@ def test_lumped_bridge_t_high(): def test_lumped_equal_inductors(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - assert lumpdesign.filter_class == FilterClass.BAND_PASS + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.equal_inductors is False lumpdesign.topology.equal_inductors = True assert lumpdesign.topology.equal_inductors - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("equal_inductors.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -141,12 +142,12 @@ def test_lumped_equal_inductors(): def test_lumped_equal_capacitors(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.zig_zag assert lumpdesign.topology.min_cap is False assert lumpdesign.topology.equal_capacitors is False @@ -154,7 +155,7 @@ def test_lumped_equal_capacitors(): lumpdesign.topology.equal_capacitors = True assert lumpdesign.topology.min_cap assert lumpdesign.topology.equal_capacitors - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("equal_capacitors.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -163,13 +164,13 @@ def test_lumped_equal_capacitors(): def test_lumped_equal_legs(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - assert lumpdesign.filter_class == FilterClass.BAND_PASS + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.equal_legs is False lumpdesign.topology.equal_legs = True assert lumpdesign.topology.equal_legs - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("equal_legs.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -178,13 +179,13 @@ def test_lumped_equal_legs(): def test_lumped_high_low_pass(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - assert lumpdesign.filter_class == FilterClass.BAND_PASS + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.high_low_pass is False lumpdesign.topology.high_low_pass = True assert lumpdesign.topology.high_low_pass - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("high_low_pass.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -193,15 +194,15 @@ def test_lumped_high_low_pass(): def test_lumped_high_low_pass_min_ind(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.high_low_pass_min_ind is False lumpdesign.topology.high_low_pass_min_ind = True assert lumpdesign.topology.high_low_pass_min_ind - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("high_low_pass_min_ind.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -210,15 +211,15 @@ def test_lumped_high_low_pass_min_ind(): def test_lumped_zig_zag(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.zig_zag is False lumpdesign.topology.zig_zag = True assert lumpdesign.topology.zig_zag - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("zig_zag.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -227,17 +228,17 @@ def test_lumped_zig_zag(): def test_lumped_min_ind(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.zig_zag assert lumpdesign.topology.min_ind lumpdesign.topology.min_ind = True assert lumpdesign.topology.min_ind - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("min_ind.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -246,17 +247,17 @@ def test_lumped_min_ind(): def test_lumped_min_cap(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.zig_zag assert lumpdesign.topology.min_cap is False lumpdesign.topology.min_cap = True assert lumpdesign.topology.min_cap - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("min_cap.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -265,18 +266,18 @@ def test_lumped_min_cap(): def test_lumped_set_source_res(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True lumpdesign.topology.set_source_res = False assert lumpdesign.topology.set_source_res is False - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.zig_zag lumpdesign.topology.set_source_res = True assert lumpdesign.topology.set_source_res - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("set_source_res.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -285,17 +286,17 @@ def test_lumped_set_source_res(): def test_lumped_trap_topology(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.zig_zag assert lumpdesign.topology.trap_topology is False lumpdesign.topology.trap_topology = True assert lumpdesign.topology.trap_topology - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("trap_topology.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -304,15 +305,15 @@ def test_lumped_trap_topology(): def test_lumped_node_cap_ground(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS - lumpdesign.filter_type = FilterType.ELLIPTIC - assert lumpdesign.filter_class == FilterClass.BAND_PASS - assert lumpdesign.filter_type == FilterType.ELLIPTIC + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.node_cap_ground is False lumpdesign.topology.node_cap_ground = True assert lumpdesign.topology.node_cap_ground - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("node_cap_ground.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -321,15 +322,15 @@ def test_lumped_node_cap_ground(): def test_lumped_match_impedance(): - lumpdesign = LumpedDesign() - lumpdesign.filter_class = FilterClass.BAND_PASS + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.topology.generator_resistor = "75" - assert lumpdesign.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.generator_resistor == "75" assert lumpdesign.topology.match_impedance is False lumpdesign.topology.match_impedance = True assert lumpdesign.topology.match_impedance - netlist = lumpdesign.implementation.circuit_response() + netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("match_impedance.ckt")) lines_netlist = netlist.splitlines() lines_netlist_file = netlist_file.readlines() @@ -338,15 +339,109 @@ def test_lumped_match_impedance(): def test_lumped_complex_termination(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.complex_termination is False lumpdesign.topology.complex_termination = True assert lumpdesign.topology.complex_termination def test_complex_element_tune_enabled(): - lumpdesign = LumpedDesign() + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.topology.complex_element_tune_enabled lumpdesign.topology.complex_element_tune_enabled = False assert lumpdesign.topology.complex_element_tune_enabled is False + + +def test_lumped_circuit_export(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("netlist.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer1_hi_lo(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer1_hi_lo.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer1_bp_1(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.BP_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_1 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer1_bp_1.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer1_bp_2(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.BP_2 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_2 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer1_bp_2.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer2_bp_bs(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.attributes.diplexer_type = DiplexerType.BP_BS + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_BS + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer2_bp_bs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer2_triplexer_1(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_1 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer2_triplexer_1.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + +def test_lumped_diplexer2_triplexer_2(): + lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_2 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_2 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer2_triplexer_2.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index 6cc1aa9072c..c04b67f5f76 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -1,9 +1,11 @@ -from fspy.ideal_design import IdealDesign import pytest +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterImplementation + def test_raise_error(): - design = IdealDesign() + design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/examples/08-Filtersolutions/filltersolutionsexample.py b/examples/08-Filtersolutions/filltersolutionsexample.py index 685a436da8b..8c169e4a35a 100644 --- a/examples/08-Filtersolutions/filltersolutionsexample.py +++ b/examples/08-Filtersolutions/filltersolutionsexample.py @@ -1,20 +1,12 @@ import pyaedt -import matplotlib.pyplot as plt - -from pyaedt.filtersolutions import FilterClass -from pyaedt.filtersolutions import FilterType -from pyaedt.filtersolutions import FilterImplementation -from pyaedt.filtersolutions import FrequencyResponseColumn -from pyaedt.filtersolutions import DiplexerType -from pyaedt.filtersolutions import StopbandDefinition - - -#if __name__ == "__main__": - -design = pyaedt.FilterSolutions(projectname= "fs1", implementation_type= FilterImplementation.LUMPED) -design.attributes.filter_type = FilterType.ELLIPTIC -design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY -print(design.attributes.stop_band_definition) +from pyaedt.filtersolutions_core.attributes import FilterType +from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.filtersolutions_core.attributes import StopbandDefinition +if __name__ == "__main__": + design = pyaedt.FilterSolutions(projectname= "fs1", implementation_type= FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY + print(design.attributes.stop_band_definition) \ No newline at end of file diff --git a/pyaedt/filtersolutions_core/__init__.py b/pyaedt/filtersolutions_core/__init__.py index 653ae843b1b..309279c5b14 100644 --- a/pyaedt/filtersolutions_core/__init__.py +++ b/pyaedt/filtersolutions_core/__init__.py @@ -1,14 +1,14 @@ import sys -import fspy.dll_interface +from pyaedt.filtersolutions_core.dll_interface import DllInterface _this = sys.modules[__name__] _this._internal_dll_interface = None -def _dll_interface() -> fspy.dll_interface.DllInterface: +def _dll_interface() -> DllInterface: if _this._internal_dll_interface is None: - _this._internal_dll_interface = fspy.dll_interface.DllInterface(show_gui=False) + _this._internal_dll_interface = DllInterface(show_gui=False) return _this._internal_dll_interface diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index d8c7daf06fc..a7a9cc2c461 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -5,7 +5,7 @@ from ctypes import c_int from enum import Enum -import pyaedt.filtersolutions_core as fspy +import pyaedt class FilterType(Enum): @@ -209,8 +209,9 @@ class Attributes: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() + self._dll_interface.restore_defaults() self._define_attributes_dll_functions() def _define_attributes_dll_functions(self): @@ -550,13 +551,13 @@ def filter_multiple_bands_enabled(self) -> bool: """ filter_multiple_bands_enabled = c_bool() status = self._dll.getMultipleBandsEnabled(byref(filter_multiple_bands_enabled)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(filter_multiple_bands_enabled.value) @filter_multiple_bands_enabled.setter def filter_multiple_bands_enabled(self, filter_multiple_bands_enabled: bool): status = self._dll.setMultipleBandsEnabled(filter_multiple_bands_enabled) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def filter_multiple_bands_low_pass_frequency(self) -> str: @@ -608,13 +609,13 @@ def order(self) -> int: """ order = c_int() status = self._dll.getOrder(byref(order)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(order.value) @order.setter def order(self, order: int): status = self._dll.setOrder(order) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def minimum_order_stop_band_attenuation_db(self) -> str: @@ -668,7 +669,7 @@ def ideal_minimum_order(self) -> int: """ minimum_order = c_int() status = self._dll.setIdealMinimumOrder(byref(minimum_order)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(minimum_order.value) @property @@ -683,14 +684,14 @@ def pass_band_definition(self) -> PassbandDefinition: index = c_int() pass_band_definition = list(PassbandDefinition) status = self._dll.getPassbandDef(byref(index)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) pass_band_definition = pass_band_definition[index.value] return pass_band_definition @pass_band_definition.setter def pass_band_definition(self, column: PassbandDefinition): status = self._dll.setPassbandDef(column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def pass_band_center_frequency(self) -> str: @@ -768,14 +769,14 @@ def stop_band_definition(self) -> StopbandDefinition: index = c_int() stop_band_definition = list(StopbandDefinition) status = self._dll.getStopbandDef(byref(index)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) stop_band_definition = stop_band_definition[index.value] return stop_band_definition @stop_band_definition.setter def stop_band_definition(self, column: StopbandDefinition): status = self._dll.setStopbandDef(column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def stop_band_ratio(self) -> str: @@ -836,13 +837,13 @@ def standard_pass_band_attenuation(self) -> bool: """ standard_pass_band_attenuation = c_bool() status = self._dll.getStandardCutoffEnabled(byref(standard_pass_band_attenuation)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(standard_pass_band_attenuation.value) @standard_pass_band_attenuation.setter def standard_pass_band_attenuation(self, standard_pass_band_attenuation: bool): status = self._dll.setStandardCutoffEnabled(standard_pass_band_attenuation) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def standard_pass_band_attenuation_value_db(self) -> str: @@ -876,13 +877,13 @@ def bessel_normalized_delay(self) -> bool: """ bessel_normalized_delay = c_bool() status = self._dll.getBesselNormalizedDelay(byref(bessel_normalized_delay)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(bessel_normalized_delay.value) @bessel_normalized_delay.setter def bessel_normalized_delay(self, bessel_normalized_delay: bool): status = self._dll.setBesselNormalizedDelay(bessel_normalized_delay) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def bessel_normalized_delay_period(self) -> str: @@ -915,14 +916,14 @@ def bessel_normalized_delay_percentage(self) -> int: index = c_int() bessel_normalized_delay_percentage = list(BesselRipplePercentage) status = self._dll.getBesselRipplePercentage(byref(index)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) bessel_normalized_delay_percentage_string = bessel_normalized_delay_percentage[index.value] return bessel_normalized_delay_percentage_string @bessel_normalized_delay_percentage.setter def bessel_normalized_delay_percentage(self, column: BesselRipplePercentage): status = self._dll.setBesselRipplePercentage(column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def pass_band_ripple(self) -> str: @@ -951,13 +952,13 @@ def arith_symmetry(self) -> bool: """ arith_symmetry = c_bool() status = self._dll.getArithSymmetry(byref(arith_symmetry)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(arith_symmetry.value) @arith_symmetry.setter def arith_symmetry(self, arith_symmetry: bool): status = self._dll.setArithSymmetry(arith_symmetry) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def asymmetric(self) -> bool: @@ -970,13 +971,13 @@ def asymmetric(self) -> bool: """ asymmetric = c_bool() status = self._dll.getAsymmetric(byref(asymmetric)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(asymmetric.value) @asymmetric.setter def asymmetric(self, asymmetric: bool): status = self._dll.setAsymmetric(asymmetric) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def asymmetric_low_order(self) -> int: @@ -989,13 +990,13 @@ def asymmetric_low_order(self) -> int: """ asymmetric_low_order = c_int() status = self._dll.getAsymmetricLowOrder(byref(asymmetric_low_order)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(asymmetric_low_order.value) @asymmetric_low_order.setter def asymmetric_low_order(self, asymmetric_low_order: int): status = self._dll.setAsymmetricLowOrder(asymmetric_low_order) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def asymmetric_high_order(self) -> int: @@ -1008,13 +1009,13 @@ def asymmetric_high_order(self) -> int: """ asymmetric_high_order = c_int() status = self._dll.getAsymmetricHighOrder(byref(asymmetric_high_order)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(asymmetric_high_order.value) @asymmetric_high_order.setter def asymmetric_high_order(self, asymmetric_high_order: int): status = self._dll.setAsymmetricHighOrder(asymmetric_high_order) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def asymmetric_low_stop_band_ratio(self) -> str: @@ -1128,14 +1129,14 @@ def gaussian_bessel_reflection(self) -> GaussianBesselReflection: index = c_int() gaussian_bessel_reflection = list(GaussianBesselReflection) status = self._dll.getGaussianBesselReflection(byref(index)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) gaussian_bessel_reflection = gaussian_bessel_reflection[index.value] return gaussian_bessel_reflection @gaussian_bessel_reflection.setter def gaussian_bessel_reflection(self, column: GaussianBesselReflection): status = self._dll.setGaussianBesselReflection(column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def even_order(self) -> bool: @@ -1148,13 +1149,13 @@ def even_order(self) -> bool: """ even_order = c_bool() status = self._dll.getEvenOrderMode(byref(even_order)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(even_order.value) @even_order.setter def even_order(self, even_order: bool): status = self._dll.setEvenOrderMode(even_order) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def even_order_refl_zero(self) -> bool: @@ -1167,13 +1168,13 @@ def even_order_refl_zero(self) -> bool: """ even_order_refl_zero = c_bool() status = self._dll.getEvenReflZeroTo0(byref(even_order_refl_zero)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(even_order_refl_zero.value) @even_order_refl_zero.setter def even_order_refl_zero(self, even_order_refl_zero: bool): status = self._dll.setEvenReflZeroTo0(even_order_refl_zero) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def even_order_trn_zero(self) -> bool: @@ -1186,13 +1187,13 @@ def even_order_trn_zero(self) -> bool: """ even_order_trn_zero = c_bool() status = self._dll.getEvenTrnZeroToInf(byref(even_order_trn_zero)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(even_order_trn_zero.value) @even_order_trn_zero.setter def even_order_trn_zero(self, even_order_trn_zero: bool): status = self._dll.setEvenTrnZeroToInf(even_order_trn_zero) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def constrict_ripple(self) -> bool: @@ -1205,13 +1206,13 @@ def constrict_ripple(self) -> bool: """ constrict_ripple = c_bool() status = self._dll.getConstrictRipple(byref(constrict_ripple)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(constrict_ripple.value) @constrict_ripple.setter def constrict_ripple(self, constrict_ripple: bool): status = self._dll.setConstrictRipple(constrict_ripple) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def single_point_ripple(self) -> bool: @@ -1224,7 +1225,7 @@ def single_point_ripple(self) -> bool: """ single_point_ripple = c_bool() status = self._dll.getSinglePointRipple(byref(single_point_ripple)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(single_point_ripple.value) @single_point_ripple.setter @@ -1242,13 +1243,13 @@ def half_band_ripple(self) -> bool: """ half_band_point_ripple = c_bool() status = self._dll.getHalfBandRipple(byref(half_band_point_ripple)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(half_band_point_ripple.value) @half_band_ripple.setter def half_band_ripple(self, half_band_ripple: bool): status = self._dll.setHalfBandRipple(half_band_ripple) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def constrict_ripple_percent(self) -> str: @@ -1312,7 +1313,7 @@ def delay_equalizer(self) -> bool: """ delay_equalizer = c_bool() status = self._dll.getDelayEqualizer(byref(delay_equalizer)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(delay_equalizer.value) @delay_equalizer.setter @@ -1330,13 +1331,13 @@ def delay_equalizer_order(self) -> int: """ delay_equalizer_order = c_int() status = self._dll.getDelayEqualizerOrder(byref(delay_equalizer_order)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(delay_equalizer_order.value) @delay_equalizer_order.setter def delay_equalizer_order(self, delay_equalizer_order: int): status = self._dll.setDelayEqualizerOrder(delay_equalizer_order) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def standard_delay_equ_pass_band_attenuation(self) -> bool: @@ -1349,13 +1350,13 @@ def standard_delay_equ_pass_band_attenuation(self) -> bool: """ standard_dealy_equ_cut = c_bool() status = self._dll.getStandardDelayEquCut(byref(standard_dealy_equ_cut)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(standard_dealy_equ_cut.value) @standard_delay_equ_pass_band_attenuation.setter def standard_delay_equ_pass_band_attenuation(self, standard_delay_equ_pass_band_attenuation: bool): status = self._dll.setStandardDelayEquCut(standard_delay_equ_pass_band_attenuation) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def standard_delay_equ_pass_band_attenuation_value_db(self) -> str: diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index a412d1641c9..fb87c4c06c0 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -20,7 +20,7 @@ def restore_defaults(self): def _init_dll_path(self): """Set DLL path and print to screen the status of DLL access.""" - relative_path = "../../../../build_output/64Debug/nuhertz/FilterSolutionsAPI.dll" + relative_path = "../../../build_output/64Release/nuhertz/FilterSolutionsAPI.dll" self.dll_path = os.path.join(os.path.dirname(__file__), relative_path) if not os.path.isfile(self.dll_path): self.dll_path = os.path.join( diff --git a/pyaedt/filtersolutions_core/graph_setup.py b/pyaedt/filtersolutions_core/graph_setup.py index a79223143fc..7277aa35df6 100644 --- a/pyaedt/filtersolutions_core/graph_setup.py +++ b/pyaedt/filtersolutions_core/graph_setup.py @@ -1,7 +1,7 @@ from ctypes import c_char_p from ctypes import c_int -import pyaedt.filtersolutions_core as fspy +import pyaedt class GraphSetup: @@ -21,8 +21,8 @@ class GraphSetup: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_graph_dll_functions() def _define_graph_dll_functions(self): diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py index 25e363f9f4a..cb3be6f7f25 100644 --- a/pyaedt/filtersolutions_core/ideal_response.py +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -7,7 +7,7 @@ from enum import Enum import math -import pyaedt.filtersolutions_core as fspy +import pyaedt from pyaedt.filtersolutions_core.graph_setup import GraphSetup @@ -141,8 +141,8 @@ class IdealResponse: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_response_dll_functions() self.graph_setup = GraphSetup() @@ -197,10 +197,10 @@ def _frequency_response_getter(self, column: FrequencyResponseColumn): """ size = c_int() status = self._dll.getIdealFrequencyResponseSize(byref(size)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) array = (c_double * size.value)() status = self._dll.getIdealFrequencyResponse(array, size.value, column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) values = [float(val) for val in array] return values @@ -219,10 +219,10 @@ def _time_response_getter(self, column: TimeResponseColumn): """ size = c_int() status = self._dll.getIdealTimeResponseSize(byref(size)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) array = (c_double * size.value)() status = self._dll.getIdealTimeResponse(array, size.value, column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) values = [float(val) for val in array] return values @@ -241,10 +241,10 @@ def _sparamaters_response_getter(self, column: SParametersResponseColumn): """ size = c_int() status = self._dll.getIdealSParamatersResponseSize(byref(size)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) array = (c_double * size.value)() status = self._dll.getIdealSParamatersResponse(array, size.value, column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) values = [float(val) for val in array] return values @@ -263,10 +263,10 @@ def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): """ size = c_int() status = self._dll.getIdealPoleZerosResponseSize(byref(size), column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) array = (c_double * size.value)() status = self._dll.getIdealPoleZerosResponse(array, size.value, column.value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) values = [float(val) for val in array] return values @@ -280,7 +280,7 @@ def transfer_function_response(self): """ size = c_int() status = self._dll.getIdealTransferFunctionResponseSize(byref(size)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) transfer_function_response_string = self._dll_interface.get_string( self._dll.getIdealTransferFunctionResponse, max_size=size.value ) @@ -297,13 +297,13 @@ def vsg_analysis_enabled(self) -> bool: vsg_analysis_enabled = c_bool() status = self._dll.getVSGAnalsyis(byref(vsg_analysis_enabled)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(vsg_analysis_enabled.value) @vsg_analysis_enabled.setter def vsg_analysis_enabled(self, filter_vsg_analysis_enabled: bool): status = self._dll.setVSGAnalsyis(filter_vsg_analysis_enabled) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def frequency_response( self, diff --git a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py index 52ebba8a0ff..2bfb4afa75d 100644 --- a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py +++ b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py @@ -4,7 +4,7 @@ from ctypes import c_char_p from ctypes import c_int -import pyaedt.filtersolutions_core as fspy +import pyaedt class LumpedNodesandLeads: @@ -27,8 +27,8 @@ class LumpedNodesandLeads: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_nodes_and_leads_dll_functions() def _define_nodes_and_leads_dll_functions(self): @@ -180,13 +180,13 @@ def c_node_compensate(self) -> bool: """ c_node_compensate = c_bool() status = self._dll.getLumpedCNodeLedComensate(byref(c_node_compensate)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(c_node_compensate.value) @c_node_compensate.setter def c_node_compensate(self, c_node_compensate: bool): status = self._dll.setLumpedCNodeLedComensate(c_node_compensate) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def l_node_compensate(self) -> bool: @@ -199,10 +199,10 @@ def l_node_compensate(self) -> bool: """ l_node_compensate = c_bool() status = self._dll.getLumpedLNodeLedComensate(byref(l_node_compensate)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(l_node_compensate.value) @l_node_compensate.setter def l_node_compensate(self, l_node_compensate: bool): status = self._dll.setLumpedLNodeLedComensate(l_node_compensate) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/lumped_parasitics.py b/pyaedt/filtersolutions_core/lumped_parasitics.py index 71337290e20..768096a6afc 100644 --- a/pyaedt/filtersolutions_core/lumped_parasitics.py +++ b/pyaedt/filtersolutions_core/lumped_parasitics.py @@ -1,7 +1,7 @@ from ctypes import c_char_p from ctypes import c_int -import pyaedt.filtersolutions_core as fspy +import pyaedt class LumpedParasitics: @@ -24,8 +24,8 @@ class LumpedParasitics: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_parasitics_dll_functions() def _define_parasitics_dll_functions(self): diff --git a/pyaedt/filtersolutions_core/lumped_termination_impedance.py b/pyaedt/filtersolutions_core/lumped_termination_impedance.py index 32910454f21..67e45afc184 100644 --- a/pyaedt/filtersolutions_core/lumped_termination_impedance.py +++ b/pyaedt/filtersolutions_core/lumped_termination_impedance.py @@ -6,7 +6,7 @@ from ctypes import create_string_buffer from enum import Enum -import pyaedt.filtersolutions_core as fspy +import pyaedt class ComplexTerminationDefinition(Enum): @@ -71,8 +71,8 @@ class LumpedTerminationImpedance: """ def __init__(self, table_type): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_termination_impedance_dll_functions() self.table_type = table_type @@ -166,7 +166,7 @@ def row_count(self) -> int: """ table_row_count = c_int() status = self._dll.getComplexTableRowCount(byref(table_row_count), self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(table_row_count.value) def row(self, row_index): @@ -198,7 +198,7 @@ def row(self, row_index): self.table_type_to_bool(), 100, ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) frequency_value_string = frequency_value_buffer.value.decode("utf-8") real_value_string = real_value_buffer.value.decode("utf-8") imag_value_string = imag_value_buffer.value.decode("utf-8") @@ -230,7 +230,7 @@ def update_row(self, row_index, frequency="", real="", imag=""): imag_bytes_value, self.table_type_to_bool(), ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, frequency, real, imag): """Append frequencies and complex impedances at the end row of the source and load complex tables. @@ -252,7 +252,7 @@ def append_row(self, frequency, real, imag): imag_bytes_value, self.table_type_to_bool(), ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, frequency, real, imag): """Insert frequencies and complex impedances at given index of the complex impedances tables. @@ -277,7 +277,7 @@ def insert_row(self, row_index, frequency, real, imag): imag_bytes_value, self.table_type_to_bool(), ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): """Remove frequencies and complex impedances at given indexof the complex impedances tables. @@ -288,7 +288,7 @@ def remove_row(self, row_index): The row index on complex impedances tables. Starting value is 0 and maximum value is 99. """ status = self._dll.removeComplexTableRow(row_index, self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def complex_definition(self) -> ComplexTerminationDefinition: @@ -305,7 +305,7 @@ def complex_definition(self) -> ComplexTerminationDefinition: self.table_type_to_bool(), 100, ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) type_string = type_string_buffer.value.decode("utf-8") return self._dll_interface.string_to_enum(ComplexTerminationDefinition, type_string) @@ -314,7 +314,7 @@ def complex_definition(self, complex_definition: ComplexTerminationDefinition): string_value = self._dll_interface.enum_to_string(complex_definition) string_bytes_value = bytes(string_value, "ascii") status = self._dll.setLumpedComplexDefinition(string_bytes_value, self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def reactance_type(self) -> ComplexReactanceType: @@ -332,7 +332,7 @@ def reactance_type(self) -> ComplexReactanceType: self.table_type_to_bool(), 100, ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) type_string = type_string_buffer.value.decode("utf-8") return self._dll_interface.string_to_enum(ComplexReactanceType, type_string) @@ -341,7 +341,7 @@ def reactance_type(self, reactance_type: ComplexReactanceType): string_value = self._dll_interface.enum_to_string(reactance_type) string_bytes_value = bytes(string_value, "ascii") status = self._dll.setLumpedComplexReactanceType(string_bytes_value, self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def compensation_enabled(self) -> bool: @@ -354,13 +354,13 @@ def compensation_enabled(self) -> bool: """ compensation_enabled = c_bool() status = self._dll.getLumpedComplexImpCompensateEnabled(byref(compensation_enabled), self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(compensation_enabled.value) @compensation_enabled.setter def compensation_enabled(self, compensation_enabled: bool): status = self._dll.setLumpedComplexImpCompensateEnabled(compensation_enabled, self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def compensation_order(self) -> int: @@ -373,10 +373,10 @@ def compensation_order(self) -> int: """ compensation_order = c_int() status = self._dll.getLumpedComplexCompOrder(byref(compensation_order), self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(compensation_order.value) @compensation_order.setter def compensation_order(self, compensation_order: int): status = self._dll.setLumpedComplexCompOrder(compensation_order, self.table_type_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index 00d2fa2612e..ec87bff601d 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -4,7 +4,7 @@ from ctypes import c_char_p from ctypes import c_int -import pyaedt.filtersolutions_core as fspy +import pyaedt class LumpedTopology: @@ -28,8 +28,8 @@ class LumpedTopology: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_topology_dll_functions() def _define_topology_dll_functions(self): @@ -184,13 +184,13 @@ def current_source(self) -> bool: """ current_source = c_bool() status = self._dll.getLumpedCurrentSource(byref(current_source)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(current_source.value) @current_source.setter def current_source(self, current_source: bool): status = self._dll.setLumpedCurrentSource(current_source) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def first_shunt(self) -> bool: @@ -204,13 +204,13 @@ def first_shunt(self) -> bool: """ first_shunt = c_bool() status = self._dll.getLumpedFirstElementShunt(byref(first_shunt)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(first_shunt.value) @first_shunt.setter def first_shunt(self, first_shunt: bool): status = self._dll.setLumpedFirstElementShunt(first_shunt) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def bridge_t(self) -> bool: @@ -223,13 +223,13 @@ def bridge_t(self) -> bool: """ bridge_t = c_bool() status = self._dll.getLumpedBridgeT(byref(bridge_t)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(bridge_t.value) @bridge_t.setter def bridge_t(self, bridge_t: bool): status = self._dll.setLumpedBridgeT(bridge_t) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def bridge_t_low(self) -> bool: @@ -242,13 +242,13 @@ def bridge_t_low(self) -> bool: """ bridge_t_low = c_bool() status = self._dll.getLumpedBridgeTLow(byref(bridge_t_low)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(bridge_t_low.value) @bridge_t_low.setter def bridge_t_low(self, bridge_t_low: bool): status = self._dll.setLumpedBridgeTLow(bridge_t_low) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def bridge_t_high(self) -> bool: @@ -261,13 +261,13 @@ def bridge_t_high(self) -> bool: """ bridge_t_high = c_bool() status = self._dll.getLumpedBridgeTHigh(byref(bridge_t_high)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(bridge_t_high.value) @bridge_t_high.setter def bridge_t_high(self, bridge_t_high: bool): status = self._dll.setLumpedBridgeTHigh(bridge_t_high) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def equal_inductors(self) -> bool: @@ -280,13 +280,13 @@ def equal_inductors(self) -> bool: """ equal_inductors = c_bool() status = self._dll.getLumpedEqualInductors(byref(equal_inductors)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(equal_inductors.value) @equal_inductors.setter def equal_inductors(self, equal_inductors: bool): status = self._dll.setLumpedEqualInductors(equal_inductors) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def equal_capacitors(self) -> bool: @@ -299,13 +299,13 @@ def equal_capacitors(self) -> bool: """ equal_capacitors = c_bool() status = self._dll.getLumpedEqualCapacitors(byref(equal_capacitors)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(equal_capacitors.value) @equal_capacitors.setter def equal_capacitors(self, equal_capacitors: bool): status = self._dll.setLumpedEqualCapacitors(equal_capacitors) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def equal_legs(self) -> bool: @@ -318,13 +318,13 @@ def equal_legs(self) -> bool: """ equal_legs = c_bool() status = self._dll.getLumpedEqualLegs(byref(equal_legs)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(equal_legs.value) @equal_legs.setter def equal_legs(self, equal_legs: bool): status = self._dll.setLumpedEqualLegs(equal_legs) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def high_low_pass(self) -> bool: @@ -337,13 +337,13 @@ def high_low_pass(self) -> bool: """ high_low_pass = c_bool() status = self._dll.getLumpedHighLowPass(byref(high_low_pass)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(high_low_pass.value) @high_low_pass.setter def high_low_pass(self, high_low_pass: bool): status = self._dll.setLumpedHighLowPass(high_low_pass) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def high_low_pass_min_ind(self) -> bool: @@ -356,13 +356,13 @@ def high_low_pass_min_ind(self) -> bool: """ high_low_pass_min_ind = c_bool() status = self._dll.getLumpedHighLowPassMinInd(byref(high_low_pass_min_ind)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(high_low_pass_min_ind.value) @high_low_pass_min_ind.setter def high_low_pass_min_ind(self, high_low_pass_min_ind: bool): status = self._dll.setLumpedHighLowPassMinInd(high_low_pass_min_ind) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def zig_zag(self) -> bool: @@ -375,13 +375,13 @@ def zig_zag(self) -> bool: """ zig_zag = c_bool() status = self._dll.getLumpedZigZag(byref(zig_zag)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(zig_zag.value) @zig_zag.setter def zig_zag(self, zig_zag: bool): status = self._dll.setLumpedZigZag(zig_zag) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def min_ind(self) -> bool: @@ -394,13 +394,13 @@ def min_ind(self) -> bool: """ min_ind = c_bool() status = self._dll.getLumpedMinInd(byref(min_ind)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(min_ind.value) @min_ind.setter def min_ind(self, min_ind: bool): status = self._dll.setLumpedMinInd(min_ind) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def min_cap(self) -> bool: @@ -413,13 +413,13 @@ def min_cap(self) -> bool: """ min_cap = c_bool() status = self._dll.getLumpedMinCap(byref(min_cap)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(min_cap.value) @min_cap.setter def min_cap(self, min_cap: bool): status = self._dll.setLumpedMinCap(min_cap) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def set_source_res(self) -> bool: @@ -432,13 +432,13 @@ def set_source_res(self) -> bool: """ set_source_res = c_bool() status = self._dll.getLumpedSourceRes(byref(set_source_res)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(set_source_res.value) @set_source_res.setter def set_source_res(self, set_source_res: bool): status = self._dll.setLumpedSourceRes(set_source_res) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def trap_topology(self) -> bool: @@ -451,13 +451,13 @@ def trap_topology(self) -> bool: """ trap_topology = c_bool() status = self._dll.getLumpedTrapTopology(byref(trap_topology)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(trap_topology.value) @trap_topology.setter def trap_topology(self, trap_topology: bool): status = self._dll.setLumpedTrapTopology(trap_topology) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def node_cap_ground(self) -> bool: @@ -470,13 +470,13 @@ def node_cap_ground(self) -> bool: """ node_cap_ground = c_bool() status = self._dll.getLumpedNodeCapGround(byref(node_cap_ground)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(node_cap_ground.value) @node_cap_ground.setter def node_cap_ground(self, node_cap_ground: bool): status = self._dll.setLumpedNodeCapGround(node_cap_ground) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def match_impedance(self) -> bool: @@ -489,13 +489,13 @@ def match_impedance(self) -> bool: """ match_impedance = c_bool() status = self._dll.getLumpedMatchImpedance(byref(match_impedance)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(match_impedance.value) @match_impedance.setter def match_impedance(self, match_impedance: bool): status = self._dll.setLumpedMatchImpedance(match_impedance) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def complex_termination(self) -> bool: @@ -508,13 +508,13 @@ def complex_termination(self) -> bool: """ complex_termination = c_bool() status = self._dll.getLumpedComplexTermination(byref(complex_termination)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(complex_termination.value) @complex_termination.setter def complex_termination(self, complex_termination: bool): status = self._dll.setLumpedComplexTermination(complex_termination) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def complex_element_tune_enabled(self) -> bool: @@ -527,19 +527,19 @@ def complex_element_tune_enabled(self) -> bool: """ complex_element_tune_enabled = c_bool() status = self._dll.getLumpedComplexElementTuneEnabled(byref(complex_element_tune_enabled)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(complex_element_tune_enabled.value) @complex_element_tune_enabled.setter def complex_element_tune_enabled(self, complex_element_tune_enabled: bool): status = self._dll.setLumpedComplexElementTuneEnabled(complex_element_tune_enabled) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def circuit_response(self): """Execute real filter synthesis""" size = c_int() status = self._dll.getLumpedCircuitResponseSize(byref(size)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) circuit_response_string = self._dll_interface.get_string( self._dll.getLumpedCircuitResponse, max_size=size.value ) diff --git a/pyaedt/filtersolutions_core/multiple_bands_table.py b/pyaedt/filtersolutions_core/multiple_bands_table.py index ecbb4649a72..d66647e4597 100644 --- a/pyaedt/filtersolutions_core/multiple_bands_table.py +++ b/pyaedt/filtersolutions_core/multiple_bands_table.py @@ -4,7 +4,7 @@ from ctypes import c_int from ctypes import create_string_buffer -import pyaedt.filtersolutions_core as fspy +import pyaedt class MultipleBandsTable: @@ -26,8 +26,8 @@ class MultipleBandsTable: """ def __init__(self): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_multiple_bands_dll_functions() def _define_multiple_bands_dll_functions(self): @@ -61,7 +61,7 @@ def row_count(self) -> int: """ table_row_count = c_int() status = self._dll.getMultipleBandsTableRowCount(byref(table_row_count)) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(table_row_count.value) def row(self, row_index): @@ -83,7 +83,7 @@ def row(self, row_index): lower_value_buffer = create_string_buffer(100) upper_value_buffer = create_string_buffer(100) status = self._dll.getMultipleBandsTableRow(row_index, lower_value_buffer, upper_value_buffer, 100) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) lower_value_string = lower_value_buffer.value.decode("utf-8") upper_value_string = upper_value_buffer.value.decode("utf-8") return lower_value_string, upper_value_string @@ -103,7 +103,7 @@ def update_row(self, row_index, lower_frequency="", upper_frequency=""): lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") status = self._dll.updateMultipleBandsTableRow(row_index, lower_bytes_value, upper_bytes_value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, lower_frequency, upper_frequency): """Append lower and upper frequencies at the end row of multiple bands table. @@ -116,7 +116,7 @@ def append_row(self, lower_frequency, upper_frequency): lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") status = self._dll.appendMultipleBandsTableRow(lower_bytes_value, upper_bytes_value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, lower_frequency, upper_frequency): """Insert lower and upper frequencies at given index. @@ -131,7 +131,7 @@ def insert_row(self, row_index, lower_frequency, upper_frequency): lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") status = self._dll.insertMultipleBandsTableRow(row_index, lower_bytes_value, upper_bytes_value) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): """Remove lower and upper frequencies at given index. @@ -142,4 +142,4 @@ def remove_row(self, row_index): The row index on multiple bands table. Starting value is 0 and maximum value is 6. """ status = self._dll.removeMultipleBandsTableRow(row_index) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/transmission_zeros.py b/pyaedt/filtersolutions_core/transmission_zeros.py index 4d06c64ea1e..a1a2ffed4d5 100644 --- a/pyaedt/filtersolutions_core/transmission_zeros.py +++ b/pyaedt/filtersolutions_core/transmission_zeros.py @@ -6,7 +6,7 @@ from ctypes import create_string_buffer from enum import Enum -import pyaedt.filtersolutions_core as fspy +import pyaedt class TableFormat(Enum): @@ -42,8 +42,8 @@ class TransmissionZeros: """ def __init__(self, table_format): - self._dll = fspy._dll_interface()._dll - self._dll_interface = fspy._dll_interface() + self._dll = pyaedt.filtersolutions_core._dll_interface()._dll + self._dll_interface = pyaedt.filtersolutions_core._dll_interface() self._define_transmission_zeros_dll_functions() self.table_format = table_format @@ -116,7 +116,7 @@ def row_count(self) -> int: """ table_row_count = c_int() status = self._dll.getTransmissionZerosTableRowCount(byref(table_row_count), self.table_format_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(table_row_count.value) def row(self, row_index): @@ -144,7 +144,7 @@ def row(self, row_index): self.table_format_to_bool(), 100, ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) zero_value_string = zero_value_buffer.value.decode("utf-8") position_value_string = position_value_buffer.value.decode("utf-8") return zero_value_string, position_value_string @@ -171,7 +171,7 @@ def update_row(self, row_index, zero="", position=""): position_bytes_value, self.table_format_to_bool(), ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, zero, position=""): """Append ratios or frequencies at the end row of transmission zeros table. @@ -188,7 +188,7 @@ def append_row(self, zero, position=""): status = self._dll.appendTransmissionZerosTableRow( zero_bytes_value, position_bytes_value, self.table_format_to_bool() ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, zero, position=""): """Insert ratios or frequencies at given index of the transmission zeros table. @@ -210,7 +210,7 @@ def insert_row(self, row_index, zero, position=""): position_bytes_value, self.table_format_to_bool(), ) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): """Remove ratios or frequencies at given index of the transmission zeros table. @@ -221,14 +221,14 @@ def remove_row(self, row_index): The row index on transmission zeros table. Starting value is 0 and maximum value is 9. """ status = self._dll.removeTransmissionZerosTableRow(row_index, self.table_format_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def clear_row(self): """Clear all entries of the transmission zeros table.""" status = self._dll.clearTransmissionZerosTableRow(self.table_format_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) def default_position(self): """Restore default position of transmissison zeros.""" status = self._dll.defaultPositionEnabled(self.table_format_to_bool()) - fspy._dll_interface().raise_error(status) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) From 066cbffac8f4d14d370e5c3844a25e7913af320e Mon Sep 17 00:00:00 2001 From: raghajaf Date: Mon, 27 May 2024 09:22:17 -0400 Subject: [PATCH 05/26] feat/draft_filtersolutions: Docstring terms are updated --- .../filltersolutionsexample.py | 2 +- pyaedt/filtersolutions.py | 54 +++++-------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/examples/08-Filtersolutions/filltersolutionsexample.py b/examples/08-Filtersolutions/filltersolutionsexample.py index 8c169e4a35a..bd771f8ecee 100644 --- a/examples/08-Filtersolutions/filltersolutionsexample.py +++ b/examples/08-Filtersolutions/filltersolutionsexample.py @@ -1,5 +1,5 @@ import pyaedt - +import matplotlib from pyaedt.filtersolutions_core.attributes import FilterType from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.filtersolutions_core.attributes import StopbandDefinition diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index a030386bfd5..18a0bbd8376 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -21,28 +21,26 @@ class FilterSolutions: Parameters ---------- - filter_name: str, optional - Name of the filter to select. The default is ``FilterSolutions API Session``. - filter_class: str, optional - The class (band definition) of filter. The full list of classes are listed in FilterClass enum. - The default is `LOW_PASS`. - filter_type: str, optional - The type (mathematical formulation) of filter. The full list of types are listed in FilterType enum. - The default is `BUTTERWORTH`. + projectname: str, optional + Name of the projest to select. The default is ``FilterSolutions API Session``. + implementation_type: FilterImplementation, optional + The technology used to implement the filter. + The full list of implementations are listed in FilterImplementation enum. + The default is `LUMPED`. + Returns + ------- + :enum:'FilterImplementation' Examples -------- Create an instance of FilterSolutions with a band pass elliptic ideal filter. - >>> from pyaedt import fspy.ideal_filters - >>> from fspy.filter_design import FilterClass - >>> from fspy.filter_design import FilterType + >>> import pyaedt + >>> from pyaedt.filtersolutions_core.attributes import FilterImplementation - >>> design = fspy.ideal_filters.IdealDesign( - >>> filter_name = "filter_design", - >>> filter_class = FilterClass.BAND_PASS, - >>> filter_type = FilterType.ELLIPTIC, + >>> design = pyaedt.FilterSolutions(projectname= "fs1", + >>> implementation_type= FilterImplementation.LUMPED, >>> ) """ @@ -60,32 +58,6 @@ def _init_lumped_design(self): This class allows you to create an instance of FilterSolutions and define the parameters for a lumped filter. The class has access to ideal and lumped filter attributes and calcultaed output parameters. - - Parameters - ---------- - filter_name: str, optional - Name of the filter to select. The default is ``FilterSolutions API Session``. - filter_class: str, optional - The class (band definition) of filter. The full list of classes are listed in FilterClass enum. - The default is `LOW_PASS`. - filter_type: str, optional - The type (mathematical formulation) of filter. The full list of types are listed in FilterType enum. - The default is `BUTTERWORTH`. - - - Examples - -------- - Create an instance of FilterSolutions with a band pass elliptic lumped filter. - - >>> from pyaedt import fspy.lumped_filters - >>> from fspy.filter_design import FilterClass - >>> from fspy.filter_design import FilterType - - >>> design = fspy.ideal_filters.LumpedDesign( - >>> filter_name = "filter_design", - >>> filter_class = FilterClass.BAND_PASS, - >>> filter_type = FilterType.ELLIPTIC, - >>> ) """ self.attributes = Attributes() From 18a79b9b318e85106fea21661696d0d6f7e072f5 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Thu, 30 May 2024 12:21:15 -0400 Subject: [PATCH 06/26] feat/draft_filtersolutions: example updated. --- examples/02-HFSS/HFSS_Dipole.py | 5 +- .../filltersolutionsexample.py | 46 +++++++++++++++---- pyaedt.code-workspace | 10 ---- 3 files changed, 42 insertions(+), 19 deletions(-) delete mode 100644 pyaedt.code-workspace diff --git a/examples/02-HFSS/HFSS_Dipole.py b/examples/02-HFSS/HFSS_Dipole.py index 7a7b1ff5378..93700435f3a 100644 --- a/examples/02-HFSS/HFSS_Dipole.py +++ b/examples/02-HFSS/HFSS_Dipole.py @@ -11,6 +11,7 @@ import os import pyaedt + project_name = pyaedt.generate_unique_project_name(project_name="dipole") ########################################################## @@ -18,7 +19,7 @@ # ~~~~~~~~~~~~~~~~ # Set AEDT version. -aedt_version = "2024.2" +aedt_version = "2024.1" ############################################################################### # Set non-graphical mode @@ -39,7 +40,9 @@ # Launch HFSS # ~~~~~~~~~~~ # Launch HFSS 2023 R2 in graphical mode. + hfss = pyaedt.Hfss(projectname=project_name, solution_type="Modal") + ############################################################################### # Define variable # ~~~~~~~~~~~~~~~ diff --git a/examples/08-Filtersolutions/filltersolutionsexample.py b/examples/08-Filtersolutions/filltersolutionsexample.py index bd771f8ecee..f70be71d621 100644 --- a/examples/08-Filtersolutions/filltersolutionsexample.py +++ b/examples/08-Filtersolutions/filltersolutionsexample.py @@ -1,12 +1,42 @@ -import pyaedt -import matplotlib -from pyaedt.filtersolutions_core.attributes import FilterType -from pyaedt.filtersolutions_core.attributes import FilterImplementation -from pyaedt.filtersolutions_core.attributes import StopbandDefinition +# # Design a Lumped Element Filter +# This Python script demonstrates the use of the `fspy` library to design and +# visualize the frequency response of a band-pass Butterworth filter. +import pyaedt +from pyaedt.filtersolutions_core.attributes import FilterType, FilterClass, FilterImplementation +from pyaedt.filtersolutions_core.ideal_response import FrequencyResponseColumn +import matplotlib.pyplot as plt +# Create the LumpedDesign and assign the class, type, frequency, and order. if __name__ == "__main__": design = pyaedt.FilterSolutions(projectname= "fs1", implementation_type= FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY - print(design.attributes.stop_band_definition) \ No newline at end of file + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.BUTTERWORTH + design.attributes.pass_band_center_frequency = "1G" + design.attributes.pass_band_width_frequency = "500M" + design.attributes.filter_order = 5 + + # Plot the frequency response of the filter. + freq, mag_db = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) + plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero") + def format_plot(): + plt.xlabel("Frequency (Hz)") + plt.ylabel("Magnitude S21 (dB)") + plt.title("Ideal Frequency Response") + plt.xscale("log") + plt.legend() + plt.grid() + format_plot() + plt.show() + + # Add a transmission zeros that yields nulls separated by 2 times the pass band width (1 GHz). + design.transmission_zeros_ratio.append_row("2.0") + freq_with_zero, mag_db_with_zero = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) + plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero") + plt.plot(freq_with_zero, mag_db_with_zero, linewidth=2.0, label="With Tx Zero") + format_plot() + plt.show() + + # Generate the netlist for the filter design. + netlist = design.topology.circuit_response() + print("Netlist: \n", netlist) diff --git a/pyaedt.code-workspace b/pyaedt.code-workspace deleted file mode 100644 index fd3b45f96dd..00000000000 --- a/pyaedt.code-workspace +++ /dev/null @@ -1,10 +0,0 @@ -{ - "folders": [ - { - "path": "." - } - ], - "settings": { - "git.ignoreLimitWarning": true - } -} \ No newline at end of file From 24cb54de65bdc3a4e46d87f21294b140fa6028cd Mon Sep 17 00:00:00 2001 From: raghajaf Date: Fri, 31 May 2024 09:18:04 -0400 Subject: [PATCH 07/26] feat/draft_filtersolutions: Test skip for current release --- .../test_filter/test_attributes.py | 50 +++++++++++++++++++ .../test_filter/test_dll_interface.py | 5 ++ .../test_filter/test_graph_setup.py | 7 +++ .../test_filter/test_ideal_response.py | 11 ++++ .../test_filter/test_multiple_bands_table.py | 7 +++ .../test_filter/test_transmission_zeros.py | 9 ++++ .../test_lumped_nodes_and_leads.py | 11 ++++ .../test_lumped_parasitics.py | 11 ++++ .../test_lumped_termination_impedance.py | 11 ++++ .../test_lumped_topology.py | 33 +++++++++++- .../test_raise_error.py | 2 + 11 files changed, 156 insertions(+), 1 deletion(-) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 6757cacbfa2..d25ac0c9fd9 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -1,3 +1,4 @@ +from _unittest_solvers.conftest import config import pytest import pyaedt @@ -14,6 +15,7 @@ from pyaedt.filtersolutions_core.attributes import StopbandDefinition +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_type(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.filter_type == FilterType.BUTTERWORTH @@ -27,6 +29,7 @@ def test_filter_type(): assert design.attributes.filter_type == ftype +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_class(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.filter_class == FilterClass.LOW_PASS @@ -42,6 +45,7 @@ def test_filter_class(): assert design.attributes.filter_class == fclass +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_multiple_bands_enabled(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.filter_multiple_bands_enabled is False @@ -49,6 +53,7 @@ def test_filter_multiple_bands_enabled(): assert design.attributes.filter_multiple_bands_enabled +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_multiple_bands_low_pass_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True @@ -58,6 +63,7 @@ def test_filter_multiple_bands_low_pass_frequency(): assert design.attributes.filter_multiple_bands_low_pass_frequency == "500M" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_multiple_bands_high_pass_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True @@ -67,6 +73,7 @@ def test_filter_multiple_bands_high_pass_frequency(): assert design.attributes.filter_multiple_bands_high_pass_frequency == "500M" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_implementation(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert len(FilterImplementation) == 5 @@ -75,6 +82,7 @@ def test_filter_implementation(): assert design.attributes.filter_implementation == fimplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_diplexer_type(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert len(DiplexerType) == 6 @@ -87,6 +95,7 @@ def test_diplexer_type(): assert design.attributes.diplexer_type == diplexer_type +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_order(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 @@ -104,6 +113,7 @@ def test_order(): assert info.value.args[0] == "The maximum order is 21" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_order_stop_band_att(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" @@ -111,6 +121,7 @@ def test_minimum_order_stop_band_att(): assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_order_stop_band_freq(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" @@ -118,6 +129,7 @@ def test_minimum_order_stop_band_freq(): assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_order(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 @@ -125,6 +137,7 @@ def test_minimum_order(): assert design.attributes.order == 3 +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_definition(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -135,6 +148,7 @@ def test_pass_band_definition(): assert design.attributes.pass_band_definition == pbd +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_center_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.pass_band_center_frequency == "1G" @@ -142,6 +156,7 @@ def test_pass_band_center_frequency(): assert design.attributes.pass_band_center_frequency == "500M" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -150,6 +165,7 @@ def test_pass_band_frequency(): assert design.attributes.pass_band_width_frequency == "500M" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lower_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -159,6 +175,7 @@ def test_lower_frequency(): assert design.attributes.lower_frequency == "800M" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_upper_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -168,6 +185,7 @@ def test_upper_frequency(): assert design.attributes.upper_frequency == "1.2 G" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_definition(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -178,6 +196,7 @@ def test_stop_band_definition(): assert design.attributes.stop_band_definition == sbd +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_ratio(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -186,6 +205,7 @@ def test_stop_band_ratio(): assert design.attributes.stop_band_ratio == "1.5" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -195,6 +215,7 @@ def test_stop_band_frequency(): assert design.attributes.stop_band_frequency == "1.5 G" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_attenuation(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -204,6 +225,7 @@ def test_stop_band_attenuation(): assert design.attributes.stop_band_attenuation_db == "40" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_pass_band_attenuation(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.standard_pass_band_attenuation @@ -211,6 +233,7 @@ def test_standard_pass_band_attenuation(): assert design.attributes.standard_pass_band_attenuation is False +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_pass_band_attenuation_value_db(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.standard_pass_band_attenuation = False @@ -219,6 +242,7 @@ def test_standard_pass_band_attenuation_value_db(): assert design.attributes.standard_pass_band_attenuation_value_db == "4" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_bessel_normalized_delay(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL @@ -227,6 +251,7 @@ def test_bessel_normalized_delay(): assert design.attributes.bessel_normalized_delay +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_bessel_normalized_delay_period(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL @@ -236,6 +261,7 @@ def test_bessel_normalized_delay_period(): assert design.attributes.bessel_normalized_delay_period == "3" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_bessel_normalized_delay_percentage(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL @@ -246,6 +272,7 @@ def test_bessel_normalized_delay_percentage(): assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_ripple(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -254,6 +281,7 @@ def test_pass_band_ripple(): assert design.attributes.pass_band_ripple == ".03" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_arith_symmetry(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -263,6 +291,7 @@ def test_arith_symmetry(): assert design.attributes.arith_symmetry +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -271,6 +300,7 @@ def test_asymmetric(): assert design.attributes.asymmetric +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_low_order(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -290,6 +320,7 @@ def test_asymmetric_low_order(): assert info.value.args[0] == "The maximum order is 21" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_high_order(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -309,6 +340,7 @@ def test_asymmetric_high_order(): assert info.value.args[0] == "The maximum order is 21" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_low_stop_band_ratio(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -319,6 +351,7 @@ def test_asymmetric_low_stop_band_ratio(): assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_high_stop_band_ratio(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -329,6 +362,7 @@ def test_asymmetric_high_stop_band_ratio(): assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_low_stop_band_attenuation_db(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -339,6 +373,7 @@ def test_asymmetric_low_stop_band_attenuation_db(): assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_high_stop_band_attenuation_db(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS @@ -349,6 +384,7 @@ def test_asymmetric_high_stop_band_attenuation_db(): assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_gaussian_transition(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.GAUSSIAN @@ -358,6 +394,7 @@ def test_gaussian_transition(): assert design.attributes.gaussian_transition == gaussian_transition +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_gaussian_bessel_reflection(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL @@ -367,6 +404,7 @@ def test_gaussian_bessel_reflection(): assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_even_order(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -376,6 +414,7 @@ def test_even_order(): assert design.attributes.even_order is False +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_even_order_refl_zero(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -385,6 +424,7 @@ def test_even_order_refl_zero(): assert design.attributes.even_order_refl_zero is False +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_even_order_trn_zero(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -394,6 +434,7 @@ def test_even_order_trn_zero(): assert design.attributes.even_order_trn_zero is False +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_constrict_ripple(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -402,6 +443,7 @@ def test_constrict_ripple(): assert design.attributes.constrict_ripple +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_single_point_ripple(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -410,6 +452,7 @@ def test_single_point_ripple(): assert design.attributes.single_point_ripple +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_half_band_ripple(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -418,6 +461,7 @@ def test_half_band_ripple(): assert design.attributes.half_band_ripple +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_constrict_ripple_percent(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -427,6 +471,7 @@ def test_constrict_ripple_percent(): assert design.attributes.constrict_ripple_percent == "40%" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_ripple_constriction_band(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -437,6 +482,7 @@ def test_ripple_constriction_band(): assert design.attributes.ripple_constriction_band == ripple_constriction_band +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_single_point_ripple_inf_zeros(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC @@ -447,6 +493,7 @@ def test_single_point_ripple_inf_zeros(): assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_delay_equalizer(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.attributes.delay_equalizer is False @@ -454,6 +501,7 @@ def test_delay_equalizer(): assert design.attributes.delay_equalizer +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_delay_equalizer_order(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True @@ -468,6 +516,7 @@ def test_delay_equalizer_order(): assert info.value.args[0] == "The maximum order is 20" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_delay_equ_pass_band_attenuation(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True @@ -476,6 +525,7 @@ def test_standard_delay_equ_pass_band_attenuation(): assert design.attributes.standard_delay_equ_pass_band_attenuation is False +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_delay_equ_pass_band_attenuation_value_db(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index 7f3736e02e3..e4aa896e25f 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -1,3 +1,4 @@ +from _unittest_solvers.conftest import config import pytest import pyaedt @@ -5,18 +6,22 @@ from pyaedt.filtersolutions_core.attributes import FilterType +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_version(): assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_string_to_enum(): assert pyaedt.filtersolutions_core._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_enum_to_string(): assert pyaedt.filtersolutions_core._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_raise_error(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index 6b9780e309d..aab27be21ec 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -1,7 +1,11 @@ +from _unittest_solvers.conftest import config +import pytest + import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.minimum_frequency == "200 MHz" @@ -9,6 +13,7 @@ def test_minimum_frequency(): assert design.graph_setup.minimum_frequency == "500 MHz" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_maximum_frequency(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.maximum_frequency == "5 GHz" @@ -16,6 +21,7 @@ def test_maximum_frequency(): assert design.graph_setup.maximum_frequency == "2 GHz" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_time(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.minimum_time == "0" @@ -23,6 +29,7 @@ def test_minimum_time(): assert design.graph_setup.minimum_time == "5 ns" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_maximum_time(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.maximum_time == "10n" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index be19470bb48..362caac08c2 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -1,5 +1,6 @@ from resource import resource_path +from _unittest_solvers.conftest import config import pytest import pyaedt @@ -10,6 +11,7 @@ from pyaedt.filtersolutions_core.ideal_response import TimeResponseColumn +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_frequency_response_getter(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) @@ -65,6 +67,7 @@ def test_frequency_response_getter(): assert freqs[-1] == 31214328219.225075 +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_time_response_getter(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) @@ -104,6 +107,7 @@ def test_time_response_getter(): assert time[-1] == pytest.approx(9.966666666666667e-09) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_sparameters_response_getter(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) @@ -133,6 +137,7 @@ def test_sparameters_response_getter(): assert freqs[-1] == pytest.approx(31214328219.225075) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pole_zeros_response_getter(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) @@ -237,6 +242,7 @@ def test_pole_zeros_response_getter(): assert proto_rx_zero_num_y[4] == pytest.approx(0.0) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_vsg_analysis_enabled(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.ideal_response.vsg_analysis_enabled is False @@ -244,6 +250,7 @@ def test_filter_vsg_analysis_enabled(): assert design.ideal_response.vsg_analysis_enabled +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_frequency_response(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) freq, mag_db = design.ideal_response.frequency_response( @@ -262,6 +269,7 @@ def test_frequency_response(): assert mag_db[-1] == pytest.approx(-69.61741290615645) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_time_response(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) time, step_response = design.ideal_response.time_response( @@ -281,6 +289,7 @@ def test_time_response(): assert step_response[-1] == pytest.approx(0.9999999965045667) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_s_parameters(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) freq, s21_db = design.ideal_response.s_parameters( @@ -298,6 +307,7 @@ def test_s_parameters(): assert s21_db[-1] == pytest.approx(-69.61741290615645) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pole_zero_locations(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( @@ -318,6 +328,7 @@ def test_pole_zero_locations(): assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_transfer_function_response(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) list = design.ideal_response.transfer_function_response() diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index 937141f2b36..fe417b6ce93 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -1,21 +1,25 @@ +from _unittest_solvers.conftest import config import pytest import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row_count(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True assert design.multiple_bands_table.row_count == 2 +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True assert design.multiple_bands_table.row(0) == ("2G", "3G") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_update_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True @@ -30,6 +34,7 @@ def test_update_row(): assert design.multiple_bands_table.row(0) == ("200M", "5G") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_append_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True @@ -44,6 +49,7 @@ def test_append_row(): assert info.value.args[0] == "It is not possible to append an empty value" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_insert_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True @@ -56,6 +62,7 @@ def test_insert_row(): assert info.value.args[0] == "The rowIndex must be greater than zero and less than row count" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_remove_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index 7c86964927e..c581596bb68 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -1,15 +1,18 @@ +from _unittest_solvers.conftest import config import pytest import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row_count(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert design.transmission_zeros_frequency.row_count == 0 assert design.transmission_zeros_ratio.row_count == 0 +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: @@ -20,6 +23,7 @@ def test_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_update_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: @@ -30,6 +34,7 @@ def test_update_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_append_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: @@ -51,6 +56,7 @@ def test_append_row(): assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_insert_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: @@ -76,6 +82,7 @@ def test_insert_row(): assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_remove_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: @@ -88,6 +95,7 @@ def test_remove_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_clear_row(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") @@ -104,6 +112,7 @@ def test_clear_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_default_position(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index b4f188bee7b..6a5f23771d6 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -1,9 +1,13 @@ from resource import resource_path +from _unittest_solvers.conftest import config +import pytest + import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_c_node_capacitor(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" @@ -17,6 +21,7 @@ def test_lumped_c_node_capacitor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_c_lead_inductor(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" @@ -30,6 +35,7 @@ def test_lumped_c_lead_inductor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_l_node_capacitor(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" @@ -43,6 +49,7 @@ def test_lumped_l_node_capacitor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_l_lead_inductor(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" @@ -56,6 +63,7 @@ def test_lumped_l_lead_inductor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_r_node_capacitor(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" @@ -69,6 +77,7 @@ def test_lumped_r_node_capacitor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_r_lead_inductor(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" @@ -82,6 +91,7 @@ def test_lumped_r_lead_inductor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_c_node_compensate(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_compensate is False @@ -95,6 +105,7 @@ def test_lumped_c_node_compensate(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_l_node_compensate(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_compensate is False diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 360a8ded62f..87b4ff066ec 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -1,9 +1,13 @@ from resource import resource_path +from _unittest_solvers.conftest import config +import pytest + import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_q(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_q == "Inf" @@ -17,6 +21,7 @@ def test_lumped_capacitor_q(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_rs(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rs == "0" @@ -30,6 +35,7 @@ def test_lumped_capacitor_rs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_rp(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rp == "Inf" @@ -43,6 +49,7 @@ def test_lumped_capacitor_rp(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_ls(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_ls == "0" @@ -56,6 +63,7 @@ def test_lumped_capacitor_ls(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_q(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_q == "Inf" @@ -69,6 +77,7 @@ def test_lumped_inductor_q(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_rs(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rs == "0" @@ -82,6 +91,7 @@ def test_lumped_inductor_rs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_rp(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rp == "Inf" @@ -95,6 +105,7 @@ def test_lumped_inductor_rp(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_cp(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_cp == "0" diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index 73ce12fe885..56a3cd4a73e 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -1,3 +1,4 @@ +from _unittest_solvers.conftest import config import pytest import pyaedt @@ -6,6 +7,7 @@ from pyaedt.filtersolutions_core.lumped_termination_impedance import ComplexTerminationDefinition +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row_count(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -13,6 +15,7 @@ def test_row_count(): assert lumpdesign.load_impedance_table.row_count == 3 +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -20,6 +23,7 @@ def test_row(): assert lumpdesign.load_impedance_table.row(0) == ("0.100G", "1.000", "0.000") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_update_row(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -43,6 +47,7 @@ def test_update_row(): assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_append_row(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -55,6 +60,7 @@ def test_append_row(): assert lumpdesign.load_impedance_table.row(3) == ("100M", "10", "20") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_insert_row(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -64,6 +70,7 @@ def test_insert_row(): assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_remove_row(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -79,6 +86,7 @@ def test_remove_row(): assert info.value.args[0] == "No value is set for this band" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_complex_definition(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -93,6 +101,7 @@ def test_complex_definition(): assert lumpdesign.load_impedance_table.complex_definition == cdef +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_reactance_type(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -107,6 +116,7 @@ def test_reactance_type(): assert lumpdesign.load_impedance_table.reactance_type == creac +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_compensation_enabled(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -118,6 +128,7 @@ def test_compensation_enabled(): assert lumpdesign.load_impedance_table.compensation_enabled +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_compensation_order(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 072850a55bb..39da6bd4dc3 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -1,6 +1,8 @@ -# from pyaedt.filtersolutions_core.lumped_termination_impedance import TerminationType from resource import resource_path +from _unittest_solvers.conftest import config +import pytest + import pyaedt from pyaedt.filtersolutions_core.attributes import DiplexerType from pyaedt.filtersolutions_core.attributes import FilterClass @@ -8,6 +10,7 @@ from pyaedt.filtersolutions_core.attributes import FilterType +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_generator_resistor_30(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.generator_resistor == "50" @@ -21,6 +24,7 @@ def test_lumped_generator_resistor_30(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_load_resistor_30(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.load_resistor == "50" @@ -34,6 +38,7 @@ def test_lumped_load_resistor_30(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_current_source(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.current_source is False @@ -47,6 +52,7 @@ def test_lumped_current_source(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_first_shunt(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt @@ -60,6 +66,7 @@ def test_lumped_first_shunt(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_first_series(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt @@ -73,6 +80,7 @@ def test_lumped_first_series(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_bridge_t(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_type = FilterType.ELLIPTIC @@ -88,6 +96,7 @@ def test_lumped_bridge_t(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_bridge_t_low(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 @@ -107,6 +116,7 @@ def test_lumped_bridge_t_low(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_bridge_t_high(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 @@ -126,6 +136,7 @@ def test_lumped_bridge_t_high(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_equal_inductors(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -141,6 +152,7 @@ def test_lumped_equal_inductors(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_equal_capacitors(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -163,6 +175,7 @@ def test_lumped_equal_capacitors(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_equal_legs(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -178,6 +191,7 @@ def test_lumped_equal_legs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_high_low_pass(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -193,6 +207,7 @@ def test_lumped_high_low_pass(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_high_low_pass_min_ind(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -210,6 +225,7 @@ def test_lumped_high_low_pass_min_ind(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_zig_zag(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -227,6 +243,7 @@ def test_lumped_zig_zag(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_min_ind(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -246,6 +263,7 @@ def test_lumped_min_ind(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_min_cap(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -265,6 +283,7 @@ def test_lumped_min_cap(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_set_source_res(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -285,6 +304,7 @@ def test_lumped_set_source_res(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_trap_topology(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -304,6 +324,7 @@ def test_lumped_trap_topology(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_node_cap_ground(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -321,6 +342,7 @@ def test_lumped_node_cap_ground(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_match_impedance(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS @@ -338,6 +360,7 @@ def test_lumped_match_impedance(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_complex_termination(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.complex_termination is False @@ -345,6 +368,7 @@ def test_lumped_complex_termination(): assert lumpdesign.topology.complex_termination +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_complex_element_tune_enabled(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True @@ -353,6 +377,7 @@ def test_complex_element_tune_enabled(): assert lumpdesign.topology.complex_element_tune_enabled is False +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_circuit_export(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) netlist = lumpdesign.topology.circuit_response() @@ -363,6 +388,7 @@ def test_lumped_circuit_export(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer1_hi_lo(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 @@ -377,6 +403,7 @@ def test_lumped_diplexer1_hi_lo(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer1_bp_1(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 @@ -391,6 +418,7 @@ def test_lumped_diplexer1_bp_1(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer1_bp_2(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 @@ -405,6 +433,7 @@ def test_lumped_diplexer1_bp_2(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer2_bp_bs(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 @@ -419,6 +448,7 @@ def test_lumped_diplexer2_bp_bs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer2_triplexer_1(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 @@ -433,6 +463,7 @@ def test_lumped_diplexer2_triplexer_1(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer2_triplexer_2(): lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index c04b67f5f76..6cd684b0ecd 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -1,9 +1,11 @@ +from _unittest_solvers.conftest import config import pytest import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_raise_error(): design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: From 2219c15326bac21b8265f67775251274b8843187 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Fri, 31 May 2024 09:39:04 -0400 Subject: [PATCH 08/26] feat/draft_filtersolutions: docstring error is fixed. --- pyaedt/filtersolutions_core/lumped_topology.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index ec87bff601d..d9350b1f578 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -8,9 +8,7 @@ class LumpedTopology: - """Defines attributes and parameters of lumped filters.""" - - """Defines attributes of lumped element parasitics. + """Defines attributes and parameters of lumped filters. This class allows you to construct all the necessary attributes for the LumpedDesign class. From 1bd7fe2413986fe0a2e4dc557d52480786a6f4e1 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Mon, 3 Jun 2024 15:55:57 -0400 Subject: [PATCH 09/26] feat/draft_filtersolutions: comments are applied, delay filter is added, linux tests skipped. --- .../test_filter/test_attributes.py | 210 +++++++++++++----- .../test_filter/test_dll_interface.py | 7 +- .../test_filter/test_graph_setup.py | 13 +- .../test_filter/test_ideal_response.py | 31 ++- .../test_filter/test_multiple_bands_table.py | 19 +- .../test_filter/test_transmission_zeros.py | 25 ++- .../test_lumped_nodes_and_leads.py | 25 ++- .../test_lumped_parasitics.py | 25 ++- .../test_lumped_termination_impedance.py | 31 ++- .../test_lumped_topology.py | 88 +++++--- .../test_raise_error.py | 4 +- pyaedt/filtersolutions.py | 17 +- pyaedt/filtersolutions_core/attributes.py | 160 ++++++++++++- pyaedt/generic/design_types.py | 2 - 14 files changed, 499 insertions(+), 158 deletions(-) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index d25ac0c9fd9..a629f8f1967 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -13,14 +13,16 @@ from pyaedt.filtersolutions_core.attributes import RippleConstrictionBandSelect from pyaedt.filtersolutions_core.attributes import SinglePointRippleInfZeros from pyaedt.filtersolutions_core.attributes import StopbandDefinition +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_type(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.filter_type == FilterType.BUTTERWORTH - assert len(FilterType) == 8 + assert len(FilterType) == 9 for fimp in [FilterImplementation.LUMPED]: design.attributes.filter_implementation = fimp @@ -29,9 +31,10 @@ def test_filter_type(): assert design.attributes.filter_type == ftype +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_class(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.filter_class == FilterClass.LOW_PASS # Only lumped supports all classes @@ -45,17 +48,19 @@ def test_filter_class(): assert design.attributes.filter_class == fclass +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_multiple_bands_enabled(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.filter_multiple_bands_enabled is False design.attributes.filter_multiple_bands_enabled = True assert design.attributes.filter_multiple_bands_enabled +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_multiple_bands_low_pass_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True design.attributes.filter_class = FilterClass.LOW_BAND assert design.attributes.filter_multiple_bands_low_pass_frequency == "1G" @@ -63,9 +68,10 @@ def test_filter_multiple_bands_low_pass_frequency(): assert design.attributes.filter_multiple_bands_low_pass_frequency == "500M" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_multiple_bands_high_pass_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True design.attributes.filter_class = FilterClass.BAND_HIGH assert design.attributes.filter_multiple_bands_high_pass_frequency == "1G" @@ -73,18 +79,20 @@ def test_filter_multiple_bands_high_pass_frequency(): assert design.attributes.filter_multiple_bands_high_pass_frequency == "500M" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_implementation(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert len(FilterImplementation) == 5 for fimplementation in FilterImplementation: design.attributes.filter_implementation = fimplementation assert design.attributes.filter_implementation == fimplementation +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_diplexer_type(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert len(DiplexerType) == 6 for index, diplexer_type in enumerate(DiplexerType): if index < 3: @@ -95,9 +103,10 @@ def test_diplexer_type(): assert design.attributes.diplexer_type == diplexer_type +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_order(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 with pytest.raises(RuntimeError) as info: @@ -113,33 +122,66 @@ def test_order(): assert info.value.args[0] == "The maximum order is 21" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_order_stop_band_att(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_order_stop_band_freq(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" design.attributes.minimum_order_stop_band_frequency = "500 MHz" assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +def test_minimum_order_group_delay_error_percent(): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.minimum_order_group_delay_error_percent == "5" + design.attributes.minimum_order_group_delay_error_percent = "7" + assert design.attributes.minimum_order_group_delay_error_percent == "7" + + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +def test_minimum_order_group_delay_cutoff(): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.minimum_order_group_delay_cutoff == "2 GHz" + design.attributes.minimum_order_group_delay_cutoff = "500 MHz" + assert design.attributes.minimum_order_group_delay_cutoff == "500 MHz" + + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +def test_minimum_order_stop_band_freq(): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" + design.attributes.minimum_order_stop_band_frequency = "500 MHz" + assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" + + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_order(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 design.attributes.ideal_minimum_order assert design.attributes.order == 3 +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_definition(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS assert len(PassbandDefinition) == 2 assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY @@ -148,26 +190,29 @@ def test_pass_band_definition(): assert design.attributes.pass_band_definition == pbd +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_center_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.pass_band_center_frequency == "1G" design.attributes.pass_band_center_frequency = "500M" assert design.attributes.pass_band_center_frequency == "500M" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS assert design.attributes.pass_band_width_frequency == "200M" design.attributes.pass_band_width_frequency = "500M" assert design.attributes.pass_band_width_frequency == "500M" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lower_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES assert design.attributes.lower_frequency == "905 M" @@ -175,9 +220,10 @@ def test_lower_frequency(): assert design.attributes.lower_frequency == "800M" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_upper_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES assert design.attributes.upper_frequency == "1.105 G" @@ -185,9 +231,10 @@ def test_upper_frequency(): assert design.attributes.upper_frequency == "1.2 G" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_definition(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC assert len(StopbandDefinition) == 3 assert design.attributes.stop_band_definition == StopbandDefinition.RATIO @@ -196,18 +243,20 @@ def test_stop_band_definition(): assert design.attributes.stop_band_definition == sbd +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_ratio(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.stop_band_ratio == "1.2" design.attributes.stop_band_ratio = "1.5" assert design.attributes.stop_band_ratio == "1.5" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY assert design.attributes.stop_band_frequency == "1.2 G" @@ -215,9 +264,10 @@ def test_stop_band_frequency(): assert design.attributes.stop_band_frequency == "1.5 G" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_stop_band_attenuation(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB assert design.attributes.stop_band_attenuation_db == "60" @@ -225,35 +275,70 @@ def test_stop_band_attenuation(): assert design.attributes.stop_band_attenuation_db == "40" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_pass_band_attenuation(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.standard_pass_band_attenuation design.attributes.standard_pass_band_attenuation = False assert design.attributes.standard_pass_band_attenuation is False +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_pass_band_attenuation_value_db(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.standard_pass_band_attenuation = False assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" design.attributes.standard_pass_band_attenuation_value_db = "4" assert design.attributes.standard_pass_band_attenuation_value_db == "4" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +def test_equiripple_delay(): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.equiripple_delay + design.attributes.equiripple_delay = False + assert design.attributes.equiripple_delay is False + + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +def test_group_delay_ripple_period(): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.group_delay_ripple_period == "2" + design.attributes.group_delay_ripple_period = "3" + assert design.attributes.group_delay_ripple_period == "3" + + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +def test_normalized_group_delay_percentage(): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert len(BesselRipplePercentage) == 6 + for normalized_group_delay_percentage in BesselRipplePercentage: + design.attributes.normalized_group_delay_percentage = normalized_group_delay_percentage + assert design.attributes.normalized_group_delay_percentage == normalized_group_delay_percentage + + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_bessel_normalized_delay(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL assert design.attributes.bessel_normalized_delay is False design.attributes.bessel_normalized_delay = True assert design.attributes.bessel_normalized_delay +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_bessel_normalized_delay_period(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL design.attributes.bessel_normalized_delay = True assert design.attributes.bessel_normalized_delay_period == "2" @@ -261,9 +346,10 @@ def test_bessel_normalized_delay_period(): assert design.attributes.bessel_normalized_delay_period == "3" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_bessel_normalized_delay_percentage(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL design.attributes.bessel_normalized_delay = True assert len(BesselRipplePercentage) == 6 @@ -272,18 +358,20 @@ def test_bessel_normalized_delay_percentage(): assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pass_band_ripple(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.pass_band_ripple == ".05" design.attributes.pass_band_ripple = ".03" assert design.attributes.pass_band_ripple == ".03" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_arith_symmetry(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.filter_class = FilterClass.BAND_PASS assert design.attributes.arith_symmetry is False @@ -291,18 +379,20 @@ def test_arith_symmetry(): assert design.attributes.arith_symmetry +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS assert design.attributes.asymmetric is False design.attributes.asymmetric = True assert design.attributes.asymmetric +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_low_order(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.asymmetric = True assert design.attributes.asymmetric_low_order == 5 @@ -320,9 +410,10 @@ def test_asymmetric_low_order(): assert info.value.args[0] == "The maximum order is 21" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_high_order(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.asymmetric = True assert design.attributes.asymmetric_high_order == 5 @@ -340,9 +431,10 @@ def test_asymmetric_high_order(): assert info.value.args[0] == "The maximum order is 21" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_low_stop_band_ratio(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True @@ -351,9 +443,10 @@ def test_asymmetric_low_stop_band_ratio(): assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_high_stop_band_ratio(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True @@ -362,9 +455,10 @@ def test_asymmetric_high_stop_band_ratio(): assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_low_stop_band_attenuation_db(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True @@ -373,9 +467,10 @@ def test_asymmetric_low_stop_band_attenuation_db(): assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_asymmetric_high_stop_band_attenuation_db(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.asymmetric = True @@ -384,9 +479,10 @@ def test_asymmetric_high_stop_band_attenuation_db(): assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_gaussian_transition(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.GAUSSIAN assert len(GaussianTransition) == 6 for gaussian_transition in GaussianTransition: @@ -394,9 +490,10 @@ def test_gaussian_transition(): assert design.attributes.gaussian_transition == gaussian_transition +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_gaussian_bessel_reflection(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.BESSEL assert len(GaussianBesselReflection) == 3 for gaussian_bessel_reflection in GaussianBesselReflection: @@ -404,9 +501,10 @@ def test_gaussian_bessel_reflection(): assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_even_order(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.order = 4 assert design.attributes.even_order @@ -414,9 +512,10 @@ def test_even_order(): assert design.attributes.even_order is False +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_even_order_refl_zero(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.order = 4 assert design.attributes.even_order_refl_zero @@ -424,9 +523,10 @@ def test_even_order_refl_zero(): assert design.attributes.even_order_refl_zero is False +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_even_order_trn_zero(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.order = 4 assert design.attributes.even_order_trn_zero @@ -434,36 +534,40 @@ def test_even_order_trn_zero(): assert design.attributes.even_order_trn_zero is False +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_constrict_ripple(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.constrict_ripple is False design.attributes.constrict_ripple = True assert design.attributes.constrict_ripple +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_single_point_ripple(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.single_point_ripple is False design.attributes.single_point_ripple = True assert design.attributes.single_point_ripple +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_half_band_ripple(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC assert design.attributes.half_band_ripple is False design.attributes.half_band_ripple = True assert design.attributes.half_band_ripple +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_constrict_ripple_percent(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.constrict_ripple = True assert design.attributes.constrict_ripple_percent == "50%" @@ -471,9 +575,10 @@ def test_constrict_ripple_percent(): assert design.attributes.constrict_ripple_percent == "40%" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_ripple_constriction_band(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.constrict_ripple = True assert len(RippleConstrictionBandSelect) == 3 @@ -482,9 +587,10 @@ def test_ripple_constriction_band(): assert design.attributes.ripple_constriction_band == ripple_constriction_band +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_single_point_ripple_inf_zeros(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_type = FilterType.ELLIPTIC design.attributes.single_point_ripple = True assert len(SinglePointRippleInfZeros) == 2 @@ -493,17 +599,19 @@ def test_single_point_ripple_inf_zeros(): assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_delay_equalizer(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.delay_equalizer is False design.attributes.delay_equalizer = True assert design.attributes.delay_equalizer +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_delay_equalizer_order(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True assert design.attributes.delay_equalizer_order == 2 @@ -516,18 +624,20 @@ def test_delay_equalizer_order(): assert info.value.args[0] == "The maximum order is 20" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_delay_equ_pass_band_attenuation(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True assert design.attributes.standard_delay_equ_pass_band_attenuation design.attributes.standard_delay_equ_pass_band_attenuation = False assert design.attributes.standard_delay_equ_pass_band_attenuation is False +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_standard_delay_equ_pass_band_attenuation_value_db(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.delay_equalizer = True design.attributes.standard_delay_equ_pass_band_attenuation = False assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index e4aa896e25f..9254cf4ca55 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -4,26 +4,31 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.filtersolutions_core.attributes import FilterType +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_version(): assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_string_to_enum(): assert pyaedt.filtersolutions_core._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_enum_to_string(): assert pyaedt.filtersolutions_core._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_raise_error(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index aab27be21ec..5a2dfda4e7b 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -3,35 +3,40 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.minimum_frequency == "200 MHz" design.graph_setup.minimum_frequency = "500 MHz" assert design.graph_setup.minimum_frequency == "500 MHz" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_maximum_frequency(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.maximum_frequency == "5 GHz" design.graph_setup.maximum_frequency = "2 GHz" assert design.graph_setup.maximum_frequency == "2 GHz" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_minimum_time(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.minimum_time == "0" design.graph_setup.minimum_time = "5 ns" assert design.graph_setup.minimum_time == "5 ns" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_maximum_time(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.graph_setup.maximum_time == "10n" design.graph_setup.maximum_time = "8 ns" assert design.graph_setup.maximum_time == "8 ns" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index 362caac08c2..38de935766e 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -9,11 +9,13 @@ from pyaedt.filtersolutions_core.ideal_response import PoleZerosResponseColumn from pyaedt.filtersolutions_core.ideal_response import SParametersResponseColumn from pyaedt.filtersolutions_core.ideal_response import TimeResponseColumn +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_frequency_response_getter(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) mag_db = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_DB) assert len(mag_db) == 500 @@ -67,9 +69,10 @@ def test_frequency_response_getter(): assert freqs[-1] == 31214328219.225075 +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_time_response_getter(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) assert len(step_response) == 300 assert step_response[100] == pytest.approx(1.0006647872833518) @@ -107,9 +110,10 @@ def test_time_response_getter(): assert time[-1] == pytest.approx(9.966666666666667e-09) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_sparameters_response_getter(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) assert len(s11_response_db) == 500 assert s11_response_db[100] == pytest.approx(-41.93847819973562) @@ -137,9 +141,10 @@ def test_sparameters_response_getter(): assert freqs[-1] == pytest.approx(31214328219.225075) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pole_zeros_response_getter(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) assert len(pole_zero_den_x) == 5 assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) @@ -242,17 +247,19 @@ def test_pole_zeros_response_getter(): assert proto_rx_zero_num_y[4] == pytest.approx(0.0) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_filter_vsg_analysis_enabled(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.ideal_response.vsg_analysis_enabled is False design.ideal_response.vsg_analysis_enabled = True assert design.ideal_response.vsg_analysis_enabled +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_frequency_response(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) freq, mag_db = design.ideal_response.frequency_response( y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, minimum_frequency="200 MHz", @@ -269,9 +276,10 @@ def test_frequency_response(): assert mag_db[-1] == pytest.approx(-69.61741290615645) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_time_response(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) time, step_response = design.ideal_response.time_response( y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, minimum_time="0 ns", @@ -289,9 +297,10 @@ def test_time_response(): assert step_response[-1] == pytest.approx(0.9999999965045667) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_s_parameters(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) freq, s21_db = design.ideal_response.s_parameters( y_axis_parameter=SParametersResponseColumn.S21_DB, minimum_frequency="200 MHz", @@ -307,9 +316,10 @@ def test_s_parameters(): assert s21_db[-1] == pytest.approx(-69.61741290615645) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_pole_zero_locations(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, @@ -328,9 +338,10 @@ def test_pole_zero_locations(): assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_transfer_function_response(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) list = design.ideal_response.transfer_function_response() list_file = open(resource_path("transferfunction.ckt")) lines_list = list.splitlines() diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index fe417b6ce93..5a93f2d85eb 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -3,25 +3,29 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row_count(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True assert design.multiple_bands_table.row_count == 2 +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True assert design.multiple_bands_table.row(0) == ("2G", "3G") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_update_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True with pytest.raises(RuntimeError) as info: design.multiple_bands_table.update_row(0) @@ -34,9 +38,10 @@ def test_update_row(): assert design.multiple_bands_table.row(0) == ("200M", "5G") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_append_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True design.multiple_bands_table.append_row("100M", "500M") assert design.multiple_bands_table.row_count == 3 @@ -49,9 +54,10 @@ def test_append_row(): assert info.value.args[0] == "It is not possible to append an empty value" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_insert_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True design.multiple_bands_table.insert_row(0, "200M", "5G") assert design.multiple_bands_table.row(0) == ("200M", "5G") @@ -62,9 +68,10 @@ def test_insert_row(): assert info.value.args[0] == "The rowIndex must be greater than zero and less than row count" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_remove_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.attributes.filter_multiple_bands_enabled = True design.multiple_bands_table.remove_row(0) assert design.multiple_bands_table.row(0) == ("4G", "5G") diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index c581596bb68..b4cced9e3ab 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -3,18 +3,21 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row_count(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.transmission_zeros_frequency.row_count == 0 assert design.transmission_zeros_ratio.row_count == 0 +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" @@ -23,9 +26,10 @@ def test_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_update_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.update_row(0, zero="1.3G", position="2") assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" @@ -34,9 +38,10 @@ def test_update_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_append_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.append_row(zero="", position="") assert info.value.args[0] == "The input value is blank" @@ -56,9 +61,10 @@ def test_append_row(): assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_insert_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.insert_row(6, zero="1.3G", position="2") assert info.value.args[0] == "The given index 6 is larger than zeros order" @@ -82,9 +88,10 @@ def test_insert_row(): assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_remove_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_frequency.remove_row(2) assert info.value.args[0] == "The given index 2 is larger than zeros order" @@ -95,9 +102,10 @@ def test_remove_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_clear_row(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") design.transmission_zeros_frequency.clear_row() @@ -112,9 +120,10 @@ def test_clear_row(): assert info.value.args[0] == "This filter has no transmission zero at row 0" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_default_position(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") design.transmission_zeros_frequency.default_position() assert design.transmission_zeros_frequency.row(0) == ("1600M", "3") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index 6a5f23771d6..977f9608071 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -5,11 +5,13 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_c_node_capacitor(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" lumpdesign.leads_and_nodes.c_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.c_node_capacitor == "1n" @@ -21,9 +23,10 @@ def test_lumped_c_node_capacitor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_c_lead_inductor(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" lumpdesign.leads_and_nodes.c_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.c_lead_inductor == "1n" @@ -35,9 +38,10 @@ def test_lumped_c_lead_inductor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_l_node_capacitor(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" lumpdesign.leads_and_nodes.l_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.l_node_capacitor == "1n" @@ -49,9 +53,10 @@ def test_lumped_l_node_capacitor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_l_lead_inductor(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" lumpdesign.leads_and_nodes.l_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.l_lead_inductor == "1n" @@ -63,9 +68,10 @@ def test_lumped_l_lead_inductor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_r_node_capacitor(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" lumpdesign.leads_and_nodes.r_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.r_node_capacitor == "1n" @@ -77,9 +83,10 @@ def test_lumped_r_node_capacitor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_r_lead_inductor(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" lumpdesign.leads_and_nodes.r_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.r_lead_inductor == "1n" @@ -91,9 +98,10 @@ def test_lumped_r_lead_inductor(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_c_node_compensate(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_compensate is False lumpdesign.leads_and_nodes.c_node_compensate = True assert lumpdesign.leads_and_nodes.c_node_compensate @@ -105,9 +113,10 @@ def test_lumped_c_node_compensate(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_l_node_compensate(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_compensate is False lumpdesign.leads_and_nodes.l_node_compensate = True assert lumpdesign.leads_and_nodes.l_node_compensate diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 87b4ff066ec..6411682c24b 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -5,11 +5,13 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_q(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_q == "Inf" lumpdesign.parasitics.capacitor_q = "100" assert lumpdesign.parasitics.capacitor_q == "100" @@ -21,9 +23,10 @@ def test_lumped_capacitor_q(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_rs(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rs == "0" lumpdesign.parasitics.capacitor_rs = "1" assert lumpdesign.parasitics.capacitor_rs == "1" @@ -35,9 +38,10 @@ def test_lumped_capacitor_rs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_rp(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rp == "Inf" lumpdesign.parasitics.capacitor_rp = "1000" assert lumpdesign.parasitics.capacitor_rp == "1000" @@ -49,9 +53,10 @@ def test_lumped_capacitor_rp(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_capacitor_ls(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_ls == "0" lumpdesign.parasitics.capacitor_ls = "1n" assert lumpdesign.parasitics.capacitor_ls == "1n" @@ -63,9 +68,10 @@ def test_lumped_capacitor_ls(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_q(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_q == "Inf" lumpdesign.parasitics.inductor_q = "100" assert lumpdesign.parasitics.inductor_q == "100" @@ -77,9 +83,10 @@ def test_lumped_inductor_q(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_rs(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rs == "0" lumpdesign.parasitics.inductor_rs = "1" assert lumpdesign.parasitics.inductor_rs == "1" @@ -91,9 +98,10 @@ def test_lumped_inductor_rs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_rp(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rp == "Inf" lumpdesign.parasitics.inductor_rp = "1000" assert lumpdesign.parasitics.inductor_rp == "1000" @@ -105,9 +113,10 @@ def test_lumped_inductor_rp(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_inductor_cp(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_cp == "0" lumpdesign.parasitics.inductor_cp = "1n" assert lumpdesign.parasitics.inductor_cp == "1n" diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index 56a3cd4a73e..2f50eea1426 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -5,27 +5,31 @@ from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.filtersolutions_core.lumped_termination_impedance import ComplexReactanceType from pyaedt.filtersolutions_core.lumped_termination_impedance import ComplexTerminationDefinition +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row_count(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.source_impedance_table.row_count == 3 assert lumpdesign.load_impedance_table.row_count == 3 +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_row(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.source_impedance_table.row(0) == ("0.100G", "1.000", "0.000") assert lumpdesign.load_impedance_table.row(0) == ("0.100G", "1.000", "0.000") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_update_row(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True with pytest.raises(RuntimeError) as info: lumpdesign.source_impedance_table.update_row(0) @@ -47,9 +51,10 @@ def test_update_row(): assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_append_row(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.append_row("100M", "10", "20") assert lumpdesign.source_impedance_table.row_count == 4 @@ -60,9 +65,10 @@ def test_append_row(): assert lumpdesign.load_impedance_table.row(3) == ("100M", "10", "20") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_insert_row(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.insert_row(0, "2G", "50", "0") assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") @@ -70,9 +76,10 @@ def test_insert_row(): assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_remove_row(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.remove_row(0) assert lumpdesign.source_impedance_table.row(0) == ("1.000G", "1.000", "0.000") @@ -86,9 +93,10 @@ def test_remove_row(): assert info.value.args[0] == "No value is set for this band" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_complex_definition(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert len(ComplexTerminationDefinition) == 4 assert lumpdesign.source_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN @@ -101,9 +109,10 @@ def test_complex_definition(): assert lumpdesign.load_impedance_table.complex_definition == cdef +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_reactance_type(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert len(ComplexReactanceType) == 3 assert lumpdesign.source_impedance_table.reactance_type == ComplexReactanceType.REAC @@ -116,9 +125,10 @@ def test_reactance_type(): assert lumpdesign.load_impedance_table.reactance_type == creac +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_compensation_enabled(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.source_impedance_table.compensation_enabled is False lumpdesign.source_impedance_table.compensation_enabled = True @@ -128,9 +138,10 @@ def test_compensation_enabled(): assert lumpdesign.load_impedance_table.compensation_enabled +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_compensation_order(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True lumpdesign.source_impedance_table.compensation_enabled = True assert lumpdesign.source_impedance_table.compensation_order == 2 diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 39da6bd4dc3..4bdd3f30fbd 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -8,11 +8,13 @@ from pyaedt.filtersolutions_core.attributes import FilterClass from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.filtersolutions_core.attributes import FilterType +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_generator_resistor_30(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.generator_resistor == "50" lumpdesign.topology.generator_resistor = "30" assert lumpdesign.topology.generator_resistor == "30" @@ -24,9 +26,10 @@ def test_lumped_generator_resistor_30(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_load_resistor_30(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.load_resistor == "50" lumpdesign.topology.load_resistor = "30" assert lumpdesign.topology.load_resistor == "30" @@ -38,9 +41,10 @@ def test_lumped_load_resistor_30(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_current_source(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.current_source is False lumpdesign.topology.current_source = True assert lumpdesign.topology.current_source @@ -52,9 +56,10 @@ def test_lumped_current_source(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_first_shunt(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt lumpdesign.topology.first_shunt = True assert lumpdesign.topology.first_shunt @@ -66,9 +71,10 @@ def test_lumped_first_shunt(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_first_series(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt lumpdesign.topology.first_shunt = False assert lumpdesign.topology.first_shunt is False @@ -80,9 +86,10 @@ def test_lumped_first_series(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_bridge_t(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_type = FilterType.ELLIPTIC assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC assert lumpdesign.topology.bridge_t is False @@ -96,9 +103,10 @@ def test_lumped_bridge_t(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_bridge_t_low(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO @@ -116,9 +124,10 @@ def test_lumped_bridge_t_low(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_bridge_t_high(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO @@ -136,9 +145,10 @@ def test_lumped_bridge_t_high(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_equal_inductors(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.equal_inductors is False @@ -152,9 +162,10 @@ def test_lumped_equal_inductors(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_equal_capacitors(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True @@ -175,9 +186,10 @@ def test_lumped_equal_capacitors(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_equal_legs(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.equal_legs is False @@ -191,9 +203,10 @@ def test_lumped_equal_legs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_high_low_pass(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS assert lumpdesign.topology.high_low_pass is False @@ -207,9 +220,10 @@ def test_lumped_high_low_pass(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_high_low_pass_min_ind(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS @@ -225,9 +239,10 @@ def test_lumped_high_low_pass_min_ind(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_zig_zag(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS @@ -243,9 +258,10 @@ def test_lumped_zig_zag(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_min_ind(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True @@ -263,9 +279,10 @@ def test_lumped_min_ind(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_min_cap(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True @@ -283,9 +300,10 @@ def test_lumped_min_cap(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_set_source_res(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True @@ -304,9 +322,10 @@ def test_lumped_set_source_res(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_trap_topology(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC lumpdesign.topology.zig_zag = True @@ -324,9 +343,10 @@ def test_lumped_trap_topology(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_node_cap_ground(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.attributes.filter_type = FilterType.ELLIPTIC assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS @@ -342,9 +362,10 @@ def test_lumped_node_cap_ground(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_match_impedance(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.BAND_PASS lumpdesign.topology.generator_resistor = "75" assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS @@ -360,26 +381,29 @@ def test_lumped_match_impedance(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_complex_termination(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.complex_termination is False lumpdesign.topology.complex_termination = True assert lumpdesign.topology.complex_termination +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_complex_element_tune_enabled(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.topology.complex_termination = True assert lumpdesign.topology.complex_element_tune_enabled lumpdesign.topology.complex_element_tune_enabled = False assert lumpdesign.topology.complex_element_tune_enabled is False +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_circuit_export(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) netlist = lumpdesign.topology.circuit_response() netlist_file = open(resource_path("netlist.ckt")) lines_netlist = netlist.splitlines() @@ -388,9 +412,10 @@ def test_lumped_circuit_export(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer1_hi_lo(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 @@ -403,9 +428,10 @@ def test_lumped_diplexer1_hi_lo(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer1_bp_1(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 lumpdesign.attributes.diplexer_type = DiplexerType.BP_1 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 @@ -418,9 +444,10 @@ def test_lumped_diplexer1_bp_1(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer1_bp_2(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 lumpdesign.attributes.diplexer_type = DiplexerType.BP_2 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 @@ -433,9 +460,10 @@ def test_lumped_diplexer1_bp_2(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer2_bp_bs(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 lumpdesign.attributes.diplexer_type = DiplexerType.BP_BS assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 @@ -448,9 +476,10 @@ def test_lumped_diplexer2_bp_bs(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer2_triplexer_1(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_1 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 @@ -463,9 +492,10 @@ def test_lumped_diplexer2_triplexer_1(): assert lines_netlist_file[i] == lines_netlist[i] + "\n" +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_lumped_diplexer2_triplexer_2(): - lumpdesign = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_2 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index 6cd684b0ecd..27f6a0357bf 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -3,11 +3,13 @@ import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation +from pyaedt.generic.general_methods import is_linux +@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") def test_raise_error(): - design = pyaedt.FilterSolutions(projectname="fs1", implementation_type=FilterImplementation.LUMPED) + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index 18a0bbd8376..fcbbb626b57 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -15,22 +15,15 @@ class FilterSolutions: """Provides the FilterSolutions application interface. - This class allows you to create an instance of FilterSolutions and - define the parameters for an ideal filter. The class has access to ideal filter attributes and calcultaed output parameters. Parameters ---------- - projectname: str, optional - Name of the projest to select. The default is ``FilterSolutions API Session``. implementation_type: FilterImplementation, optional The technology used to implement the filter. The full list of implementations are listed in FilterImplementation enum. The default is `LUMPED`. - Returns - ------- - :enum:'FilterImplementation' Examples -------- @@ -44,8 +37,7 @@ class FilterSolutions: >>> ) """ - def __init__(self, projectname=None, implementation_type=None): - projectname = projectname + def __init__(self, implementation_type=FilterImplementation.LUMPED): implementation_type = implementation_type if implementation_type == FilterImplementation.LUMPED: self._init_lumped_design() @@ -53,12 +45,7 @@ def __init__(self, projectname=None, implementation_type=None): raise RuntimeError("The " + str(implementation_type) + " is not supported on this release.") def _init_lumped_design(self): - """Provides the FilterSolutions application interface. - - This class allows you to create an instance of FilterSolutions and - define the parameters for a lumped filter. The class has access to ideal - and lumped filter attributes and calcultaed output parameters. - """ + """Initialize the FilterSolutions object to support lumped filter design.""" self.attributes = Attributes() self.ideal_response = IdealResponse() diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index a7a9cc2c461..4ab514dc433 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -31,6 +31,7 @@ class FilterType(Enum): CHEBYSHEV_II = 5 HOURGLASS = 6 ELLIPTIC = 7 + DELAY = 8 # CUSTOM = 8 @@ -271,6 +272,16 @@ def _define_attributes_dll_functions(self): self._dll.getMinimumOrderStopbandFrequency.argtypes = [c_char_p, c_int] self._dll.getMinimumOrderStopbandFrequency.restype = c_int + self._dll.setMinimumOrderGroupDelayError.argtype = c_char_p + self._dll.setMinimumOrderGroupDelayError.restype = c_int + self._dll.getMinimumOrderGroupDelayError.argtypes = [c_char_p, c_int] + self._dll.getMinimumOrderGroupDelayError.restype = c_int + + self._dll.setMinimumOrderGroupDelayCutoff.argtype = c_char_p + self._dll.setMinimumOrderGroupDelayCutoff.restype = c_int + self._dll.getMinimumOrderGroupDelayCutoff.argtypes = [c_char_p, c_int] + self._dll.getMinimumOrderGroupDelayCutoff.restype = c_int + self._dll.setIdealMinimumOrder.argtype = POINTER(c_int) self._dll.setIdealMinimumOrder.restype = c_int @@ -287,6 +298,11 @@ def _define_attributes_dll_functions(self): self._dll.getCenterFrequency.argtypes = [c_char_p, c_int] self._dll.getCenterFrequency.restype = c_int + self._dll.setDelayTime.argtype = c_char_p + self._dll.setDelayTime.restype = c_int + self._dll.getDelayTime.argtypes = [c_char_p, c_int] + self._dll.getDelayTime.restype = c_int + self._dll.setPassbandFrequency.argtype = c_char_p self._dll.setPassbandFrequency.restype = c_int self._dll.getPassbandFrequency.argtypes = [c_char_p, c_int] @@ -327,15 +343,30 @@ def _define_attributes_dll_functions(self): self._dll.getStandardCutoffEnabled.argtype = POINTER(c_bool) self._dll.getStandardCutoffEnabled.restype = c_int + self._dll.setEquirippleDelayEnabled.argtype = c_bool + self._dll.setEquirippleDelayEnabled.restype = c_int + self._dll.getEquirippleDelayEnabled.argtype = POINTER(c_bool) + self._dll.getEquirippleDelayEnabled.restype = c_int + + self._dll.setDelayRipplePeriod.argtype = c_char_p + self._dll.setDelayRipplePeriod.restype = c_int + self._dll.getDelayRipplePeriod.argtypes = [c_char_p, c_int] + self._dll.getDelayRipplePeriod.restype = c_int + + self._dll.setGroupDealyRipplePercentage.argtype = c_int + self._dll.setGroupDealyRipplePercentage.restype = c_int + self._dll.setGroupDealyRipplePercentage.argtype = POINTER(c_int) + self._dll.setGroupDealyRipplePercentage.restype = c_int + self._dll.setCutoffAttenuationdB.argtype = c_char_p self._dll.setCutoffAttenuationdB.restype = c_int self._dll.getCutoffAttenuationdB.argtypes = [c_char_p, c_int] self._dll.getCutoffAttenuationdB.restype = c_int - self._dll.setBesselNormalizedDelay.argtype = c_bool - self._dll.setBesselNormalizedDelay.restype = c_int - self._dll.getBesselNormalizedDelay.argtype = POINTER(c_bool) - self._dll.getBesselNormalizedDelay.restype = c_int + self._dll.setBesselNormalizedDelayEnabled.argtype = c_bool + self._dll.setBesselNormalizedDelayEnabled.restype = c_int + self._dll.getBesselNormalizedDelayEnabled.argtype = POINTER(c_bool) + self._dll.getBesselNormalizedDelayEnabled.restype = c_int self._dll.setBesselEquiRippleDelayPeriod.argtype = c_char_p self._dll.setBesselEquiRippleDelayPeriod.restype = c_int @@ -659,6 +690,48 @@ def minimum_order_stop_band_frequency(self, minimum_order_stop_band_frequency_st minimum_order_stop_band_frequency_string, ) + @property + def minimum_order_group_delay_error_percent(self) -> str: + """Filter maximum group delay in % for calculation of the filter minimum order. + The default is `5`. + + Returns + ------- + str + """ + minimum_order_group_delay_error_percent_string = self._dll_interface.get_string( + self._dll.getMinimumOrderGroupDelayError + ) + return minimum_order_group_delay_error_percent_string + + @minimum_order_group_delay_error_percent.setter + def minimum_order_group_delay_error_percent(self, minimum_order_group_delay_error_percent): + self._dll_interface.set_string( + self._dll.setMinimumOrderGroupDelayError, + minimum_order_group_delay_error_percent, + ) + + @property + def minimum_order_group_delay_cutoff(self) -> str: + """Filter group dealy cutoff frequency for calculation of the filter minimum order. + The default is `10 GHz`. + + Returns + ------- + str + """ + minimum_order_group_delay_cutoff_string = self._dll_interface.get_string( + self._dll.getMinimumOrderGroupDelayCutoff + ) + return minimum_order_group_delay_cutoff_string + + @minimum_order_group_delay_cutoff.setter + def minimum_order_group_delay_cutoff(self, minimum_order_group_delay_cutoff_string): + self._dll_interface.set_string( + self._dll.setMinimumOrderGroupDelayCutoff, + minimum_order_group_delay_cutoff_string, + ) + @property def ideal_minimum_order(self) -> int: """Filter minimum order for the defined stop band frequency and attenuation parameters. @@ -672,6 +745,22 @@ def ideal_minimum_order(self) -> int: pyaedt.filtersolutions_core._dll_interface().raise_error(status) return int(minimum_order.value) + @property + def delay_time(self) -> str: + """Filter delay time. + The default is `1 ns`. + + Returns + ------- + str + """ + delay_time_string = self._dll_interface.get_string(self._dll.getDelayTime) + return delay_time_string + + @delay_time.setter + def delay_time(self, delay_time_string): + self._dll_interface.set_string(self._dll.setDelayTime, delay_time_string) + @property def pass_band_definition(self) -> PassbandDefinition: """Pass band frequency entry options. @@ -845,6 +934,65 @@ def standard_pass_band_attenuation(self, standard_pass_band_attenuation: bool): status = self._dll.setStandardCutoffEnabled(standard_pass_band_attenuation) pyaedt.filtersolutions_core._dll_interface().raise_error(status) + @property + def equiripple_delay(self) -> bool: + """Filter equiripple delay status. + The default is `True`. + + Returns + ------- + bool + """ + equiripple_delay = c_bool() + status = self._dll.getEquirippleDelayEnabled(byref(equiripple_delay)) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) + return bool(equiripple_delay.value) + + @equiripple_delay.setter + def equiripple_delay(self, equiripple_delay: bool): + status = self._dll.setEquirippleDelayEnabled(equiripple_delay) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) + + @property + def group_delay_ripple_period(self) -> str: + """Filter approximate normalized group delay ripple period. + The default is `2`. + + Returns + ------- + str + """ + group_delay_ripple_period_string = self._dll_interface.get_string(self._dll.getDelayRipplePeriod) + return group_delay_ripple_period_string + + @group_delay_ripple_period.setter + def group_delay_ripple_period(self, group_delay_ripple_period_string): + self._dll_interface.set_string( + self._dll.setDelayRipplePeriod, + group_delay_ripple_period_string, + ) + + @property + def normalized_group_delay_percentage(self) -> int: + """Bessel filter ripple percentage. + The default is `0`. + + Returns + ------- + int + """ + index = c_int() + normalized_group_delay_percentage = list(BesselRipplePercentage) + status = self._dll.getGroupDealyRipplePercentage(byref(index)) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) + normalized_group_delay_percentage_string = normalized_group_delay_percentage[index.value] + return normalized_group_delay_percentage_string + + @normalized_group_delay_percentage.setter + def normalized_group_delay_percentage(self, column: BesselRipplePercentage): + status = self._dll.setGroupDealyRipplePercentage(column.value) + pyaedt.filtersolutions_core._dll_interface().raise_error(status) + @property def standard_pass_band_attenuation_value_db(self) -> str: """Filter cut off attenuation in dB. @@ -876,13 +1024,13 @@ def bessel_normalized_delay(self) -> bool: bool """ bessel_normalized_delay = c_bool() - status = self._dll.getBesselNormalizedDelay(byref(bessel_normalized_delay)) + status = self._dll.getBesselNormalizedDelayEnabled(byref(bessel_normalized_delay)) pyaedt.filtersolutions_core._dll_interface().raise_error(status) return bool(bessel_normalized_delay.value) @bessel_normalized_delay.setter def bessel_normalized_delay(self, bessel_normalized_delay: bool): - status = self._dll.setBesselNormalizedDelay(bessel_normalized_delay) + status = self._dll.setBesselNormalizedDelayEnabled(bessel_normalized_delay) pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index fe133f1b19c..e55808cc6db 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -128,14 +128,12 @@ def Circuit( def FilterSolutions( - projectname=None, implementation_type=None, ): from pyaedt.filtersolutions import FilterSolutions as app return app( - projectname=projectname, implementation_type=implementation_type, ) From 9c0d78ec9f7d88552a594f459e0129f95e0b8ca2 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Mon, 10 Jun 2024 17:28:42 -0400 Subject: [PATCH 10/26] feat/draft_filtersolutions: Reviewer comments are applied. --- .gitignore | 2 - .../Lumped_Element_Response.py | 67 +++++ pyaedt/filtersolutions.py | 14 +- pyaedt/filtersolutions_core/attributes.py | 236 +++++++++--------- pyaedt/filtersolutions_core/dll_interface.py | 32 +-- pyaedt/filtersolutions_core/graph_setup.py | 14 +- pyaedt/filtersolutions_core/ideal_response.py | 74 +++--- .../lumped_nodes_and_leads.py | 22 +- .../filtersolutions_core/lumped_parasitics.py | 20 +- .../lumped_termination_impedance.py | 21 +- .../filtersolutions_core/lumped_topology.py | 66 ++--- .../multiple_bands_table.py | 12 +- .../transmission_zeros.py | 14 +- 13 files changed, 314 insertions(+), 280 deletions(-) create mode 100644 examples/08-FilterSolutions/Lumped_Element_Response.py diff --git a/.gitignore b/.gitignore index cbe6fe6f40a..04fc496fd00 100644 --- a/.gitignore +++ b/.gitignore @@ -395,6 +395,4 @@ model.index\+ # local environment settings used by e.g. Visual Studio Code /.env -/doc/source/local_config.json -/pyaedtenv/** /.cov/** diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py new file mode 100644 index 00000000000..4d47dc026a5 --- /dev/null +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -0,0 +1,67 @@ +""" +Design a Lumped Element Filter +------------------------------ +This example shows how you can use PyAEDT to use the `FilterSolutions` library to design and +visualize the frequency response of a band-pass Butterworth filter. +""" + +############################################################################### +# Perform required imports +# ~~~~~~~~~~~~~~~~~~~~~~~~ +# Perform required imports. + +import pyaedt +import pyaedt.filtersolutions_core.attributes +from pyaedt.filtersolutions_core.attributes import FilterType, FilterClass, FilterImplementation +from pyaedt.filtersolutions_core.ideal_response import FrequencyResponseColumn +import matplotlib.pyplot as plt + +############################################################################### +# Create the Lumped Design +# ~~~~~~~~~~~~~~~~~~~~~~~~ +# Create a lumped element filter design and assign the class, type, frequency, and order. + +design = pyaedt.FilterSolutions(implementation_type= FilterImplementation.LUMPED) +design.attributes.filter_class = FilterClass.BAND_PASS +design.attributes.filter_type = FilterType.BUTTERWORTH +design.attributes.pass_band_center_frequency = "1G" +design.attributes.pass_band_width_frequency = "500M" +design.attributes.filter_order = 5 + +############################################################################## +# Plot the frequency response of the filter. +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Plot the frequency response of the filter without any transmission zeros. + +freq, mag_db = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) +plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero") +def format_plot(): + plt.xlabel("Frequency (Hz)") + plt.ylabel("Magnitude S21 (dB)") + plt.title("Ideal Frequency Response") + plt.xscale("log") + plt.legend() + plt.grid() +format_plot() +plt.show() + +############################################################################## +# Add a transmission zero to the filter design. +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Add a transmission zeros that yields nulls separated by 2 times the pass band width (1 GHz). +# Plot the frequency response of the filter with the transmission zero. + +design.transmission_zeros_ratio.append_row("2.0") +freq_with_zero, mag_db_with_zero = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) +plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero") +plt.plot(freq_with_zero, mag_db_with_zero, linewidth=2.0, label="With Tx Zero") +format_plot() +plt.show() + +############################################################################## +# Generate the netlist for the designed filter. +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Generate and print the netlist for the designed filter with the transmission zero.. + +netlist = design.topology.circuit_response() +print("Netlist: \n", netlist) diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index fcbbb626b57..215089adfc2 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -13,21 +13,21 @@ class FilterSolutions: - """Provides the FilterSolutions application interface. + """Provides the ``FilterSolutions`` application interface. - The class has access to ideal filter attributes and calcultaed output parameters. + The class has access to ideal filter attributes and calculated output parameters. Parameters ---------- implementation_type: FilterImplementation, optional The technology used to implement the filter. - The full list of implementations are listed in FilterImplementation enum. - The default is `LUMPED`. + The technology used to implement the filter. The default is ``LUMPED``. + The ``FilterImplementation`` enum provides the list of implementations. Examples -------- - Create an instance of FilterSolutions with a band pass elliptic ideal filter. + Create a ``FilterSolutions`` instance with a band pass elliptic ideal filter. >>> import pyaedt >>> from pyaedt.filtersolutions_core.attributes import FilterImplementation @@ -42,10 +42,10 @@ def __init__(self, implementation_type=FilterImplementation.LUMPED): if implementation_type == FilterImplementation.LUMPED: self._init_lumped_design() else: - raise RuntimeError("The " + str(implementation_type) + " is not supported on this release.") + raise RuntimeError("The " + str(implementation_type) + " is not supported in this release.") def _init_lumped_design(self): - """Initialize the FilterSolutions object to support lumped filter design.""" + """Initialize the ``FilterSolutions`` object to support a lumped filter design.""" self.attributes = Attributes() self.ideal_response = IdealResponse() diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 4ab514dc433..886b45bd19d 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -9,7 +9,7 @@ class FilterType(Enum): - """Selects type of filter with the associated mathematical formulation. + """Provides an enum of filter types with associated mathematical formulations. Attributes: GAUSSIAN: Represents a Gaussian filter. @@ -18,9 +18,9 @@ class FilterType(Enum): LEGENDRE: Represents a Legendre filter. CHEBYSHEV_I: Represents a Chevyshev type I filter. CHEBYSHEV_II: Represents a Chevyshev type II filter. - HOURGLASS: Represents a Hourglass filter. - ELLIPTIC: Represents a elliptic filter. - Custom, rasied-cos, matched, and delay filter types are not available in this release. + HOURGLASS: Represents an hourglass filter. + ELLIPTIC: Represents an elliptic filter. + Custom, raised-cos, and matched filter types are not available in this release. """ GAUSSIAN = 0 @@ -41,19 +41,19 @@ class FilterType(Enum): class FilterClass(Enum): - """Selects class of filter for single band and multiple bands filters. + """Provides an enum of filter types for single-band and multiple-bands filters. Attributes: - LOW_PASS: Represents a low pass filter. - HIGH_PASS: Represents a high pass filter. + LOW_PASS: Represents a low-pass filter. + HIGH_PASS: Represents a high-pass filter. DIPLEXER_1: Represents a first group of diplexer filter. BAND_PASS: Represents a band pass filter. BAND_STOP: Represents a band stop filter. DIPLEXER_2: Represents a second group of diplexer filter. - LOW_BAND: Represents a combined low pass and multi band filter. - BAND_HIGH: Represents a combined high pass and multi band filter. - BAND_BAND: Represents a multi band passfilter. - STOP_STOP: Represents a multi band stop filter. + LOW_BAND: Represents a combined low-pass and multi-band filter. + BAND_HIGH: Represents a combined high-pass and multi-band filter. + BAND_BAND: Represents a multi-band pass filter. + STOP_STOP: Represents a multi-band stop filter. """ LOW_PASS = 0 @@ -69,12 +69,12 @@ class FilterClass(Enum): class FilterImplementation(Enum): - """Selects implementations type of filter. This release covers only lumped filter technology. + """Provides an enum of filter implementation types. Attributes: LUMPED: Represents a lumped implementation. DISTRIB: Represents a distributed implementation. - ACTIVE: Represents a active implementation. + ACTIVE: Represents an active implementation. SWCAP: Represents a switched capacitor implementation. DIGITAL: Represents a digital implementation. """ @@ -87,15 +87,15 @@ class FilterImplementation(Enum): class DiplexerType(Enum): - """Selects topology of diplexers. + """Provides an enum of diplexer and triplexer types. Attributes: - HI_LO: Represents a high pass low pass diplexer type. - BP_1: Represents a band pass band pass diplexer type. - BP_2: Represents a band pass band pass diplexer type. - BP_BS: Represents a band pass band stop diplexer type. - TRIPLEXER_1: Represents a low pass, band pass, and high pass triplexer type. - TRIPLEXER_2: Represents a low pass, band pass, and high pass triplexer type. + HI_LO: Represents a high-pass, low-pass diplexer type. + BP_1: Represents a band-pass, band-pass diplexer type. + BP_2: Represents a band-pass, band-pass diplexer type. + BP_BS: Represents a band-pass, band-stop diplexer type. + TRIPLEXER_1: Represents a low-pass, band-pass, and high-pass triplexer type. + TRIPLEXER_2: Represents a low-pass, band-pass, and high-pass triplexer type. """ HI_LO = 0 @@ -107,7 +107,8 @@ class DiplexerType(Enum): class BesselRipplePercentage(Enum): - """Selects peak to peak group delay ripple magnitude as percent of average for Bessl filters. + """Provides an enum of peak-to-peak group delay ripple magnitudes as percents of averages for Bessel filters. + Attributes: ZERO: 0% HALF: 0.5% @@ -126,7 +127,8 @@ class BesselRipplePercentage(Enum): class GaussianTransition(Enum): - """Selects transition attenuation in dB for Gaussian filters to improve group delay response. + """Provides an enum of transition attenuations in dB for Gaussian filters to improve group delay response. + Attributes: TRANSITION_NONE: 0dB TRANSITION_3_DB: 3dB @@ -145,7 +147,7 @@ class GaussianTransition(Enum): class GaussianBesselReflection(Enum): - """Selects various synthesis methods for Gaussian and Bessel filters.""" + """Provides an enum of synthesis methods for Gaussian and Bessel filters.""" OPTION_1 = 0 OPTION_2 = 1 @@ -153,11 +155,12 @@ class GaussianBesselReflection(Enum): class RippleConstrictionBandSelect(Enum): - """Selects the bands to apply the constrict ripple parameter. + """Provides an enum of the bands to apply constrict the ripple parameter. + Attributes: - STOP: stop band - PASS: pass band - BOTH: stop and pass bands + STOP: Stop band + PASS: Pass band + BOTH: Stop and pass bands """ STOP = 0 @@ -166,10 +169,11 @@ class RippleConstrictionBandSelect(Enum): class SinglePointRippleInfZeros(Enum): - """Selects either 1 or 3 non-infifnite zeros at single frequency point to confine ripple. + """Provides an enum for either one or three non-Infinite zeros at the single frequency point to confine the ripple. + Attributes: - RIPPLE_INF_ZEROS_1: 1 zero - RIPPLE_INF_ZEROS_3: 3 zeros + RIPPLE_INF_ZEROS_1: One zero + RIPPLE_INF_ZEROS_3: Three zeros """ RIPPLE_INF_ZEROS_1 = 0 @@ -177,14 +181,14 @@ class SinglePointRippleInfZeros(Enum): class PassbandDefinition(Enum): - """Selects type of frequency entries to get either center frequency and bandwidth or corner frequencies.""" + """Provides an enum to get either center frequency and bandwidth or corner frequencies.""" CENTER_FREQUENCY = 0 CORNER_FREQUENCIES = 1 class StopbandDefinition(Enum): - """Selects stop band parameter to be compared to pass band.""" + """Provides an enum for comparing the stop band parameter to the pass band parameter.""" RATIO = 0 FREQUENCY = 1 @@ -194,19 +198,19 @@ class StopbandDefinition(Enum): class Attributes: """Defines attributes and parameters of filters. - This class allows you to construct all the necessary attributes for the FilterDesign class. + This class allows you to construct all the necessary attributes for the ``FilterDesign`` class. Attributes ---------- _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class. Methods ---------- _define_attributes_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -500,8 +504,8 @@ def _define_attributes_dll_functions(self): @property def filter_type(self) -> FilterType: - """The type (mathematical formulation) of filter. The full list of types are listed in FilterType enum. - The default is `BUTTERWORTH`. + """Type (mathematical formulation) of the filter. The default is ``BUTTERWORTH``. + The ``FilterType`` enum provides a list of all types. Returns ------- @@ -518,8 +522,8 @@ def filter_type(self, filter_type: FilterType): @property def filter_class(self) -> FilterClass: - """The class (band definition) of filter. The full list of classes are listed in FilterClass enum. - The default is `LOW_PASS`. + """Class (band definition) of the filter. The default is ``LOW_PASS``. + The ``FilterClass`` enum provides a list of all classes. Returns ------- @@ -536,13 +540,12 @@ def filter_class(self, filter_class: FilterClass): @property def filter_implementation(self) -> FilterImplementation: - """The technology used to implement the filter. - The full list of implementations are listed in FilterImplementation enum. - The default is `LUMPED`. + """Technology used to implement the filter. The default is ``LUMPED``. + The ``FilterImplementation`` enum provides a list of all implementations. Returns ------- - :enum:'FilterImplementation' + :enum:`FilterImplementation` """ type_string = self._dll_interface.get_string(self._dll.getFilterImplementation) return self._dll_interface.string_to_enum(FilterImplementation, type_string) @@ -555,10 +558,10 @@ def filter_implementation(self, filter_implementation: FilterImplementation): @property def diplexer_type(self) -> DiplexerType: - """The type of diplexer topology. Only applicable to lumped filters. - The full list of diplexer types are listed in DiplexerType enum. - The default is `HI_LO` for `DIPLEXER_1` filter class. - The default is `BP_BS` for `DIPLEXER_2` filter class. + """Type of diplexer topology. This property is only applicable to lumped filters. + The default is ``HI_LO`` for the ``DIPLEXER_1`` filter class. + The default is ``BP_BS`` for the ``DIPLEXER_2`` filter class. + The ``DiplexerType`` enum provides a full list of diplexer types. Returns ------- @@ -574,7 +577,7 @@ def diplexer_type(self, diplexer_type: DiplexerType): @property def filter_multiple_bands_enabled(self) -> bool: - """Whether to enable the multiple bands table. The default is `False`. + """Flag indicating if the multiple bands table is enabled. Returns ------- @@ -592,7 +595,7 @@ def filter_multiple_bands_enabled(self, filter_multiple_bands_enabled: bool): @property def filter_multiple_bands_low_pass_frequency(self) -> str: - """The multiple bands low pass frequency of combined low pass and band pass filters. The default is `1GHz`. + """Multiple bands low-pass frequency of combined low-pass and band-pass filters. The default is ``1GHz``. Returns ------- @@ -612,7 +615,7 @@ def filter_multiple_bands_low_pass_frequency(self, filter_multiple_bands_low_pas @property def filter_multiple_bands_high_pass_frequency(self) -> str: - """The multiple bands high pass frequency of combined high pass and band pass filters. The default is `1GHz`. + """Multiple bands high-pass frequency of combined high-pass and band-pass filters. The default is ``1GHz``. Returns ------- @@ -632,7 +635,7 @@ def filter_multiple_bands_high_pass_frequency(self, filter_multiple_bands_high_p @property def order(self) -> int: - """Order of filter. The default is `5`. + """Order of the filter. The default is ``5``. Returns ------- @@ -651,7 +654,7 @@ def order(self, order: int): @property def minimum_order_stop_band_attenuation_db(self) -> str: """Filter stop band attenuation in dB for calculation of the filter minimum order. - The default is `50`. + The default is ``50``. Returns ------- @@ -672,7 +675,7 @@ def minimum_order_stop_band_attenuation_db(self, minimum_order_stop_band_attenua @property def minimum_order_stop_band_frequency(self) -> str: """Filter stop band frequency for calculation of the filter minimum order. - The default is `10 GHz`. + The default is ``10 GHz``. Returns ------- @@ -693,7 +696,7 @@ def minimum_order_stop_band_frequency(self, minimum_order_stop_band_frequency_st @property def minimum_order_group_delay_error_percent(self) -> str: """Filter maximum group delay in % for calculation of the filter minimum order. - The default is `5`. + The default is ``5``. Returns ------- @@ -713,8 +716,8 @@ def minimum_order_group_delay_error_percent(self, minimum_order_group_delay_erro @property def minimum_order_group_delay_cutoff(self) -> str: - """Filter group dealy cutoff frequency for calculation of the filter minimum order. - The default is `10 GHz`. + """Filter group delay cutoff frequency for calculation of the filter minimum order. + The default is ``10 GHz``. Returns ------- @@ -748,7 +751,7 @@ def ideal_minimum_order(self) -> int: @property def delay_time(self) -> str: """Filter delay time. - The default is `1 ns`. + The default is ``1 ns``. Returns ------- @@ -764,11 +767,11 @@ def delay_time(self, delay_time_string): @property def pass_band_definition(self) -> PassbandDefinition: """Pass band frequency entry options. - The default is `CENTER_FREQUENCY`. + The default is ``CENTER_FREQUENCY``. Returns ------- - :enum: PassbandDefinition + :enum:`PassbandDefinition` """ index = c_int() pass_band_definition = list(PassbandDefinition) @@ -785,7 +788,7 @@ def pass_band_definition(self, column: PassbandDefinition): @property def pass_band_center_frequency(self) -> str: """Filter pass band or center frequency. - The default is `1 GHz`. + The default is ``1 GHz``. Returns ------- @@ -801,7 +804,7 @@ def pass_band_center_frequency(self, center_freq_string): @property def pass_band_width_frequency(self) -> str: """Pass band width frequency for band pass or band stop filters. - The default is `200 MHz`. + The default is ``200 MHz``. Returns ------- @@ -817,7 +820,7 @@ def pass_band_width_frequency(self, pass_band_freq_string): @property def lower_frequency(self) -> str: """Filter lower corner frequency. - The default is `905 MHz`. + The default is ``905 MHz``. Returns ------- @@ -833,7 +836,7 @@ def lower_frequency(self, lower_freq_string): @property def upper_frequency(self) -> str: """Filter upper corner frequency. - The default is `1.105 MHz`. + The default is ``1.105 MHz``. Returns ------- @@ -849,11 +852,11 @@ def upper_frequency(self, upper_freq_string): @property def stop_band_definition(self) -> StopbandDefinition: """Stop band parameter entry option. - The default is `RATIO`. + The default is ``RATIO``. Returns ------- - :enum: StopbandDefinition + :enum:`StopbandDefinition` """ index = c_int() stop_band_definition = list(StopbandDefinition) @@ -870,7 +873,7 @@ def stop_band_definition(self, column: StopbandDefinition): @property def stop_band_ratio(self) -> str: """Filter stop band ratio. - The default is `1.2`. + The default is ``1.2``. Returns ------- @@ -886,7 +889,7 @@ def stop_band_ratio(self, stop_band_ratio_string): @property def stop_band_frequency(self) -> str: """Filter stop band frequency. - The default is `1.2 GHz`. + The default is ``1.2 GHz``. Returns ------- @@ -902,7 +905,7 @@ def stop_band_frequency(self, stop_band_frequency_string): @property def stop_band_attenuation_db(self) -> str: """Filter stop band attenuation in dB. - The default is `60 dB`. + The default is ``60 dB``. Returns ------- @@ -917,8 +920,7 @@ def stop_band_attenuation_db(self, stop_band_attenuation_db_string): @property def standard_pass_band_attenuation(self) -> bool: - """Filter standard cut status. - The default is `True`. + """Flag indicating if the standard cut is enabled. Returns ------- @@ -936,8 +938,7 @@ def standard_pass_band_attenuation(self, standard_pass_band_attenuation: bool): @property def equiripple_delay(self) -> bool: - """Filter equiripple delay status. - The default is `True`. + """Flag indicating if the equiripple delay is enabled. Returns ------- @@ -956,7 +957,7 @@ def equiripple_delay(self, equiripple_delay: bool): @property def group_delay_ripple_period(self) -> str: """Filter approximate normalized group delay ripple period. - The default is `2`. + The default is ''2''. Returns ------- @@ -975,7 +976,7 @@ def group_delay_ripple_period(self, group_delay_ripple_period_string): @property def normalized_group_delay_percentage(self) -> int: """Bessel filter ripple percentage. - The default is `0`. + The default is ''0''. Returns ------- @@ -996,7 +997,7 @@ def normalized_group_delay_percentage(self, column: BesselRipplePercentage): @property def standard_pass_band_attenuation_value_db(self) -> str: """Filter cut off attenuation in dB. - The default is `3.01 dB`. + The default is ''3.01 dB''. Returns ------- @@ -1016,8 +1017,7 @@ def standard_pass_band_attenuation_value_db(self, standard_pass_band_attenuation @property def bessel_normalized_delay(self) -> bool: - """Bessel filter normalized delay status. - The default is `False`. + """Flag indicating if the normalized delay is enabled. Returns ------- @@ -1036,7 +1036,7 @@ def bessel_normalized_delay(self, bessel_normalized_delay: bool): @property def bessel_normalized_delay_period(self) -> str: """Bessel filter normalized delay period. - The default is `2`. + The default is ''2''. Returns ------- @@ -1055,7 +1055,7 @@ def bessel_normalized_delay_period(self, bessel_normalized_delay_period_string): @property def bessel_normalized_delay_percentage(self) -> int: """Bessel filter ripple percentage. - The default is `0`. + The default is ''0''. Returns ------- @@ -1076,7 +1076,7 @@ def bessel_normalized_delay_percentage(self, column: BesselRipplePercentage): @property def pass_band_ripple(self) -> str: """Filter pass band ripple in dB. - The default is `0.05 dB`. + The default is ''0.05 dB''. Returns ------- @@ -1091,8 +1091,7 @@ def pass_band_ripple(self, pass_band_ripple_string): @property def arith_symmetry(self) -> bool: - """Filter arithmetic symmetry status. - The default is `False`. + """Flag indicating if the arithmetic symmetry is enabled. Returns ------- @@ -1110,8 +1109,7 @@ def arith_symmetry(self, arith_symmetry: bool): @property def asymmetric(self) -> bool: - """Filter asymmetric status. - The default is `False`. + """Flag indicating if the asymmetric is enabled. Returns ------- @@ -1129,8 +1127,8 @@ def asymmetric(self, asymmetric: bool): @property def asymmetric_low_order(self) -> int: - """Filter asymmetry lower frequency order. - The default is `5`. + """Order for low side of an asymmetric filter. + The default is ''5''. Returns ------- @@ -1148,8 +1146,8 @@ def asymmetric_low_order(self, asymmetric_low_order: int): @property def asymmetric_high_order(self) -> int: - """Filter asymmetry higher frequency order. - The default is `5`. + """Order for high side of an asymmetric filter. + The default is ''5''. Returns ------- @@ -1167,8 +1165,8 @@ def asymmetric_high_order(self, asymmetric_high_order: int): @property def asymmetric_low_stop_band_ratio(self) -> str: - """Filter asymmetry lower stop band ratio. - The default is `1.2`. + """Stop-band ratio for low side of an asymmetric filter. + The default is ''1.2''. Returns ------- @@ -1186,8 +1184,8 @@ def asymmetric_low_stop_band_ratio(self, asymmetric_low_stop_band_ratio_string): @property def asymmetric_high_stop_band_ratio(self) -> str: - """Filter asymmetry higher stop band ratio. - The default is `1.2`. + """Stop-band ratio for high side of an asymmetric filter. + The default is ''1.2''. Returns ------- @@ -1207,8 +1205,8 @@ def asymmetric_high_stop_band_ratio(self, asymmetric_high_stop_band_ratio_string @property def asymmetric_low_stop_band_attenuation_db(self) -> str: - """Filter asymmetry lower stop band attenuation in dB. - The default is `60 dB`. + """Stop-band attenuation for low side of an asymmetric filter. + The default is ''60 dB''. Returns ------- @@ -1228,8 +1226,8 @@ def asymmetric_low_stop_band_attenuation_db(self, asymmetric_low_stop_band_atten @property def asymmetric_high_stop_band_attenuation_db(self) -> str: - """Filter asymmetry higher stop band attenuation in dB. - The default is `60 dB`. + """Stop-band attenuation for high side of an asymmetric filter. + The default is ''60 dB''. Returns ------- @@ -1250,11 +1248,11 @@ def asymmetric_high_stop_band_attenuation_db(self, asymmetric_high_stop_band_att @property def gaussian_transition(self) -> GaussianTransition: """Gaussian filter transition option. - The default is `TRANSITION_NONE`. + The default is ''TRANSITION_NONE''. Returns ------- - :enum: GaussianTransition + :enum:`GaussianTransition` """ type_string = self._dll_interface.get_string(self._dll.getGaussianTransition) type_string = "TRANSITION_" + type_string @@ -1268,11 +1266,11 @@ def gaussian_transition(self, gaussian_transition: GaussianTransition): @property def gaussian_bessel_reflection(self) -> GaussianBesselReflection: """Gaussian or Bessel filter reflection option. - The default is `OPTION_1`. + The default is ''OPTION_1''. Returns ------- - :enum: GaussianBesselReflection + :enum:`GaussianBesselReflection` """ index = c_int() gaussian_bessel_reflection = list(GaussianBesselReflection) @@ -1288,8 +1286,7 @@ def gaussian_bessel_reflection(self, column: GaussianBesselReflection): @property def even_order(self) -> bool: - """Filter even order mode status for filter with even orders. - The default is `True`. + """Flag indicating if the even order mode for filter with even orders is enabled. Returns ------- @@ -1307,8 +1304,7 @@ def even_order(self, even_order: bool): @property def even_order_refl_zero(self) -> bool: - """Filter even order reflection zeros to 0 status. - The default is `True`. + """Flag indicating if the even order reflection zeros to 0 is enabled. Returns ------- @@ -1326,8 +1322,7 @@ def even_order_refl_zero(self, even_order_refl_zero: bool): @property def even_order_trn_zero(self) -> bool: - """Filter even order reflection zeros to infinite status. - The default is `True`. + """Flag indicating if the even order reflection zeros to infinite is enabled. Returns ------- @@ -1345,8 +1340,7 @@ def even_order_trn_zero(self, even_order_trn_zero: bool): @property def constrict_ripple(self) -> bool: - """Filter equiripple constriction status. - The default is `False`. + """Flag indicating if the equiripple constriction is enabled. Returns ------- @@ -1364,8 +1358,7 @@ def constrict_ripple(self, constrict_ripple: bool): @property def single_point_ripple(self) -> bool: - """Filter ripple confinement to a single frequency point status. - The default is `False`. + """Flag indicating if the ripple confinement to a single frequency point is enabled. Returns ------- @@ -1382,8 +1375,7 @@ def single_point_ripple(self, single_point_ripple: bool): @property def half_band_ripple(self) -> bool: - """Filter ripple with half of the zeros in the given band status. - The default is `False`. + """Flag indicating if the ripple with half of the zeros in the given band is enabled. Returns ------- @@ -1402,7 +1394,7 @@ def half_band_ripple(self, half_band_ripple: bool): @property def constrict_ripple_percent(self) -> str: """Filter ripple constriction percentage. - The default is `False`. + The default is ''False''. Returns ------- @@ -1418,11 +1410,11 @@ def constrict_ripple_percent(self, constrict_ripple_percent_string): @property def ripple_constriction_band(self) -> RippleConstrictionBandSelect: """Filter ripple constriction band option. - The default is `STOP`. + The default is ''STOP''. Returns ------- - :enum: RippleConstrictionBandSelect + :enum:`RippleConstrictionBandSelect` """ type_string = self._dll_interface.get_string(self._dll.getRippleConstrictionBandSelect) return self._dll_interface.string_to_enum(RippleConstrictionBandSelect, type_string) @@ -1435,11 +1427,11 @@ def ripple_constriction_band(self, ripple_constriction_band: RippleConstrictionB @property def single_point_ripple_inf_zeros(self) -> SinglePointRippleInfZeros: """Filter number of single point ripple infinite zeros. - The default is `RIPPLE_INF_ZEROS_1`. + The default is ''RIPPLE_INF_ZEROS_1''. Returns ------- - :enum: SinglePointRippleInfZeros + :enum:`SinglePointRippleInfZeros` """ type_string = self._dll_interface.get_string(self._dll.getSinglePointRippleNoninfiniteZeros) type_string = "RIPPLE_INF_ZEROS_" + type_string @@ -1452,8 +1444,7 @@ def single_point_ripple_inf_zeros(self, single_point_ripple_inf_zeros: SinglePoi @property def delay_equalizer(self) -> bool: - """Filter delay equalizer status. - The default is `False`. + """Flag indicating if the delay equalizer enabled. Returns ------- @@ -1471,7 +1462,7 @@ def delay_equalizer(self, delay_equalizer: bool): @property def delay_equalizer_order(self) -> int: """Filter delay equalizer order. - The default is `2`. + The default is ''2''. Returns ------- @@ -1489,8 +1480,7 @@ def delay_equalizer_order(self, delay_equalizer_order: int): @property def standard_delay_equ_pass_band_attenuation(self) -> bool: - """Filter standard delay equalizer attenuation status. - The default is `True`. + """Flag indicating if the standard delay equalizer attenuation enabled. Returns ------- @@ -1509,7 +1499,7 @@ def standard_delay_equ_pass_band_attenuation(self, standard_delay_equ_pass_band_ @property def standard_delay_equ_pass_band_attenuation_value_db(self) -> str: """Filter standard delay equalizer cut Off attenuation in dB. - The default is `3.01 dB`. + The default is ''3.01 dB''. Returns ------- diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index fb87c4c06c0..1d558c3b990 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -19,7 +19,7 @@ def restore_defaults(self): self.raise_error(status) def _init_dll_path(self): - """Set DLL path and print to screen the status of DLL access.""" + """Set DLL path and print the status of the DLL access to the screen.""" relative_path = "../../../build_output/64Release/nuhertz/FilterSolutionsAPI.dll" self.dll_path = os.path.join(os.path.dirname(__file__), relative_path) if not os.path.isfile(self.dll_path): @@ -28,10 +28,10 @@ def _init_dll_path(self): ) # pragma: no cover print("DLL Path:", self.dll_path) if not os.path.isfile(self.dll_path): - raise RuntimeError(f"The FilterSolutions API DLL was not found at {self.dll_path}") # pragma: no cover + raise RuntimeError(f"The 'FilterSolution' API DLL was not found at {self.dll_path}.") # pragma: no cover def _init_dll(self, show_gui): - """Load DLL and initiate application parameters to default values.""" + """Load DLL and initialize application parameters to default values.""" self._dll = ctypes.cdll.LoadLibrary(self.dll_path) self._define_dll_functions() @@ -68,14 +68,14 @@ def get_string(self, dll_function: Callable, max_size=100) -> str: Parameters ---------- dll_function: Callable - DLL function to be called. It must be a function that returns a string. + DLL function to call. It must be a function that returns a string. max_size: int - The maximum number of string characters to return. This will be used for the string buffer size. + Maximum number of string characters to return. This value is used for the string buffer size. Returns ------- str - The requested string. If 'status' , Error message is returned. + Requested string. If '`status`', an error message is returned. """ text_buffer = ctypes.create_string_buffer(max_size) status = dll_function(text_buffer, max_size) @@ -90,9 +90,9 @@ def set_string(self, dll_function: Callable, string: str): Parameters ---------- dll_function: Callable - DLL function to be called. It must be a function that set a string. + DLL function to call. It must be a function that sets a string. string: str - String to be set. + String to set. """ bytes_value = bytes(string, "ascii") status = dll_function(bytes_value) @@ -100,38 +100,38 @@ def set_string(self, dll_function: Callable, string: str): def string_to_enum(self, enum_type: Enum, string: str) -> Enum: """ - Convert string to the defined string by Enum. + Convert string to a string defined by an enum. Parameters ---------- enum_type: Enum - Enum to be called. + Enum to call. string: str - String to be converted. + String to convert. Returns ------- str - Converted entered string to the Enum string. + Converted enum string. """ fixed_string = string.upper().replace(" ", "_") return enum_type[fixed_string] def enum_to_string(self, enum_value: Enum) -> str: """ - Convert the defined string by Enum to string. + Convert a string defined by an enum to a string. Parameters ---------- enum_type: Enum - Enum to be called. + Enum to call. string: str - String to be converted. + String to convert. Returns ------- str - Converted Enum string to the compatible string. + String converted from the enum string. """ fixed_string = str(enum_value.name).replace("_", " ").lower() return fixed_string diff --git a/pyaedt/filtersolutions_core/graph_setup.py b/pyaedt/filtersolutions_core/graph_setup.py index 7277aa35df6..429d9a8daeb 100644 --- a/pyaedt/filtersolutions_core/graph_setup.py +++ b/pyaedt/filtersolutions_core/graph_setup.py @@ -5,19 +5,19 @@ class GraphSetup: - """Defines minimum and maximum of freuquncy and time parameters of filter responses. + """Defines the minimum and maximum of the frequency and time parameters of the filter Attributes ---------- _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class. Methods ---------- _define_graph_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -49,7 +49,7 @@ def _define_graph_dll_functions(self): @property def minimum_frequency(self) -> str: - """Minimum frequency value for exporting frequency and S parameters responses. The default is 200 MHz. + """Minimum frequency value for exporting frequency and S parameters responses. The default is ``200 MHz``. Returns ------- @@ -64,7 +64,7 @@ def minimum_frequency(self, min_freq_string): @property def maximum_frequency(self) -> str: - """Maximum frequency value for exporting frequency and S parameters responses. The default is 5 GHz. + """Maximum frequency value for exporting frequency and S parameters responses. The default is ``5 GHz``. Returns ------- @@ -79,7 +79,7 @@ def maximum_frequency(self, max_freq_string): @property def minimum_time(self) -> str: - """Minimum time value for exporting time response. The default is 0 s. + """Minimum time value for exporting time response. The default is ``0 s``. Returns ------- @@ -94,7 +94,7 @@ def minimum_time(self, min_time_string): @property def maximum_time(self) -> str: - """Maximum time value for exporting time response. The default is 10 ns. + """Maximum time value for exporting time response. The default is ``10 ns``. Returns ------- diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py index cb3be6f7f25..03fd61c7f4d 100644 --- a/pyaedt/filtersolutions_core/ideal_response.py +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -12,7 +12,7 @@ class FrequencyResponseColumn(Enum): - """Selects frequency response parameter. + """Provides an enum of frequency response parameters. Attributes: MAGNITUDE_DB: Represents the frequency response magnitude in dB. @@ -40,7 +40,7 @@ class FrequencyResponseColumn(Enum): class TimeResponseColumn(Enum): - """Selects time response parameter. + """Provides an enum of time response parameters. Attributes: STEP_RESPONSE: Represents the step time response. @@ -62,7 +62,7 @@ class TimeResponseColumn(Enum): class SParametersResponseColumn(Enum): - """Selects S parameter. + """Provides an enum of S parameters. Attributes: S21_DB: Represents the S21 parameter in dB. @@ -80,7 +80,7 @@ class SParametersResponseColumn(Enum): class PoleZerosResponseColumn(Enum): - """Selects pole zero x and y coordinates of transmission (TX) or reflection (RX) zeros. + """Provides an enum of pole zero x and y coordinates of transmission (TX) or reflection (RX) zeros. Attributes: TX_ZERO_DEN_X: Represents the x coordinate of filter transmission zero denominator. @@ -121,23 +121,23 @@ class PoleZerosResponseColumn(Enum): class IdealResponse: """Exports the data for available ideal filter responses. - Includes `frequency`, `time`, `S parameters`, `transfer function`, or `pole zero location` responses. + Includes ``frequency``, ``time``, ``S parameters``, ``transfer function``, or ``pole zero location`` responses. - This class allows you to construct all the necessary ideal response attributes for the FilterDesign class. + This class allows you to construct all the necessary ideal response attributes for the ``FilterDesign`` class. Attributes ---------- _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class graph_setup: GraphSetup - an instance of GraphSetup class + Instance of the ``GraphSetup`` class Methods ---------- _define_response_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -187,8 +187,8 @@ def _frequency_response_getter(self, column: FrequencyResponseColumn): Parameters ---------- - column: FrequencyResponseColumn - Defined parameter to be exported. + column: `FrequencyResponseColumn` + Parameter to export. Returns ------- @@ -209,8 +209,8 @@ def _time_response_getter(self, column: TimeResponseColumn): Parameters ---------- - column: TimeResponseColumn - Defined parameter to be exported. + column: `TimeResponseColumn` + Parameter to export. Returns ------- @@ -231,8 +231,8 @@ def _sparamaters_response_getter(self, column: SParametersResponseColumn): Parameters ---------- - column: SParametersResponseColumn - Defined parameter to be exported. + column: `SParametersResponseColumn` + Parameter to export. Returns ------- @@ -253,8 +253,8 @@ def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): Parameters ---------- - column: PoleZerosResponseColumn - Parameter to be exported. + column: `PoleZerosResponseColumn` + Parameter to export. Returns ------- @@ -288,7 +288,7 @@ def transfer_function_response(self): @property def vsg_analysis_enabled(self) -> bool: - """Whether to include offset due to source resistor in frequency and time responses. The default is ``False``. + """Flag indicating if the offset due to source resistor in frequency and time responses is enabled. Returns ------- @@ -316,14 +316,14 @@ def frequency_response( Parameters ---------- - y_axis_parameter: FrequencyResponseColumn, optional - Defined parameter to be exported. The default is frequency response magnitude in dB. + y_axis_parameter: `FrequencyResponseColumn`, optional + Parameter to export. The default is frequency response magnitude in dB. minimum_frequency: str, optional - The default is 200 MHz. + The default is ``200 MHz``. maximum_frequency: str, optional - The default is 5 GHz. + The default is ``5 GHz``. vsg_analysis_enabled: bool, optional - The default is False. + The default is ``False``. Returns ------- @@ -354,14 +354,14 @@ def time_response( Parameters ---------- - y_axis_parameter: TimeResponseColumn, optional - Defined parameter to be exported. The default is step time response. + y_axis_parameter: `TimeResponseColumn`, optional + Parameter to export. The default is step time response. minimum_time: str, optional - The default is 0 s. + The default is ``0 s``. maximum_time: str, optional - The default is 10 ns. + The default is ``10 ns``. vsg_analysis_enabled: bool, optional - The default is False. + The default is ``False``. Returns ------- @@ -388,14 +388,14 @@ def s_parameters( Parameters ---------- - y_axis_parameter: SParametersResponseColumn, optional - Defined parameter to be exported. The default is S21 parameter response in dB. + y_axis_parameter: `SParametersResponseColumn`, optional + Parameter to export. The default is S21 parameter response in dB. minimum_frequency: str, optional - The default is 200 MHz. + The default is ``200 MHz``. maximum_frequency: str, optional - The default is 5 GHz. + The default is ``5 GHz``. vsg_analysis_enabled: bool, optional - The default is False. + The default is ``False``. Returns ------- @@ -423,10 +423,10 @@ def pole_zero_locations( Parameters ---------- - x_axis_parameter: PoleZerosResponseColumn, optional - Defined parameter to be exported. The default is x coordinate of filter transmission zero denominator. - y_axis_parameter: PoleZerosResponseColumn, optional - Defined parameter to be exported. The default is y coordinate of filter transmission zero denominator. + x_axis_parameter: `PoleZerosResponseColumn`, optional + Parameter to export. The default is x coordinate of filter transmission zero denominator. + y_axis_parameter: `PoleZerosResponseColumn`, optional + Parameter to export. The default is y coordinate of filter transmission zero denominator. Returns ------- diff --git a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py index 2bfb4afa75d..0a7968c2262 100644 --- a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py +++ b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py @@ -18,12 +18,12 @@ class LumpedNodesandLeads: _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class Methods ---------- _define_nodes_and_leads_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -76,7 +76,7 @@ def _define_nodes_and_leads_dll_functions(self): @property def c_node_capacitor(self) -> str: """Shunt capacitors value of non ideal capacitors nodes in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -92,7 +92,7 @@ def c_node_capacitor(self, c_node_capacitor): @property def c_lead_inductor(self) -> str: """Series inductors value of non ideal capacitors leades in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -108,7 +108,7 @@ def c_lead_inductor(self, c_lead_inductor): @property def l_node_capacitor(self) -> str: """Shunt capacitors value of non ideal inductors nodes in synthesized circuit - The default is `0`. + The default is` ``0``. Returns ------- @@ -124,7 +124,7 @@ def l_node_capacitor(self, l_node_capacitor): @property def l_lead_inductor(self) -> str: """Series inductors value of non ideal inductors leades in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -140,7 +140,7 @@ def l_lead_inductor(self, l_lead_inductor): @property def r_node_capacitor(self) -> str: """Shunt capacitors value of non ideal resistors nodes in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -156,7 +156,7 @@ def r_node_capacitor(self, r_node_capacitor): @property def r_lead_inductor(self) -> str: """Series inductors value of non ideal resistors leades in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -171,8 +171,7 @@ def r_lead_inductor(self, r_lead_inductor): @property def c_node_compensate(self) -> bool: - """Whether to check adjust capacitor values to compensate for node capacitance, when possible. - The default is `False`. + """Flag indicating if the possible adjust capacitor values to compensate for node capacitance is enabled. Returns ------- @@ -190,8 +189,7 @@ def c_node_compensate(self, c_node_compensate: bool): @property def l_node_compensate(self) -> bool: - """Whether to check adjust inductor values to compensate for lead inductance, when possible. - The default is `False`. + """Flag indicating if the possible adjust inductor values to compensate for lead inductance is enabled. Returns ------- diff --git a/pyaedt/filtersolutions_core/lumped_parasitics.py b/pyaedt/filtersolutions_core/lumped_parasitics.py index 768096a6afc..dbbc30c9cfe 100644 --- a/pyaedt/filtersolutions_core/lumped_parasitics.py +++ b/pyaedt/filtersolutions_core/lumped_parasitics.py @@ -15,12 +15,12 @@ class LumpedParasitics: _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class Methods ---------- _define_parasitics_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -73,7 +73,7 @@ def _define_parasitics_dll_functions(self): @property def capacitor_q(self) -> str: """Q factor value of non ideal capacitors in synthesized circuit - The default is `infinite`. + The default is ``infinite``. Returns ------- @@ -89,7 +89,7 @@ def capacitor_q(self, capacitor_q_string): @property def capacitor_rs(self) -> str: """Series resistor value of non ideal capacitors in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -105,7 +105,7 @@ def capacitor_rs(self, capacitor_rs_string): @property def capacitor_rp(self) -> str: """Shunt resistor value of non ideal capacitors in synthesized circuit - The default is `infinite`. + The default is ``infinite``. Returns ------- @@ -121,7 +121,7 @@ def capacitor_rp(self, capacitor_rp_string): @property def capacitor_ls(self) -> str: """Series inductance value of non ideal capacitors in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- @@ -137,7 +137,7 @@ def capacitor_ls(self, capacitor_ls_string): @property def inductor_q(self) -> str: """Q factor value of non ideal inductors in synthesized circuit - The default is `infinite`. + The default is ``infinite``. Returns ------- @@ -153,7 +153,7 @@ def inductor_q(self, inductor_q_string): @property def inductor_rs(self) -> str: """Series resistor value of non ideal inductors in synthesized circuit - The default is `0`. + The default is` ``0``. Returns ------- @@ -169,7 +169,7 @@ def inductor_rs(self, inductor_rs_string): @property def inductor_rp(self) -> str: """Shunt resistor value of non ideal inductors in synthesized circuit - The default is `infinite`. + The default is ``infinite``. Returns ------- @@ -185,7 +185,7 @@ def inductor_rp(self, inductor_rp_string): @property def inductor_cp(self) -> str: """Shunt capacitor value of non ideal inductors in synthesized circuit - The default is `0`. + The default is ``0``. Returns ------- diff --git a/pyaedt/filtersolutions_core/lumped_termination_impedance.py b/pyaedt/filtersolutions_core/lumped_termination_impedance.py index 67e45afc184..c0fb9403fdb 100644 --- a/pyaedt/filtersolutions_core/lumped_termination_impedance.py +++ b/pyaedt/filtersolutions_core/lumped_termination_impedance.py @@ -60,14 +60,14 @@ class LumpedTerminationImpedance: _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class - table_type: TerminationType + Instance of the ``DllInterface`` class + table_type: `TerminationType` Whether selects source or load complex impedance table. Methods ---------- _define_termination_impedance_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self, table_type): @@ -158,7 +158,7 @@ def table_type_to_bool(self): @property def row_count(self) -> int: """The count of accumulated complex impedances in the complex impedances tables. - The default is `3`. + The default is ``3``. Returns ------- @@ -293,11 +293,11 @@ def remove_row(self, row_index): @property def complex_definition(self) -> ComplexTerminationDefinition: """The definition type of complex impedances in the complex impedance tables. - The default is `Cartesian`. + The default is ``Cartesian``. Returns ------- - :enum: ComplexTerminationDefinition + :enum:`ComplexTerminationDefinition` """ type_string_buffer = create_string_buffer(100) status = self._dll.getLumpedComplexDefinition( @@ -319,11 +319,11 @@ def complex_definition(self, complex_definition: ComplexTerminationDefinition): @property def reactance_type(self) -> ComplexReactanceType: """The reactance type of complex impedances in the complex impedance tables. - The default is `reactance`. + The default is ``reactance``. Returns ------- - :enum: ComplexReactanceType + :enum:`ComplexReactanceType` """ type_string_buffer = create_string_buffer(100) @@ -345,8 +345,7 @@ def reactance_type(self, reactance_type: ComplexReactanceType): @property def compensation_enabled(self) -> bool: - """Whether to enable the impedance compnesation option. - The default is `False`. + """Flag indicating if the impedance compnesation is enabled. Returns ------- @@ -365,7 +364,7 @@ def compensation_enabled(self, compensation_enabled: bool): @property def compensation_order(self) -> int: """The order of impedance compnesation. - The default is `2`. + The default is` ``2``. Returns ------- diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index d9350b1f578..25bb868af50 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -17,12 +17,12 @@ class LumpedTopology: _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class Methods ---------- _define_topology_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -144,7 +144,7 @@ def _define_topology_dll_functions(self): @property def generator_resistor(self) -> str: - """Generator resistor. The default is `50`. + """Generator resistor. The default is ``50``. Returns ------- @@ -159,7 +159,7 @@ def generator_resistor(self, generator_resistor_string): @property def load_resistor(self) -> str: - """Load resistor. The default is `50`. + """Load resistor. The default is ``50``. Returns ------- @@ -174,7 +174,7 @@ def load_resistor(self, load_resistor_string): @property def current_source(self) -> bool: - """Whether to implement current source in synthesized circuit . The default is `False`. + """Flag indicating if the current source in synthesized circuit is enabled. Returns ------- @@ -192,9 +192,8 @@ def current_source(self, current_source: bool): @property def first_shunt(self) -> bool: - """Whether to implement shunt element(s) as first element(s) in synthesized circuit . - The default is `True` for shunt element(s). - If `False` implements series element(s) as first element(s) in synthesized circuit . + """Flag indicating if the shunt element(s) as first element(s) in synthesized circuit is enabled. + If ``False`` implements series element(s) as first element(s) in synthesized circuit . Returns ------- @@ -212,8 +211,7 @@ def first_shunt(self, first_shunt: bool): @property def bridge_t(self) -> bool: - """Whether to implement bridgeT topology in synthesized circuit . - The default is `False` + """Flag indicating if the bridgeT topology in synthesized circuit is enabled. Returns ------- @@ -231,8 +229,7 @@ def bridge_t(self, bridge_t: bool): @property def bridge_t_low(self) -> bool: - """Whether to implement bridgeT topology for lower frequency band in synthesized diplexer. - The default is `False` + """Flag indicating if the bridgeT topology for lower frequency band in synthesized circuit is enabled. Returns ------- @@ -250,8 +247,7 @@ def bridge_t_low(self, bridge_t_low: bool): @property def bridge_t_high(self) -> bool: - """Whether to implement bridgeT topology for higher frequency band in synthesized diplexer. - The default is `False` + """Flag indicating if the bridgeT topology for higher frequency band in synthesized circuit is enabled. Returns ------- @@ -269,8 +265,7 @@ def bridge_t_high(self, bridge_t_high: bool): @property def equal_inductors(self) -> bool: - """Whether to implement equal inductors topology in synthesized circuit . - The default is `False` + """Flag indicating if the equal inductors topology in synthesized circuit is enabled. Returns ------- @@ -288,8 +283,7 @@ def equal_inductors(self, equal_inductors: bool): @property def equal_capacitors(self) -> bool: - """Whether to implement equal capacitors topology in synthesized circuit . - The default is `False` + """Flag indicating if the equal capacitors topology in synthesized circuit is enabled. Returns ------- @@ -307,8 +301,7 @@ def equal_capacitors(self, equal_capacitors: bool): @property def equal_legs(self) -> bool: - """Whether to implement equal pairs shunt or series legs topology in synthesized circuit . - The default is `False` + """Flag indicating if the equal pairs shunt or series legs topology in synthesized circuit is enabled. Returns ------- @@ -326,8 +319,7 @@ def equal_legs(self, equal_legs: bool): @property def high_low_pass(self) -> bool: - """Whether to implement high and low pass topology in synthesized circuit . - The default is `False` + """Flag indicating if the high and low pass topology in synthesized circuit is enabled. Returns ------- @@ -345,8 +337,7 @@ def high_low_pass(self, high_low_pass: bool): @property def high_low_pass_min_ind(self) -> bool: - """Whether to implement high and low pass topology with minimum inductors in synthesized circuit . - The default is `False` + """Flag indicating if the high and low pass topology with minimum inductors in synthesized circuit is enabled. Returns ------- @@ -364,8 +355,7 @@ def high_low_pass_min_ind(self, high_low_pass_min_ind: bool): @property def zig_zag(self) -> bool: - """Whether to implement zig zag topology with minimum inductors in synthesized circuit . - The default is `False` + """Flag indicating if the zig zag topology with minimum inductors in synthesized circuit is enabled. Returns ------- @@ -383,8 +373,7 @@ def zig_zag(self, zig_zag: bool): @property def min_ind(self) -> bool: - """Whether to implement minimum inductors topology in synthesized circuit . - The default is `False` + """Flag indicating if the minimum inductors topology in synthesized circuit is enabled. Returns ------- @@ -402,8 +391,7 @@ def min_ind(self, min_ind: bool): @property def min_cap(self) -> bool: - """Whether to implement minimum capacitors topology in synthesized circuit . - The default is `False` + """Flag indicating if the minimum capacitors topology in synthesized circuit is enabled. Returns ------- @@ -421,8 +409,7 @@ def min_cap(self, min_cap: bool): @property def set_source_res(self) -> bool: - """Whether to set matched source resistor for zig zag topology in synthesized circuit . - The default is `False` + """Flag indicating if the matched source resistor for zig-zag topology in synthesized circuit is enabled. Returns ------- @@ -440,8 +427,7 @@ def set_source_res(self, set_source_res: bool): @property def trap_topology(self) -> bool: - """Whether to implement trap topology in synthesized circuit . - The default is `False` + """Flag indicating if the trap topology in synthesized circuit is enabled. Returns ------- @@ -459,8 +445,7 @@ def trap_topology(self, trap_topology: bool): @property def node_cap_ground(self) -> bool: - """Whether to implement parasitic capacitors to ground topology in synthesized circuit . - The default is `False` + """Flag indicating if the parasitic capacitors to ground topology in synthesized circuit is enabled. Returns ------- @@ -478,8 +463,7 @@ def node_cap_ground(self, node_cap_ground: bool): @property def match_impedance(self) -> bool: - """Whether to implement automatic matched impedance topology in synthesized circuit . - The default is `False` + """Flag indicating if the automatic matched impedance topology in synthesized circuit is enabled. Returns ------- @@ -497,8 +481,7 @@ def match_impedance(self, match_impedance: bool): @property def complex_termination(self) -> bool: - """Whether to select lumped filter complex termination. - The default is `False` + """Flag indicating if the lumped filter complex termination is enabled. Returns ------- @@ -516,8 +499,7 @@ def complex_termination(self, complex_termination: bool): @property def complex_element_tune_enabled(self) -> bool: - """Whether to enable the element tune option. - The default is `True`. + """Flag indicating if the element tune option is enabled. Returns ------- diff --git a/pyaedt/filtersolutions_core/multiple_bands_table.py b/pyaedt/filtersolutions_core/multiple_bands_table.py index d66647e4597..791cac4c950 100644 --- a/pyaedt/filtersolutions_core/multiple_bands_table.py +++ b/pyaedt/filtersolutions_core/multiple_bands_table.py @@ -17,12 +17,12 @@ class MultipleBandsTable: _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class Methods ---------- _define_multiple_bands_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self): @@ -53,7 +53,7 @@ def _define_multiple_bands_dll_functions(self): @property def row_count(self) -> int: """The count of accumulated frequenices in the multiple bands table. - The default is `2`. + The default is ``2``. Returns ------- @@ -78,7 +78,7 @@ def row(self, row_index): str: Lower frequency value. str: - upper frequency value. + Upper frequency value. """ lower_value_buffer = create_string_buffer(100) upper_value_buffer = create_string_buffer(100) @@ -124,7 +124,7 @@ def insert_row(self, row_index, lower_frequency, upper_frequency): Parameters ---------- row_index: int - The row index on multiple bands table. Starting value is 0 and maximum value is 6. + The row index on multiple bands table. Starting value is ``0`` and maximum value is ``6``. lower_frequency: str upper_frequency: str """ @@ -139,7 +139,7 @@ def remove_row(self, row_index): Parameters ---------- row_index: int - The row index on multiple bands table. Starting value is 0 and maximum value is 6. + The row index on multiple bands table. Starting value is ``0`` and maximum value is ``6``. """ status = self._dll.removeMultipleBandsTableRow(row_index) pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/transmission_zeros.py b/pyaedt/filtersolutions_core/transmission_zeros.py index a1a2ffed4d5..61e0e1c24fa 100644 --- a/pyaedt/filtersolutions_core/transmission_zeros.py +++ b/pyaedt/filtersolutions_core/transmission_zeros.py @@ -31,14 +31,14 @@ class TransmissionZeros: _dll: CDLL FilterSolutions C++ API DLL. _dll_interface: DllInterface - an instance of DllInterface class + Instance of the ``DllInterface`` class table_format: TableFormat Whether selects ratio or frequency transmission zeros table. Methods ---------- _define_transmission_zeros_dll_functions: - Define argument types of DLL function. + Define argument types of DLL functions. """ def __init__(self, table_format): @@ -108,7 +108,7 @@ def table_format_to_bool(self): @property def row_count(self) -> int: """The count of accumulated transmission zeros in the transmission zeros table. - The default is `2`. + The default is ``2``. Returns ------- @@ -125,7 +125,7 @@ def row(self, row_index): Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. Returns ------- @@ -155,7 +155,7 @@ def update_row(self, row_index, zero="", position=""): Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. zero: str, optional Transmission zero ratio or frequency value. The default is blank. @@ -196,7 +196,7 @@ def insert_row(self, row_index, zero, position=""): Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. zero: str Transmission zero ratio or frequency value. position: str @@ -218,7 +218,7 @@ def remove_row(self, row_index): Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is 0 and maximum value is 9. + The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. """ status = self._dll.removeTransmissionZerosTableRow(row_index, self.table_format_to_bool()) pyaedt.filtersolutions_core._dll_interface().raise_error(status) From fa86310e0e00807025339738de3c806568bcf19d Mon Sep 17 00:00:00 2001 From: raghajaf Date: Mon, 10 Jun 2024 17:47:29 -0400 Subject: [PATCH 11/26] feat/draft_filtersolutions: gitignore file is updated --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 04fc496fd00..772fe74e7c3 100644 --- a/.gitignore +++ b/.gitignore @@ -395,4 +395,5 @@ model.index\+ # local environment settings used by e.g. Visual Studio Code /.env -/.cov/** +/doc/source/local_config.json +/.cov/ From bad5160f8cf699b509a7ccf0c55a7478125d71fa Mon Sep 17 00:00:00 2001 From: raghajaf Date: Tue, 11 Jun 2024 14:29:17 -0400 Subject: [PATCH 12/26] feat/draft_filtersolutions: Test class is added. --- .../test_filter/test_attributes.py | 1089 +++++++---------- .../test_filter/test_dll_interface.py | 40 +- .../test_filter/test_graph_setup.py | 57 +- .../test_filter/test_ideal_response.py | 630 +++++----- .../test_filter/test_multiple_bands_table.py | 122 +- .../test_filter/test_transmission_zeros.py | 224 ++-- .../test_lumped_nodes_and_leads.py | 212 ++-- .../test_lumped_parasitics.py | 212 ++-- .../test_lumped_termination_impedance.py | 284 ++--- .../test_lumped_topology.py | 903 +++++++------- .../test_raise_error.py | 11 +- 11 files changed, 1707 insertions(+), 2077 deletions(-) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index a629f8f1967..4427bac9b9e 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -18,628 +18,467 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_type(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.filter_type == FilterType.BUTTERWORTH - - assert len(FilterType) == 9 - - for fimp in [FilterImplementation.LUMPED]: - design.attributes.filter_implementation = fimp - for ftype in FilterType: - design.attributes.filter_type = ftype - assert design.attributes.filter_type == ftype - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_class(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.filter_class == FilterClass.LOW_PASS - - # Only lumped supports all classes - # TODO: Confirm proper exceptions are raised when setting unsupported filter class for each implementation. - - assert len(FilterClass) == 10 - for index, fclass in enumerate(FilterClass): - if index > 5: - design.attributes.filter_multiple_bands_enabled = True - design.attributes.filter_class = fclass - assert design.attributes.filter_class == fclass - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_multiple_bands_enabled(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.filter_multiple_bands_enabled is False - design.attributes.filter_multiple_bands_enabled = True - assert design.attributes.filter_multiple_bands_enabled - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_multiple_bands_low_pass_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - design.attributes.filter_class = FilterClass.LOW_BAND - assert design.attributes.filter_multiple_bands_low_pass_frequency == "1G" - design.attributes.filter_multiple_bands_low_pass_frequency = "500M" - assert design.attributes.filter_multiple_bands_low_pass_frequency == "500M" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_multiple_bands_high_pass_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - design.attributes.filter_class = FilterClass.BAND_HIGH - assert design.attributes.filter_multiple_bands_high_pass_frequency == "1G" - design.attributes.filter_multiple_bands_high_pass_frequency = "500M" - assert design.attributes.filter_multiple_bands_high_pass_frequency == "500M" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_implementation(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert len(FilterImplementation) == 5 - for fimplementation in FilterImplementation: - design.attributes.filter_implementation = fimplementation - assert design.attributes.filter_implementation == fimplementation - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_diplexer_type(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert len(DiplexerType) == 6 - for index, diplexer_type in enumerate(DiplexerType): - if index < 3: - design.attributes.filter_class = FilterClass.DIPLEXER_1 - elif index > 2: - design.attributes.filter_class = FilterClass.DIPLEXER_2 - design.attributes.diplexer_type = diplexer_type - assert design.attributes.diplexer_type == diplexer_type - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_order(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.order == 5 - - with pytest.raises(RuntimeError) as info: - design.attributes.order = 0 - assert info.value.args[0] == "The minimum order is 1" - - for i in range(1, 22): - design.attributes.order = i - assert design.attributes.order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.order = 22 - assert info.value.args[0] == "The maximum order is 21" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_order_stop_band_att(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" - design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" - assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_order_stop_band_freq(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" - design.attributes.minimum_order_stop_band_frequency = "500 MHz" - assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_order_group_delay_error_percent(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.DELAY - assert design.attributes.minimum_order_group_delay_error_percent == "5" - design.attributes.minimum_order_group_delay_error_percent = "7" - assert design.attributes.minimum_order_group_delay_error_percent == "7" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_order_group_delay_cutoff(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.DELAY - assert design.attributes.minimum_order_group_delay_cutoff == "2 GHz" - design.attributes.minimum_order_group_delay_cutoff = "500 MHz" - assert design.attributes.minimum_order_group_delay_cutoff == "500 MHz" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_order_stop_band_freq(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" - design.attributes.minimum_order_stop_band_frequency = "500 MHz" - assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_order(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.order == 5 - design.attributes.ideal_minimum_order - assert design.attributes.order == 3 - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_pass_band_definition(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - assert len(PassbandDefinition) == 2 - assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY - for pbd in PassbandDefinition: - design.attributes.pass_band_definition = pbd - assert design.attributes.pass_band_definition == pbd - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_pass_band_center_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.pass_band_center_frequency == "1G" - design.attributes.pass_band_center_frequency = "500M" - assert design.attributes.pass_band_center_frequency == "500M" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_pass_band_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - assert design.attributes.pass_band_width_frequency == "200M" - design.attributes.pass_band_width_frequency = "500M" - assert design.attributes.pass_band_width_frequency == "500M" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lower_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES - assert design.attributes.lower_frequency == "905 M" - design.attributes.lower_frequency = "800M" - assert design.attributes.lower_frequency == "800M" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_upper_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES - assert design.attributes.upper_frequency == "1.105 G" - design.attributes.upper_frequency = "1.2 G" - assert design.attributes.upper_frequency == "1.2 G" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_stop_band_definition(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - assert len(StopbandDefinition) == 3 - assert design.attributes.stop_band_definition == StopbandDefinition.RATIO - for sbd in StopbandDefinition: - design.attributes.stop_band_definition = sbd - assert design.attributes.stop_band_definition == sbd - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_stop_band_ratio(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - assert design.attributes.stop_band_ratio == "1.2" - design.attributes.stop_band_ratio = "1.5" - assert design.attributes.stop_band_ratio == "1.5" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_stop_band_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY - assert design.attributes.stop_band_frequency == "1.2 G" - design.attributes.stop_band_frequency = "1.5 G" - assert design.attributes.stop_band_frequency == "1.5 G" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_stop_band_attenuation(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB - assert design.attributes.stop_band_attenuation_db == "60" - design.attributes.stop_band_attenuation_db = "40 dB" - assert design.attributes.stop_band_attenuation_db == "40" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_standard_pass_band_attenuation(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.standard_pass_band_attenuation - design.attributes.standard_pass_band_attenuation = False - assert design.attributes.standard_pass_band_attenuation is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_standard_pass_band_attenuation_value_db(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.standard_pass_band_attenuation = False - assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" - design.attributes.standard_pass_band_attenuation_value_db = "4" - assert design.attributes.standard_pass_band_attenuation_value_db == "4" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_equiripple_delay(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.DELAY - assert design.attributes.equiripple_delay - design.attributes.equiripple_delay = False - assert design.attributes.equiripple_delay is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_group_delay_ripple_period(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.DELAY - assert design.attributes.group_delay_ripple_period == "2" - design.attributes.group_delay_ripple_period = "3" - assert design.attributes.group_delay_ripple_period == "3" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_normalized_group_delay_percentage(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.DELAY - assert len(BesselRipplePercentage) == 6 - for normalized_group_delay_percentage in BesselRipplePercentage: - design.attributes.normalized_group_delay_percentage = normalized_group_delay_percentage - assert design.attributes.normalized_group_delay_percentage == normalized_group_delay_percentage - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_bessel_normalized_delay(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.BESSEL - assert design.attributes.bessel_normalized_delay is False - design.attributes.bessel_normalized_delay = True - assert design.attributes.bessel_normalized_delay - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_bessel_normalized_delay_period(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.BESSEL - design.attributes.bessel_normalized_delay = True - assert design.attributes.bessel_normalized_delay_period == "2" - design.attributes.bessel_normalized_delay_period = "3" - assert design.attributes.bessel_normalized_delay_period == "3" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_bessel_normalized_delay_percentage(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.BESSEL - design.attributes.bessel_normalized_delay = True - assert len(BesselRipplePercentage) == 6 - for bessel_normalized_delay_percentage in BesselRipplePercentage: - design.attributes.bessel_normalized_delay_percentage = bessel_normalized_delay_percentage - assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_pass_band_ripple(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - assert design.attributes.pass_band_ripple == ".05" - design.attributes.pass_band_ripple = ".03" - assert design.attributes.pass_band_ripple == ".03" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_arith_symmetry(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.filter_class = FilterClass.BAND_PASS - assert design.attributes.arith_symmetry is False - design.attributes.arith_symmetry = True - assert design.attributes.arith_symmetry - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - assert design.attributes.asymmetric is False - design.attributes.asymmetric = True - assert design.attributes.asymmetric - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric_low_order(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.asymmetric = True - assert design.attributes.asymmetric_low_order == 5 - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_low_order = 0 - assert info.value.args[0] == "The minimum order is 1" - - for i in range(1, 22): - design.attributes.asymmetric_low_order = i - assert design.attributes.asymmetric_low_order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_low_order = 22 - assert info.value.args[0] == "The maximum order is 21" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric_high_order(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.asymmetric = True - assert design.attributes.asymmetric_high_order == 5 - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_high_order = 0 - assert info.value.args[0] == "The minimum order is 1" - - for i in range(1, 22): - design.attributes.asymmetric_high_order = i - assert design.attributes.asymmetric_high_order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.asymmetric_high_order = 22 - assert info.value.args[0] == "The maximum order is 21" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric_low_stop_band_ratio(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_low_stop_band_ratio == "1.2" - design.attributes.asymmetric_low_stop_band_ratio = "1.5" - assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric_high_stop_band_ratio(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_high_stop_band_ratio == "1.2" - design.attributes.asymmetric_high_stop_band_ratio = "1.5" - assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric_low_stop_band_attenuation_db(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_low_stop_band_attenuation_db == "60" - design.attributes.asymmetric_low_stop_band_attenuation_db = "40" - assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_asymmetric_high_stop_band_attenuation_db(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.asymmetric = True - assert design.attributes.asymmetric_high_stop_band_attenuation_db == "60" - design.attributes.asymmetric_high_stop_band_attenuation_db = "40" - assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_gaussian_transition(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.GAUSSIAN - assert len(GaussianTransition) == 6 - for gaussian_transition in GaussianTransition: - design.attributes.gaussian_transition = gaussian_transition - assert design.attributes.gaussian_transition == gaussian_transition - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_gaussian_bessel_reflection(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.BESSEL - assert len(GaussianBesselReflection) == 3 - for gaussian_bessel_reflection in GaussianBesselReflection: - design.attributes.gaussian_bessel_reflection = gaussian_bessel_reflection - assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_even_order(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.order = 4 - assert design.attributes.even_order - design.attributes.even_order = False - assert design.attributes.even_order is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_even_order_refl_zero(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.order = 4 - assert design.attributes.even_order_refl_zero - design.attributes.even_order_refl_zero = False - assert design.attributes.even_order_refl_zero is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_even_order_trn_zero(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.order = 4 - assert design.attributes.even_order_trn_zero - design.attributes.even_order_trn_zero = False - assert design.attributes.even_order_trn_zero is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_constrict_ripple(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - assert design.attributes.constrict_ripple is False - design.attributes.constrict_ripple = True - assert design.attributes.constrict_ripple - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_single_point_ripple(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - assert design.attributes.single_point_ripple is False - design.attributes.single_point_ripple = True - assert design.attributes.single_point_ripple - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_half_band_ripple(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - assert design.attributes.half_band_ripple is False - design.attributes.half_band_ripple = True - assert design.attributes.half_band_ripple - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_constrict_ripple_percent(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.constrict_ripple = True - assert design.attributes.constrict_ripple_percent == "50%" - design.attributes.constrict_ripple_percent = "40%" - assert design.attributes.constrict_ripple_percent == "40%" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_ripple_constriction_band(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.constrict_ripple = True - assert len(RippleConstrictionBandSelect) == 3 - for ripple_constriction_band in RippleConstrictionBandSelect: - design.attributes.ripple_constriction_band = ripple_constriction_band - assert design.attributes.ripple_constriction_band == ripple_constriction_band - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_single_point_ripple_inf_zeros(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_type = FilterType.ELLIPTIC - design.attributes.single_point_ripple = True - assert len(SinglePointRippleInfZeros) == 2 - for single_point_ripple_inf_zeros in SinglePointRippleInfZeros: - design.attributes.single_point_ripple_inf_zeros = single_point_ripple_inf_zeros - assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_delay_equalizer(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.attributes.delay_equalizer is False - design.attributes.delay_equalizer = True - assert design.attributes.delay_equalizer - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_delay_equalizer_order(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.delay_equalizer = True - assert design.attributes.delay_equalizer_order == 2 - - for i in range(0, 21): - design.attributes.delay_equalizer_order = i - assert design.attributes.delay_equalizer_order == i - - with pytest.raises(RuntimeError) as info: - design.attributes.delay_equalizer_order = 21 - assert info.value.args[0] == "The maximum order is 20" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_standard_delay_equ_pass_band_attenuation(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.delay_equalizer = True - assert design.attributes.standard_delay_equ_pass_band_attenuation - design.attributes.standard_delay_equ_pass_band_attenuation = False - assert design.attributes.standard_delay_equ_pass_band_attenuation is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_standard_delay_equ_pass_band_attenuation_value_db(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.delay_equalizer = True - design.attributes.standard_delay_equ_pass_band_attenuation = False - assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" - design.attributes.standard_delay_equ_pass_band_attenuation_value_db = "4" - assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "4" +class TestClass: + def test_filter_type(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.filter_type == FilterType.BUTTERWORTH + + assert len(FilterType) == 9 + + for fimp in [FilterImplementation.LUMPED]: + design.attributes.filter_implementation = fimp + for ftype in FilterType: + design.attributes.filter_type = ftype + assert design.attributes.filter_type == ftype + + def test_filter_class(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.filter_class == FilterClass.LOW_PASS + + # Only lumped supports all classes + # TODO: Confirm proper exceptions are raised when setting unsupported filter class for each implementation. + + assert len(FilterClass) == 10 + for index, fclass in enumerate(FilterClass): + if index > 5: + design.attributes.filter_multiple_bands_enabled = True + design.attributes.filter_class = fclass + assert design.attributes.filter_class == fclass + + def test_filter_multiple_bands_enabled(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.filter_multiple_bands_enabled is False + design.attributes.filter_multiple_bands_enabled = True + assert design.attributes.filter_multiple_bands_enabled + + def test_filter_multiple_bands_low_pass_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.attributes.filter_class = FilterClass.LOW_BAND + assert design.attributes.filter_multiple_bands_low_pass_frequency == "1G" + design.attributes.filter_multiple_bands_low_pass_frequency = "500M" + assert design.attributes.filter_multiple_bands_low_pass_frequency == "500M" + + def test_filter_multiple_bands_high_pass_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.attributes.filter_class = FilterClass.BAND_HIGH + assert design.attributes.filter_multiple_bands_high_pass_frequency == "1G" + design.attributes.filter_multiple_bands_high_pass_frequency = "500M" + assert design.attributes.filter_multiple_bands_high_pass_frequency == "500M" + + def test_filter_implementation(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert len(FilterImplementation) == 5 + for fimplementation in FilterImplementation: + design.attributes.filter_implementation = fimplementation + assert design.attributes.filter_implementation == fimplementation + + def test_diplexer_type(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert len(DiplexerType) == 6 + for index, diplexer_type in enumerate(DiplexerType): + if index < 3: + design.attributes.filter_class = FilterClass.DIPLEXER_1 + elif index > 2: + design.attributes.filter_class = FilterClass.DIPLEXER_2 + design.attributes.diplexer_type = diplexer_type + assert design.attributes.diplexer_type == diplexer_type + + def test_order(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.order = i + assert design.attributes.order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.order = 22 + assert info.value.args[0] == "The maximum order is 21" + + def test_minimum_order_stop_band_att(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.minimum_order_stop_band_attenuation_db == "60 dB" + design.attributes.minimum_order_stop_band_attenuation_db = "40 dB" + assert design.attributes.minimum_order_stop_band_attenuation_db == "40 dB" + + def test_minimum_order_stop_band_freq(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" + design.attributes.minimum_order_stop_band_frequency = "500 MHz" + assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" + + def test_minimum_order_group_delay_error_percent(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.minimum_order_group_delay_error_percent == "5" + design.attributes.minimum_order_group_delay_error_percent = "7" + assert design.attributes.minimum_order_group_delay_error_percent == "7" + + def test_minimum_order_group_delay_cutoff(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.minimum_order_group_delay_cutoff == "2 GHz" + design.attributes.minimum_order_group_delay_cutoff = "500 MHz" + assert design.attributes.minimum_order_group_delay_cutoff == "500 MHz" + + def test_minimum_order_stop_band_freq(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.minimum_order_stop_band_frequency == "10 GHz" + design.attributes.minimum_order_stop_band_frequency = "500 MHz" + assert design.attributes.minimum_order_stop_band_frequency == "500 MHz" + + def test_minimum_order(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.order == 5 + design.attributes.ideal_minimum_order + assert design.attributes.order == 3 + + def test_pass_band_definition(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + assert len(PassbandDefinition) == 2 + assert design.attributes.pass_band_definition == PassbandDefinition.CENTER_FREQUENCY + for pbd in PassbandDefinition: + design.attributes.pass_band_definition = pbd + assert design.attributes.pass_band_definition == pbd + + def test_pass_band_center_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.pass_band_center_frequency == "1G" + design.attributes.pass_band_center_frequency = "500M" + assert design.attributes.pass_band_center_frequency == "500M" + + def test_pass_band_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + assert design.attributes.pass_band_width_frequency == "200M" + design.attributes.pass_band_width_frequency = "500M" + assert design.attributes.pass_band_width_frequency == "500M" + + def test_lower_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.lower_frequency == "905 M" + design.attributes.lower_frequency = "800M" + assert design.attributes.lower_frequency == "800M" + + def test_upper_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.upper_frequency == "1.105 G" + design.attributes.upper_frequency = "1.2 G" + assert design.attributes.upper_frequency == "1.2 G" + + def test_stop_band_definition(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + assert len(StopbandDefinition) == 3 + assert design.attributes.stop_band_definition == StopbandDefinition.RATIO + for sbd in StopbandDefinition: + design.attributes.stop_band_definition = sbd + assert design.attributes.stop_band_definition == sbd + + def test_stop_band_ratio(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + assert design.attributes.stop_band_ratio == "1.2" + design.attributes.stop_band_ratio = "1.5" + assert design.attributes.stop_band_ratio == "1.5" + + def test_stop_band_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.FREQUENCY + assert design.attributes.stop_band_frequency == "1.2 G" + design.attributes.stop_band_frequency = "1.5 G" + assert design.attributes.stop_band_frequency == "1.5 G" + + def test_stop_band_attenuation(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.stop_band_definition = StopbandDefinition.ATTENUATION_DB + assert design.attributes.stop_band_attenuation_db == "60" + design.attributes.stop_band_attenuation_db = "40 dB" + assert design.attributes.stop_band_attenuation_db == "40" + + def test_standard_pass_band_attenuation(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.standard_pass_band_attenuation + design.attributes.standard_pass_band_attenuation = False + assert design.attributes.standard_pass_band_attenuation is False + + def test_standard_pass_band_attenuation_value_db(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.standard_pass_band_attenuation = False + assert design.attributes.standard_pass_band_attenuation_value_db == "3.01" + design.attributes.standard_pass_band_attenuation_value_db = "4" + assert design.attributes.standard_pass_band_attenuation_value_db == "4" + + def test_equiripple_delay(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.equiripple_delay + design.attributes.equiripple_delay = False + assert design.attributes.equiripple_delay is False + + def test_group_delay_ripple_period(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert design.attributes.group_delay_ripple_period == "2" + design.attributes.group_delay_ripple_period = "3" + assert design.attributes.group_delay_ripple_period == "3" + + def test_normalized_group_delay_percentage(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.DELAY + assert len(BesselRipplePercentage) == 6 + for normalized_group_delay_percentage in BesselRipplePercentage: + design.attributes.normalized_group_delay_percentage = normalized_group_delay_percentage + assert design.attributes.normalized_group_delay_percentage == normalized_group_delay_percentage + + def test_bessel_normalized_delay(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL + assert design.attributes.bessel_normalized_delay is False + design.attributes.bessel_normalized_delay = True + assert design.attributes.bessel_normalized_delay + + def test_bessel_normalized_delay_period(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL + design.attributes.bessel_normalized_delay = True + assert design.attributes.bessel_normalized_delay_period == "2" + design.attributes.bessel_normalized_delay_period = "3" + assert design.attributes.bessel_normalized_delay_period == "3" + + def test_bessel_normalized_delay_percentage(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL + design.attributes.bessel_normalized_delay = True + assert len(BesselRipplePercentage) == 6 + for bessel_normalized_delay_percentage in BesselRipplePercentage: + design.attributes.bessel_normalized_delay_percentage = bessel_normalized_delay_percentage + assert design.attributes.bessel_normalized_delay_percentage == bessel_normalized_delay_percentage + + def test_pass_band_ripple(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + assert design.attributes.pass_band_ripple == ".05" + design.attributes.pass_band_ripple = ".03" + assert design.attributes.pass_band_ripple == ".03" + + def test_arith_symmetry(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.filter_class = FilterClass.BAND_PASS + assert design.attributes.arith_symmetry is False + design.attributes.arith_symmetry = True + assert design.attributes.arith_symmetry + + def test_asymmetric(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + assert design.attributes.asymmetric is False + design.attributes.asymmetric = True + assert design.attributes.asymmetric + + def test_asymmetric_low_order(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_low_order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.asymmetric_low_order = i + assert design.attributes.asymmetric_low_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_low_order = 22 + assert info.value.args[0] == "The maximum order is 21" + + def test_asymmetric_high_order(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_order == 5 + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_high_order = 0 + assert info.value.args[0] == "The minimum order is 1" + + for i in range(1, 22): + design.attributes.asymmetric_high_order = i + assert design.attributes.asymmetric_high_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.asymmetric_high_order = 22 + assert info.value.args[0] == "The maximum order is 21" + + def test_asymmetric_low_stop_band_ratio(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_stop_band_ratio == "1.2" + design.attributes.asymmetric_low_stop_band_ratio = "1.5" + assert design.attributes.asymmetric_low_stop_band_ratio == "1.5" + + def test_asymmetric_high_stop_band_ratio(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_stop_band_ratio == "1.2" + design.attributes.asymmetric_high_stop_band_ratio = "1.5" + assert design.attributes.asymmetric_high_stop_band_ratio == "1.5" + + def test_asymmetric_low_stop_band_attenuation_db(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_low_stop_band_attenuation_db == "60" + design.attributes.asymmetric_low_stop_band_attenuation_db = "40" + assert design.attributes.asymmetric_low_stop_band_attenuation_db == "40" + + def test_asymmetric_high_stop_band_attenuation_db(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.asymmetric = True + assert design.attributes.asymmetric_high_stop_band_attenuation_db == "60" + design.attributes.asymmetric_high_stop_band_attenuation_db = "40" + assert design.attributes.asymmetric_high_stop_band_attenuation_db == "40" + + def test_gaussian_transition(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.GAUSSIAN + assert len(GaussianTransition) == 6 + for gaussian_transition in GaussianTransition: + design.attributes.gaussian_transition = gaussian_transition + assert design.attributes.gaussian_transition == gaussian_transition + + def test_gaussian_bessel_reflection(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.BESSEL + assert len(GaussianBesselReflection) == 3 + for gaussian_bessel_reflection in GaussianBesselReflection: + design.attributes.gaussian_bessel_reflection = gaussian_bessel_reflection + assert design.attributes.gaussian_bessel_reflection == gaussian_bessel_reflection + + def test_even_order(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order + design.attributes.even_order = False + assert design.attributes.even_order is False + + def test_even_order_refl_zero(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order_refl_zero + design.attributes.even_order_refl_zero = False + assert design.attributes.even_order_refl_zero is False + + def test_even_order_trn_zero(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.order = 4 + assert design.attributes.even_order_trn_zero + design.attributes.even_order_trn_zero = False + assert design.attributes.even_order_trn_zero is False + + def test_constrict_ripple(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + assert design.attributes.constrict_ripple is False + design.attributes.constrict_ripple = True + assert design.attributes.constrict_ripple + + def test_single_point_ripple(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + assert design.attributes.single_point_ripple is False + design.attributes.single_point_ripple = True + assert design.attributes.single_point_ripple + + def test_half_band_ripple(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + assert design.attributes.half_band_ripple is False + design.attributes.half_band_ripple = True + assert design.attributes.half_band_ripple + + def test_constrict_ripple_percent(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.constrict_ripple = True + assert design.attributes.constrict_ripple_percent == "50%" + design.attributes.constrict_ripple_percent = "40%" + assert design.attributes.constrict_ripple_percent == "40%" + + def test_ripple_constriction_band(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.constrict_ripple = True + assert len(RippleConstrictionBandSelect) == 3 + for ripple_constriction_band in RippleConstrictionBandSelect: + design.attributes.ripple_constriction_band = ripple_constriction_band + assert design.attributes.ripple_constriction_band == ripple_constriction_band + + def test_single_point_ripple_inf_zeros(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_type = FilterType.ELLIPTIC + design.attributes.single_point_ripple = True + assert len(SinglePointRippleInfZeros) == 2 + for single_point_ripple_inf_zeros in SinglePointRippleInfZeros: + design.attributes.single_point_ripple_inf_zeros = single_point_ripple_inf_zeros + assert design.attributes.single_point_ripple_inf_zeros == single_point_ripple_inf_zeros + + def test_delay_equalizer(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.attributes.delay_equalizer is False + design.attributes.delay_equalizer = True + assert design.attributes.delay_equalizer + + def test_delay_equalizer_order(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.delay_equalizer = True + assert design.attributes.delay_equalizer_order == 2 + + for i in range(0, 21): + design.attributes.delay_equalizer_order = i + assert design.attributes.delay_equalizer_order == i + + with pytest.raises(RuntimeError) as info: + design.attributes.delay_equalizer_order = 21 + assert info.value.args[0] == "The maximum order is 20" + + def test_standard_delay_equ_pass_band_attenuation(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.delay_equalizer = True + assert design.attributes.standard_delay_equ_pass_band_attenuation + design.attributes.standard_delay_equ_pass_band_attenuation = False + assert design.attributes.standard_delay_equ_pass_band_attenuation is False + + def test_standard_delay_equ_pass_band_attenuation_value_db(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.delay_equalizer = True + design.attributes.standard_delay_equ_pass_band_attenuation = False + assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "3.01" + design.attributes.standard_delay_equ_pass_band_attenuation_value_db = "4" + assert design.attributes.standard_delay_equ_pass_band_attenuation_value_db == "4" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index 9254cf4ca55..1a9d0a93c15 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -9,26 +9,20 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_version(): - assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_string_to_enum(): - assert pyaedt.filtersolutions_core._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_enum_to_string(): - assert pyaedt.filtersolutions_core._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_raise_error(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" +class TestClass: + def test_version(self): + assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" + + def test_string_to_enum(self): + assert ( + pyaedt.filtersolutions_core._dll_interface().string_to_enum(FilterType, "gaussian") == FilterType.GAUSSIAN + ) + + def test_enum_to_string(self): + assert pyaedt.filtersolutions_core._dll_interface().enum_to_string(FilterType.GAUSSIAN) == "gaussian" + + def test_raise_error(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index 5a2dfda4e7b..af952a0900d 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -8,35 +8,28 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.graph_setup.minimum_frequency == "200 MHz" - design.graph_setup.minimum_frequency = "500 MHz" - assert design.graph_setup.minimum_frequency == "500 MHz" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_maximum_frequency(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.graph_setup.maximum_frequency == "5 GHz" - design.graph_setup.maximum_frequency = "2 GHz" - assert design.graph_setup.maximum_frequency == "2 GHz" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_minimum_time(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.graph_setup.minimum_time == "0" - design.graph_setup.minimum_time = "5 ns" - assert design.graph_setup.minimum_time == "5 ns" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_maximum_time(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.graph_setup.maximum_time == "10n" - design.graph_setup.maximum_time = "8 ns" - assert design.graph_setup.maximum_time == "8 ns" +class TestClass: + + def test_minimum_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.graph_setup.minimum_frequency == "200 MHz" + design.graph_setup.minimum_frequency = "500 MHz" + assert design.graph_setup.minimum_frequency == "500 MHz" + + def test_maximum_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.graph_setup.maximum_frequency == "5 GHz" + design.graph_setup.maximum_frequency = "2 GHz" + assert design.graph_setup.maximum_frequency == "2 GHz" + + def test_minimum_time(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.graph_setup.minimum_time == "0" + design.graph_setup.minimum_time = "5 ns" + assert design.graph_setup.minimum_time == "5 ns" + + def test_maximum_time(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.graph_setup.maximum_time == "10n" + design.graph_setup.maximum_time = "8 ns" + assert design.graph_setup.maximum_time == "8 ns" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index 38de935766e..19a6820649b 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -14,337 +14,323 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_frequency_response_getter(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) +class TestClass: + def test_frequency_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - mag_db = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_DB) - assert len(mag_db) == 500 - assert mag_db[100] == pytest.approx(-0.0002779395744451339) - assert mag_db[300] == pytest.approx(-14.14973347970826) - assert mag_db[-1] == pytest.approx(-69.61741290615645) - phs_deg = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEG) - assert len(phs_deg) == 500 - assert phs_deg[100] == pytest.approx(-72.00174823521779) - assert phs_deg[300] == pytest.approx(57.235563076374426) - assert phs_deg[-1] == pytest.approx(-52.48142049626833) - grp_dly = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.GROUP_DELAY) - assert len(grp_dly) == 500 - assert grp_dly[100] == pytest.approx(5.476886038520659e-10) - assert grp_dly[300] == pytest.approx(3.6873949391963247e-10) - assert grp_dly[-1] == pytest.approx(2.1202561661746704e-11) - phs_rad = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_RAD) - assert len(phs_rad) == 500 - assert phs_rad[100] == pytest.approx(-1.256667573896567) - assert phs_rad[300] == pytest.approx(0.9989490249156284) - assert phs_rad[-1] == pytest.approx(-0.9159735837835188) - mag_art = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_ARITH) - assert len(mag_art) == 500 - assert mag_art[100] == pytest.approx(0.9999680015359182) - assert mag_art[300] == pytest.approx(0.1961161351381822) - assert mag_art[-1] == pytest.approx(0.000330467956321812) - mag_r = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_REAL) - assert len(mag_r) == 500 - assert mag_r[100] == pytest.approx(0.3089780880159494) - assert mag_r[300] == pytest.approx(0.10613537973464354) - assert mag_r[-1] == pytest.approx(0.00020126115208825366) - mag_x = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_IMAG) - assert len(mag_x) == 500 - assert mag_x[100] == pytest.approx(-0.9510355120718397) - assert mag_x[300] == pytest.approx(0.1649145828303876) - assert mag_x[-1] == pytest.approx(-0.00026211260712835594) - phs_dev_deg = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEV_DEG) - assert len(phs_dev_deg) == 500 - assert phs_dev_deg[100] == pytest.approx(116.73031543331324) - assert phs_dev_deg[300] == pytest.approx(-50.566997975196706) - assert phs_dev_deg[-1] == pytest.approx(67.66973459820802) - phs_dev_rad = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEV_RAD) - assert len(phs_dev_rad) == 500 - assert phs_dev_rad[100] == pytest.approx(2.0373283412028673) - assert phs_dev_rad[300] == pytest.approx(-0.8825606075164885) - assert phs_dev_rad[-1] == pytest.approx(1.181059672689452) - freqs = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.FREQUENCY) - assert len(freqs) == 500 - assert freqs[100] == 2392202091.5388284 - assert freqs[300] == 8669097136.772985 - assert freqs[-1] == 31214328219.225075 + mag_db = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_DB) + assert len(mag_db) == 500 + assert mag_db[100] == pytest.approx(-0.0002779395744451339) + assert mag_db[300] == pytest.approx(-14.14973347970826) + assert mag_db[-1] == pytest.approx(-69.61741290615645) + phs_deg = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEG) + assert len(phs_deg) == 500 + assert phs_deg[100] == pytest.approx(-72.00174823521779) + assert phs_deg[300] == pytest.approx(57.235563076374426) + assert phs_deg[-1] == pytest.approx(-52.48142049626833) + grp_dly = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.GROUP_DELAY) + assert len(grp_dly) == 500 + assert grp_dly[100] == pytest.approx(5.476886038520659e-10) + assert grp_dly[300] == pytest.approx(3.6873949391963247e-10) + assert grp_dly[-1] == pytest.approx(2.1202561661746704e-11) + phs_rad = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_RAD) + assert len(phs_rad) == 500 + assert phs_rad[100] == pytest.approx(-1.256667573896567) + assert phs_rad[300] == pytest.approx(0.9989490249156284) + assert phs_rad[-1] == pytest.approx(-0.9159735837835188) + mag_art = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_ARITH) + assert len(mag_art) == 500 + assert mag_art[100] == pytest.approx(0.9999680015359182) + assert mag_art[300] == pytest.approx(0.1961161351381822) + assert mag_art[-1] == pytest.approx(0.000330467956321812) + mag_r = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_REAL) + assert len(mag_r) == 500 + assert mag_r[100] == pytest.approx(0.3089780880159494) + assert mag_r[300] == pytest.approx(0.10613537973464354) + assert mag_r[-1] == pytest.approx(0.00020126115208825366) + mag_x = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.MAGNITUDE_IMAG) + assert len(mag_x) == 500 + assert mag_x[100] == pytest.approx(-0.9510355120718397) + assert mag_x[300] == pytest.approx(0.1649145828303876) + assert mag_x[-1] == pytest.approx(-0.00026211260712835594) + phs_dev_deg = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEV_DEG) + assert len(phs_dev_deg) == 500 + assert phs_dev_deg[100] == pytest.approx(116.73031543331324) + assert phs_dev_deg[300] == pytest.approx(-50.566997975196706) + assert phs_dev_deg[-1] == pytest.approx(67.66973459820802) + phs_dev_rad = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.PHASE_DEV_RAD) + assert len(phs_dev_rad) == 500 + assert phs_dev_rad[100] == pytest.approx(2.0373283412028673) + assert phs_dev_rad[300] == pytest.approx(-0.8825606075164885) + assert phs_dev_rad[-1] == pytest.approx(1.181059672689452) + freqs = design.ideal_response._frequency_response_getter(FrequencyResponseColumn.FREQUENCY) + assert len(freqs) == 500 + assert freqs[100] == 2392202091.5388284 + assert freqs[300] == 8669097136.772985 + assert freqs[-1] == 31214328219.225075 + @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") + @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") + class TestClass: -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_time_response_getter(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) - assert len(step_response) == 300 - assert step_response[100] == pytest.approx(1.0006647872833518) - assert step_response[200] == pytest.approx(0.9999988501385255) - assert step_response[-1] == pytest.approx(0.9999999965045667) - ramp_response = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE) - assert len(ramp_response) == 300 - assert ramp_response[100] == pytest.approx(2.8184497075983895e-09) - assert ramp_response[200] == pytest.approx(6.151630831481296e-09) - assert ramp_response[-1] == pytest.approx(9.45163045223663e-09) - impulse_response = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE) - assert len(impulse_response) == 300 - assert impulse_response[100] == pytest.approx(-8537300.294689251) - assert impulse_response[200] == pytest.approx(-8538.227868086184) - assert impulse_response[-1] == pytest.approx(3.996366349798659) - step_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE_DB) - assert len(step_response_db) == 300 - assert step_response_db[100] == pytest.approx(-1.0381882969997027) - assert step_response_db[200] == pytest.approx(-1.0439706350712086) - assert step_response_db[-1] == pytest.approx(-1.0439606778565478) - ramp_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE_DB) - assert len(ramp_response_db) == 300 - assert ramp_response_db[100] == pytest.approx(-10.540507747401335) - assert ramp_response_db[200] == pytest.approx(-3.7609082425924782) - assert ramp_response_db[-1] == pytest.approx(-0.03057888328183367) - impulse_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE_DB) - assert len(impulse_response_db) == 300 - assert impulse_response_db[100] == pytest.approx(-48.60282519370875) - assert impulse_response_db[200] == pytest.approx(-100.0) - assert impulse_response_db[-1] == pytest.approx(-100.0) - time = design.ideal_response._time_response_getter(TimeResponseColumn.TIME) - assert len(time) == 300 - assert time[1] == pytest.approx(3.3333333333333335e-11) - assert time[200] == pytest.approx(6.666666666666667e-09) - assert time[-1] == pytest.approx(9.966666666666667e-09) - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_sparameters_response_getter(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) - assert len(s11_response_db) == 500 - assert s11_response_db[100] == pytest.approx(-41.93847819973562) - assert s11_response_db[300] == pytest.approx(-0.1703333929877981) - assert s11_response_db[-1] == pytest.approx(-4.742889883456317e-07) - s21_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_DB) - assert len(s21_response_db) == 500 - assert s21_response_db[100] == pytest.approx(-0.0002779395744451339) - assert s21_response_db[300] == pytest.approx(-14.14973347970826) - assert s21_response_db[-1] == pytest.approx(-69.61741290615645) - s11_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_ARITH) - assert len(s11_response) == 500 - assert s11_response[100] == pytest.approx(0.007999744012287301) - assert s11_response[300] == pytest.approx(0.9805806756909208) - assert s11_response[-1] == pytest.approx(0.9999999453954638) - s21_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_ARITH) - assert len(s21_response) == 500 - assert s21_response[100] == pytest.approx(0.9999680015359182) - assert s21_response[300] == pytest.approx(0.1961161351381822) - assert s21_response[-1] == pytest.approx(0.000330467956321812) - freqs = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.FREQUENCY) - assert len(freqs) == 500 - assert freqs[100] == pytest.approx(2392202091.5388284) - assert freqs[300] == pytest.approx(8669097136.772985) - assert freqs[-1] == pytest.approx(31214328219.225075) - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_pole_zeros_response_getter(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) - assert len(pole_zero_den_x) == 5 - assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) - assert pole_zero_den_x[1] == pytest.approx(-809016994.3749474) - assert pole_zero_den_x[2] == pytest.approx(-809016994.3749474) - assert pole_zero_den_x[3] == pytest.approx(-309016994.3749475) - assert pole_zero_den_x[4] == pytest.approx(-309016994.3749475) - pole_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_Y) - assert len(pole_zero_den_y) == 5 - assert pole_zero_den_y[0] == pytest.approx(0.0) - assert pole_zero_den_y[1] == pytest.approx(587785252.2924731) - assert pole_zero_den_y[2] == pytest.approx(-587785252.2924731) - assert pole_zero_den_y[3] == pytest.approx(951056516.2951534) - assert pole_zero_den_y[4] == pytest.approx(-951056516.2951534) - pole_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_X) - assert len(pole_zero_num_x) == 0 - pole_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_Y) - assert len(pole_zero_num_y) == 0 - proto_pole_zero_den_x = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_X - ) - assert len(proto_pole_zero_den_x) == 5 - assert proto_pole_zero_den_x[0] == pytest.approx(-0.30901699437494745) - assert proto_pole_zero_den_x[1] == pytest.approx(-0.30901699437494745) - assert proto_pole_zero_den_x[2] == pytest.approx(-0.8090169943749475) - assert proto_pole_zero_den_x[3] == pytest.approx(-0.8090169943749475) - assert proto_pole_zero_den_x[4] == pytest.approx(-1.0) - proto_pole_zero_den_y = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_Y - ) - assert len(proto_pole_zero_den_y) == 5 - assert proto_pole_zero_den_y[0] == pytest.approx(0.9510565162951534) - assert proto_pole_zero_den_y[1] == pytest.approx(-0.9510565162951534) - assert proto_pole_zero_den_y[2] == pytest.approx(-0.5877852522924731) - assert proto_pole_zero_den_y[3] == pytest.approx(0.5877852522924731) - assert proto_pole_zero_den_y[4] == pytest.approx(0.0) - proto_pole_zero_num_x = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_X - ) - assert len(proto_pole_zero_num_x) == 0 - proto_pole_zero_num_y = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_Y - ) - assert len(proto_pole_zero_num_y) == 0 - rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_X) - assert len(rx_zero_den_x) == 5 - assert rx_zero_den_x[0] == pytest.approx(-1000000000.0) - assert rx_zero_den_x[1] == pytest.approx(-809016994.3749474) - assert rx_zero_den_x[2] == pytest.approx(-809016994.3749474) - assert rx_zero_den_x[3] == pytest.approx(-309016994.3749475) - assert rx_zero_den_x[4] == pytest.approx(-309016994.3749475) - rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_Y) - assert len(rx_zero_den_y) == 5 - assert rx_zero_den_y[0] == pytest.approx(0.0) - assert rx_zero_den_y[1] == pytest.approx(587785252.2924731) - assert rx_zero_den_y[2] == pytest.approx(-587785252.2924731) - assert rx_zero_den_y[3] == pytest.approx(951056516.2951534) - assert rx_zero_den_y[4] == pytest.approx(-951056516.2951534) - rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_X) - assert len(rx_zero_num_x) == 5 - assert rx_zero_num_x[0] == pytest.approx(0.0) - assert rx_zero_num_x[1] == pytest.approx(0.0) - assert rx_zero_num_x[2] == pytest.approx(0.0) - assert rx_zero_num_x[3] == pytest.approx(0.0) - assert rx_zero_num_x[4] == pytest.approx(0.0) - rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_Y) - assert len(rx_zero_num_y) == 5 - assert rx_zero_num_y[0] == pytest.approx(0.0) - assert rx_zero_num_y[1] == pytest.approx(0.0) - assert rx_zero_num_y[2] == pytest.approx(0.0) - assert rx_zero_num_y[3] == pytest.approx(0.0) - assert rx_zero_num_y[4] == pytest.approx(0.0) - proto_rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_X) - assert len(proto_rx_zero_den_x) == 5 - assert proto_rx_zero_den_x[0] == pytest.approx(-0.30901699437494745) - assert proto_rx_zero_den_x[1] == pytest.approx(-0.30901699437494745) - assert proto_rx_zero_den_x[2] == pytest.approx(-0.8090169943749475) - assert proto_rx_zero_den_x[3] == pytest.approx(-0.8090169943749475) - assert proto_rx_zero_den_x[4] == pytest.approx(-1.0) - proto_rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_Y) - assert len(proto_rx_zero_den_y) == 5 - assert proto_rx_zero_den_y[0] == pytest.approx(0.9510565162951534) - assert proto_rx_zero_den_y[1] == pytest.approx(-0.9510565162951534) - assert proto_rx_zero_den_y[2] == pytest.approx(-0.5877852522924731) - assert proto_rx_zero_den_y[3] == pytest.approx(0.5877852522924731) - assert proto_rx_zero_den_y[4] == pytest.approx(0.0) - proto_rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_X) - assert len(proto_rx_zero_num_x) == 5 - assert proto_rx_zero_num_x[0] == pytest.approx(0.0) - assert proto_rx_zero_num_x[1] == pytest.approx(0.0) - assert proto_rx_zero_num_x[2] == pytest.approx(0.0) - assert proto_rx_zero_num_x[3] == pytest.approx(0.0) - assert proto_rx_zero_num_x[4] == pytest.approx(0.0) - proto_rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_Y) - assert len(proto_rx_zero_num_y) == 5 - assert proto_rx_zero_num_y[0] == pytest.approx(0.0) - assert proto_rx_zero_num_y[1] == pytest.approx(0.0) - assert proto_rx_zero_num_y[2] == pytest.approx(0.0) - assert proto_rx_zero_num_y[3] == pytest.approx(0.0) - assert proto_rx_zero_num_y[4] == pytest.approx(0.0) - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_filter_vsg_analysis_enabled(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.ideal_response.vsg_analysis_enabled is False - design.ideal_response.vsg_analysis_enabled = True - assert design.ideal_response.vsg_analysis_enabled + def test_time_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) + assert len(step_response) == 300 + assert step_response[100] == pytest.approx(1.0006647872833518) + assert step_response[200] == pytest.approx(0.9999988501385255) + assert step_response[-1] == pytest.approx(0.9999999965045667) + ramp_response = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE) + assert len(ramp_response) == 300 + assert ramp_response[100] == pytest.approx(2.8184497075983895e-09) + assert ramp_response[200] == pytest.approx(6.151630831481296e-09) + assert ramp_response[-1] == pytest.approx(9.45163045223663e-09) + impulse_response = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE) + assert len(impulse_response) == 300 + assert impulse_response[100] == pytest.approx(-8537300.294689251) + assert impulse_response[200] == pytest.approx(-8538.227868086184) + assert impulse_response[-1] == pytest.approx(3.996366349798659) + step_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE_DB) + assert len(step_response_db) == 300 + assert step_response_db[100] == pytest.approx(-1.0381882969997027) + assert step_response_db[200] == pytest.approx(-1.0439706350712086) + assert step_response_db[-1] == pytest.approx(-1.0439606778565478) + ramp_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE_DB) + assert len(ramp_response_db) == 300 + assert ramp_response_db[100] == pytest.approx(-10.540507747401335) + assert ramp_response_db[200] == pytest.approx(-3.7609082425924782) + assert ramp_response_db[-1] == pytest.approx(-0.03057888328183367) + impulse_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE_DB) + assert len(impulse_response_db) == 300 + assert impulse_response_db[100] == pytest.approx(-48.60282519370875) + assert impulse_response_db[200] == pytest.approx(-100.0) + assert impulse_response_db[-1] == pytest.approx(-100.0) + time = design.ideal_response._time_response_getter(TimeResponseColumn.TIME) + assert len(time) == 300 + assert time[1] == pytest.approx(3.3333333333333335e-11) + assert time[200] == pytest.approx(6.666666666666667e-09) + assert time[-1] == pytest.approx(9.966666666666667e-09) + def test_sparameters_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) + assert len(s11_response_db) == 500 + assert s11_response_db[100] == pytest.approx(-41.93847819973562) + assert s11_response_db[300] == pytest.approx(-0.1703333929877981) + assert s11_response_db[-1] == pytest.approx(-4.742889883456317e-07) + s21_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_DB) + assert len(s21_response_db) == 500 + assert s21_response_db[100] == pytest.approx(-0.0002779395744451339) + assert s21_response_db[300] == pytest.approx(-14.14973347970826) + assert s21_response_db[-1] == pytest.approx(-69.61741290615645) + s11_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_ARITH) + assert len(s11_response) == 500 + assert s11_response[100] == pytest.approx(0.007999744012287301) + assert s11_response[300] == pytest.approx(0.9805806756909208) + assert s11_response[-1] == pytest.approx(0.9999999453954638) + s21_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_ARITH) + assert len(s21_response) == 500 + assert s21_response[100] == pytest.approx(0.9999680015359182) + assert s21_response[300] == pytest.approx(0.1961161351381822) + assert s21_response[-1] == pytest.approx(0.000330467956321812) + freqs = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.FREQUENCY) + assert len(freqs) == 500 + assert freqs[100] == pytest.approx(2392202091.5388284) + assert freqs[300] == pytest.approx(8669097136.772985) + assert freqs[-1] == pytest.approx(31214328219.225075) -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_frequency_response(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - freq, mag_db = design.ideal_response.frequency_response( - y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, - minimum_frequency="200 MHz", - maximum_frequency="5 GHz", - vsg_analysis_enabled=False, - ) - assert len(freq) == 500 - assert freq[100] == pytest.approx(380730787.74317527) - assert freq[300] == pytest.approx(1379729661.4612174) - assert freq[-1] == pytest.approx(4967914631.382509) - assert len(mag_db) == 500 - assert mag_db[100] == pytest.approx(-0.0002779395744451339) - assert mag_db[300] == pytest.approx(-14.14973347970826) - assert mag_db[-1] == pytest.approx(-69.61741290615645) + def test_pole_zeros_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) + assert len(pole_zero_den_x) == 5 + assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) + assert pole_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert pole_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert pole_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert pole_zero_den_x[4] == pytest.approx(-309016994.3749475) + pole_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_Y) + assert len(pole_zero_den_y) == 5 + assert pole_zero_den_y[0] == pytest.approx(0.0) + assert pole_zero_den_y[1] == pytest.approx(587785252.2924731) + assert pole_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert pole_zero_den_y[3] == pytest.approx(951056516.2951534) + assert pole_zero_den_y[4] == pytest.approx(-951056516.2951534) + pole_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_X) + assert len(pole_zero_num_x) == 0 + pole_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_Y) + assert len(pole_zero_num_y) == 0 + proto_pole_zero_den_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_X + ) + assert len(proto_pole_zero_den_x) == 5 + assert proto_pole_zero_den_x[0] == pytest.approx(-0.30901699437494745) + assert proto_pole_zero_den_x[1] == pytest.approx(-0.30901699437494745) + assert proto_pole_zero_den_x[2] == pytest.approx(-0.8090169943749475) + assert proto_pole_zero_den_x[3] == pytest.approx(-0.8090169943749475) + assert proto_pole_zero_den_x[4] == pytest.approx(-1.0) + proto_pole_zero_den_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_Y + ) + assert len(proto_pole_zero_den_y) == 5 + assert proto_pole_zero_den_y[0] == pytest.approx(0.9510565162951534) + assert proto_pole_zero_den_y[1] == pytest.approx(-0.9510565162951534) + assert proto_pole_zero_den_y[2] == pytest.approx(-0.5877852522924731) + assert proto_pole_zero_den_y[3] == pytest.approx(0.5877852522924731) + assert proto_pole_zero_den_y[4] == pytest.approx(0.0) + proto_pole_zero_num_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_X + ) + assert len(proto_pole_zero_num_x) == 0 + proto_pole_zero_num_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_Y + ) + assert len(proto_pole_zero_num_y) == 0 + rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_X) + assert len(rx_zero_den_x) == 5 + assert rx_zero_den_x[0] == pytest.approx(-1000000000.0) + assert rx_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert rx_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert rx_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert rx_zero_den_x[4] == pytest.approx(-309016994.3749475) + rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_Y) + assert len(rx_zero_den_y) == 5 + assert rx_zero_den_y[0] == pytest.approx(0.0) + assert rx_zero_den_y[1] == pytest.approx(587785252.2924731) + assert rx_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert rx_zero_den_y[3] == pytest.approx(951056516.2951534) + assert rx_zero_den_y[4] == pytest.approx(-951056516.2951534) + rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_X) + assert len(rx_zero_num_x) == 5 + assert rx_zero_num_x[0] == pytest.approx(0.0) + assert rx_zero_num_x[1] == pytest.approx(0.0) + assert rx_zero_num_x[2] == pytest.approx(0.0) + assert rx_zero_num_x[3] == pytest.approx(0.0) + assert rx_zero_num_x[4] == pytest.approx(0.0) + rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_Y) + assert len(rx_zero_num_y) == 5 + assert rx_zero_num_y[0] == pytest.approx(0.0) + assert rx_zero_num_y[1] == pytest.approx(0.0) + assert rx_zero_num_y[2] == pytest.approx(0.0) + assert rx_zero_num_y[3] == pytest.approx(0.0) + assert rx_zero_num_y[4] == pytest.approx(0.0) + proto_rx_zero_den_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_X + ) + assert len(proto_rx_zero_den_x) == 5 + assert proto_rx_zero_den_x[0] == pytest.approx(-0.30901699437494745) + assert proto_rx_zero_den_x[1] == pytest.approx(-0.30901699437494745) + assert proto_rx_zero_den_x[2] == pytest.approx(-0.8090169943749475) + assert proto_rx_zero_den_x[3] == pytest.approx(-0.8090169943749475) + assert proto_rx_zero_den_x[4] == pytest.approx(-1.0) + proto_rx_zero_den_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_Y + ) + assert len(proto_rx_zero_den_y) == 5 + assert proto_rx_zero_den_y[0] == pytest.approx(0.9510565162951534) + assert proto_rx_zero_den_y[1] == pytest.approx(-0.9510565162951534) + assert proto_rx_zero_den_y[2] == pytest.approx(-0.5877852522924731) + assert proto_rx_zero_den_y[3] == pytest.approx(0.5877852522924731) + assert proto_rx_zero_den_y[4] == pytest.approx(0.0) + proto_rx_zero_num_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_X + ) + assert len(proto_rx_zero_num_x) == 5 + assert proto_rx_zero_num_x[0] == pytest.approx(0.0) + assert proto_rx_zero_num_x[1] == pytest.approx(0.0) + assert proto_rx_zero_num_x[2] == pytest.approx(0.0) + assert proto_rx_zero_num_x[3] == pytest.approx(0.0) + assert proto_rx_zero_num_x[4] == pytest.approx(0.0) + proto_rx_zero_num_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_Y + ) + assert len(proto_rx_zero_num_y) == 5 + assert proto_rx_zero_num_y[0] == pytest.approx(0.0) + assert proto_rx_zero_num_y[1] == pytest.approx(0.0) + assert proto_rx_zero_num_y[2] == pytest.approx(0.0) + assert proto_rx_zero_num_y[3] == pytest.approx(0.0) + assert proto_rx_zero_num_y[4] == pytest.approx(0.0) + def test_filter_vsg_analysis_enabled(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.ideal_response.vsg_analysis_enabled is False + design.ideal_response.vsg_analysis_enabled = True + assert design.ideal_response.vsg_analysis_enabled -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_time_response(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - time, step_response = design.ideal_response.time_response( - y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, - minimum_time="0 ns", - maximum_time="10 ns", - vsg_analysis_enabled=False, - ) - assert len(time) == 300 - assert time[100] == pytest.approx(3.334e-09) - assert time[200] == pytest.approx(6.667e-09) - assert time[-1] == pytest.approx(9.9667e-09) + def test_frequency_response(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + freq, mag_db = design.ideal_response.frequency_response( + y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + vsg_analysis_enabled=False, + ) + assert len(freq) == 500 + assert freq[100] == pytest.approx(380730787.74317527) + assert freq[300] == pytest.approx(1379729661.4612174) + assert freq[-1] == pytest.approx(4967914631.382509) + assert len(mag_db) == 500 + assert mag_db[100] == pytest.approx(-0.0002779395744451339) + assert mag_db[300] == pytest.approx(-14.14973347970826) + assert mag_db[-1] == pytest.approx(-69.61741290615645) - assert len(step_response) == 300 - assert step_response[100] == pytest.approx(1.0006647872833518) - assert step_response[200] == pytest.approx(0.9999988501385255) - assert step_response[-1] == pytest.approx(0.9999999965045667) + def test_time_response(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + time, step_response = design.ideal_response.time_response( + y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, + minimum_time="0 ns", + maximum_time="10 ns", + vsg_analysis_enabled=False, + ) + assert len(time) == 300 + assert time[100] == pytest.approx(3.334e-09) + assert time[200] == pytest.approx(6.667e-09) + assert time[-1] == pytest.approx(9.9667e-09) + assert len(step_response) == 300 + assert step_response[100] == pytest.approx(1.0006647872833518) + assert step_response[200] == pytest.approx(0.9999988501385255) + assert step_response[-1] == pytest.approx(0.9999999965045667) -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_s_parameters(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - freq, s21_db = design.ideal_response.s_parameters( - y_axis_parameter=SParametersResponseColumn.S21_DB, - minimum_frequency="200 MHz", - maximum_frequency="5 GHz", - ) - assert len(freq) == 500 - assert freq[100] == pytest.approx(380730787.74317527) - assert freq[300] == pytest.approx(1379729661.4612174) - assert freq[-1] == pytest.approx(4967914631.382509) - assert len(s21_db) == 500 - assert s21_db[100] == pytest.approx(-0.0002779395744451339) - assert s21_db[300] == pytest.approx(-14.14973347970826) - assert s21_db[-1] == pytest.approx(-69.61741290615645) + def test_s_parameters(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + freq, s21_db = design.ideal_response.s_parameters( + y_axis_parameter=SParametersResponseColumn.S21_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + ) + assert len(freq) == 500 + assert freq[100] == pytest.approx(380730787.74317527) + assert freq[300] == pytest.approx(1379729661.4612174) + assert freq[-1] == pytest.approx(4967914631.382509) + assert len(s21_db) == 500 + assert s21_db[100] == pytest.approx(-0.0002779395744451339) + assert s21_db[300] == pytest.approx(-14.14973347970826) + assert s21_db[-1] == pytest.approx(-69.61741290615645) + def test_pole_zero_locations(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( + x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, + y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, + ) + assert len(tx_zero_den_x) == 5 + assert tx_zero_den_x[0] == pytest.approx(-1000000000.0) + assert tx_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert tx_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert tx_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert tx_zero_den_x[4] == pytest.approx(-309016994.3749475) + assert len(tx_zero_den_y) == 5 + assert tx_zero_den_y[0] == pytest.approx(0.0) + assert tx_zero_den_y[1] == pytest.approx(587785252.2924731) + assert tx_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert tx_zero_den_y[3] == pytest.approx(951056516.2951534) + assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_pole_zero_locations(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( - x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, - y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, - ) - assert len(tx_zero_den_x) == 5 - assert tx_zero_den_x[0] == pytest.approx(-1000000000.0) - assert tx_zero_den_x[1] == pytest.approx(-809016994.3749474) - assert tx_zero_den_x[2] == pytest.approx(-809016994.3749474) - assert tx_zero_den_x[3] == pytest.approx(-309016994.3749475) - assert tx_zero_den_x[4] == pytest.approx(-309016994.3749475) - assert len(tx_zero_den_y) == 5 - assert tx_zero_den_y[0] == pytest.approx(0.0) - assert tx_zero_den_y[1] == pytest.approx(587785252.2924731) - assert tx_zero_den_y[2] == pytest.approx(-587785252.2924731) - assert tx_zero_den_y[3] == pytest.approx(951056516.2951534) - assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_transfer_function_response(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - list = design.ideal_response.transfer_function_response() - list_file = open(resource_path("transferfunction.ckt")) - lines_list = list.splitlines() - lines_list_file = list_file.readlines() - for i in range(len(lines_list_file)): - assert lines_list_file[i] == lines_list[i] + "\n" + def test_transfer_function_response(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + list = design.ideal_response.transfer_function_response() + list_file = open(resource_path("transferfunction.ckt")) + lines_list = list.splitlines() + lines_list_file = list_file.readlines() + for i in range(len(lines_list_file)): + assert lines_list_file[i] == lines_list[i] + "\n" diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index 5a93f2d85eb..4f39e9feb6d 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -8,76 +8,62 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_row_count(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - assert design.multiple_bands_table.row_count == 2 +class TestClass: + def test_row_count(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + assert design.multiple_bands_table.row_count == 2 + def test_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + assert design.multiple_bands_table.row(0) == ("2G", "3G") -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - assert design.multiple_bands_table.row(0) == ("2G", "3G") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_update_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - with pytest.raises(RuntimeError) as info: - design.multiple_bands_table.update_row(0) - assert info.value.args[0] == "It is not possible to update table with an empty value" - design.multiple_bands_table.update_row(0, lower_frequency="100M") - assert design.multiple_bands_table.row(0) == ("100M", "3G") - design.multiple_bands_table.update_row(0, upper_frequency="4G") - assert design.multiple_bands_table.row(0) == ("100M", "4G") - design.multiple_bands_table.update_row(0, "200M", "5G") - assert design.multiple_bands_table.row(0) == ("200M", "5G") + def test_update_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.update_row(0) + assert info.value.args[0] == "It is not possible to update table with an empty value" + design.multiple_bands_table.update_row(0, lower_frequency="100M") + assert design.multiple_bands_table.row(0) == ("100M", "3G") + design.multiple_bands_table.update_row(0, upper_frequency="4G") + assert design.multiple_bands_table.row(0) == ("100M", "4G") + design.multiple_bands_table.update_row(0, "200M", "5G") + assert design.multiple_bands_table.row(0) == ("200M", "5G") + def test_append_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.multiple_bands_table.append_row("100M", "500M") + assert design.multiple_bands_table.row_count == 3 + assert design.multiple_bands_table.row(2) == ("100M", "500M") + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.append_row("", "500M") + assert info.value.args[0] == "It is not possible to append an empty value" + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.append_row("100M", "") + assert info.value.args[0] == "It is not possible to append an empty value" -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_append_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - design.multiple_bands_table.append_row("100M", "500M") - assert design.multiple_bands_table.row_count == 3 - assert design.multiple_bands_table.row(2) == ("100M", "500M") - with pytest.raises(RuntimeError) as info: - design.multiple_bands_table.append_row("", "500M") - assert info.value.args[0] == "It is not possible to append an empty value" - with pytest.raises(RuntimeError) as info: - design.multiple_bands_table.append_row("100M", "") - assert info.value.args[0] == "It is not possible to append an empty value" + def test_insert_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.multiple_bands_table.insert_row(0, "200M", "5G") + assert design.multiple_bands_table.row(0) == ("200M", "5G") + design.multiple_bands_table.insert_row(0, lower_frequency="500M", upper_frequency="2G") + assert design.multiple_bands_table.row(0) == ("500M", "2G") + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.insert_row(22, lower_frequency="500M", upper_frequency="2G") + assert info.value.args[0] == "The rowIndex must be greater than zero and less than row count" - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_insert_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - design.multiple_bands_table.insert_row(0, "200M", "5G") - assert design.multiple_bands_table.row(0) == ("200M", "5G") - design.multiple_bands_table.insert_row(0, lower_frequency="500M", upper_frequency="2G") - assert design.multiple_bands_table.row(0) == ("500M", "2G") - with pytest.raises(RuntimeError) as info: - design.multiple_bands_table.insert_row(22, lower_frequency="500M", upper_frequency="2G") - assert info.value.args[0] == "The rowIndex must be greater than zero and less than row count" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_remove_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_multiple_bands_enabled = True - design.multiple_bands_table.remove_row(0) - assert design.multiple_bands_table.row(0) == ("4G", "5G") - with pytest.raises(RuntimeError) as info: - design.multiple_bands_table.row(1) - assert ( - info.value.args[0] - == "Either no value is set for this band or the rowIndex must be greater than zero and less than row count" - ) + def test_remove_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_multiple_bands_enabled = True + design.multiple_bands_table.remove_row(0) + assert design.multiple_bands_table.row(0) == ("4G", "5G") + with pytest.raises(RuntimeError) as info: + design.multiple_bands_table.row(1) + assert ( + info.value.args[0] + == "Either no value is set for this band or the rowIndex must be greater than zero and less than row count" + ) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index b4cced9e3ab..96481fda03c 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -8,125 +8,105 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_row_count(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.transmission_zeros_frequency.row_count == 0 - assert design.transmission_zeros_ratio.row_count == 0 - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_update_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.update_row(0, zero="1.3G", position="2") - assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.update_row(0, "1.3", "2") - assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_append_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.append_row(zero="", position="") - assert info.value.args[0] == "The input value is blank" - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.append_row("", "") - assert info.value.args[0] == "The input value is blank" - design.transmission_zeros_frequency.append_row("1600M") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "") - design.transmission_zeros_frequency.clear_row() - design.transmission_zeros_frequency.append_row(zero="1600M", position="2") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") - design.transmission_zeros_frequency.clear_row() - design.transmission_zeros_ratio.append_row("1.6") - assert design.transmission_zeros_ratio.row(0) == ("1.6", "") - design.transmission_zeros_ratio.clear_row() - design.transmission_zeros_ratio.append_row(zero="1.6", position="2") - assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_insert_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.insert_row(6, zero="1.3G", position="2") - assert info.value.args[0] == "The given index 6 is larger than zeros order" - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.insert_row(6, "1.3", "2") - assert info.value.args[0] == "The given index 6 is larger than zeros order" - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.insert_row(0, zero="", position="2") - assert info.value.args[0] == "The input value is blank" - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.insert_row(0, "", "") - assert info.value.args[0] == "The input value is blank" - design.transmission_zeros_frequency.insert_row(0, "1600M") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "") - design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") - design.transmission_zeros_frequency.clear_row() - design.transmission_zeros_ratio.insert_row(0, "1.6") - assert design.transmission_zeros_ratio.row(0) == ("1.6", "") - design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") - assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_remove_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.remove_row(2) - assert info.value.args[0] == "The given index 2 is larger than zeros order" - design.transmission_zeros_frequency.append_row(zero="1600M", position="2") - design.transmission_zeros_frequency.remove_row(0) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_clear_row(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") - design.transmission_zeros_frequency.clear_row() - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" - design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") - assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") - design.transmission_zeros_ratio.clear_row() - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_default_position(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") - design.transmission_zeros_frequency.default_position() - assert design.transmission_zeros_frequency.row(0) == ("1600M", "3") - design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") - design.transmission_zeros_ratio.default_position() - assert design.transmission_zeros_ratio.row(0) == ("1.6", "3") +class TestClass: + def test_row_count(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.transmission_zeros_frequency.row_count == 0 + assert design.transmission_zeros_ratio.row_count == 0 + + def test_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + + def test_update_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.update_row(0, zero="1.3G", position="2") + assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.update_row(0, "1.3", "2") + assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" + + def test_append_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.append_row(zero="", position="") + assert info.value.args[0] == "The input value is blank" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.append_row("", "") + assert info.value.args[0] == "The input value is blank" + design.transmission_zeros_frequency.append_row("1600M") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "") + design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_frequency.append_row(zero="1600M", position="2") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") + design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_ratio.append_row("1.6") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "") + design.transmission_zeros_ratio.clear_row() + design.transmission_zeros_ratio.append_row(zero="1.6", position="2") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") + + def test_insert_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.insert_row(6, zero="1.3G", position="2") + assert info.value.args[0] == "The given index 6 is larger than zeros order" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.insert_row(6, "1.3", "2") + assert info.value.args[0] == "The given index 6 is larger than zeros order" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.insert_row(0, zero="", position="2") + assert info.value.args[0] == "The input value is blank" + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.insert_row(0, "", "") + assert info.value.args[0] == "The input value is blank" + design.transmission_zeros_frequency.insert_row(0, "1600M") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "") + design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") + design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_ratio.insert_row(0, "1.6") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "") + design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") + + def test_remove_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.remove_row(2) + assert info.value.args[0] == "The given index 2 is larger than zeros order" + design.transmission_zeros_frequency.append_row(zero="1600M", position="2") + design.transmission_zeros_frequency.remove_row(0) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + + def test_clear_row(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") + assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") + design.transmission_zeros_frequency.clear_row() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_frequency.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") + assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") + design.transmission_zeros_ratio.clear_row() + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" + + def test_default_position(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") + design.transmission_zeros_frequency.default_position() + assert design.transmission_zeros_frequency.row(0) == ("1600M", "3") + design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") + design.transmission_zeros_ratio.default_position() + assert design.transmission_zeros_ratio.row(0) == ("1.6", "3") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index 977f9608071..87f52599b25 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -10,119 +10,99 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_c_node_capacitor(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" - lumpdesign.leads_and_nodes.c_node_capacitor = "1n" - assert lumpdesign.leads_and_nodes.c_node_capacitor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("c_node_capacitor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_c_lead_inductor(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" - lumpdesign.leads_and_nodes.c_lead_inductor = "1n" - assert lumpdesign.leads_and_nodes.c_lead_inductor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("c_lead_inductor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_l_node_capacitor(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" - lumpdesign.leads_and_nodes.l_node_capacitor = "1n" - assert lumpdesign.leads_and_nodes.l_node_capacitor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("l_node_capacitor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_l_lead_inductor(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" - lumpdesign.leads_and_nodes.l_lead_inductor = "1n" - assert lumpdesign.leads_and_nodes.l_lead_inductor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("l_lead_inductor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_r_node_capacitor(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" - lumpdesign.leads_and_nodes.r_node_capacitor = "1n" - assert lumpdesign.leads_and_nodes.r_node_capacitor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("r_node_capacitor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_r_lead_inductor(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" - lumpdesign.leads_and_nodes.r_lead_inductor = "1n" - assert lumpdesign.leads_and_nodes.r_lead_inductor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("r_lead_inductor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_c_node_compensate(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.c_node_compensate is False - lumpdesign.leads_and_nodes.c_node_compensate = True - assert lumpdesign.leads_and_nodes.c_node_compensate - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("c_node_compensate.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_l_node_compensate(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.leads_and_nodes.l_node_compensate is False - lumpdesign.leads_and_nodes.l_node_compensate = True - assert lumpdesign.leads_and_nodes.l_node_compensate - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("l_node_compensate.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" +class TestClass: + def test_lumped_c_node_capacitor(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" + lumpdesign.leads_and_nodes.c_node_capacitor = "1n" + assert lumpdesign.leads_and_nodes.c_node_capacitor == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("c_node_capacitor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_c_lead_inductor(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" + lumpdesign.leads_and_nodes.c_lead_inductor = "1n" + assert lumpdesign.leads_and_nodes.c_lead_inductor == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("c_lead_inductor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_l_node_capacitor(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" + lumpdesign.leads_and_nodes.l_node_capacitor = "1n" + assert lumpdesign.leads_and_nodes.l_node_capacitor == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("l_node_capacitor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_l_lead_inductor(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" + lumpdesign.leads_and_nodes.l_lead_inductor = "1n" + assert lumpdesign.leads_and_nodes.l_lead_inductor == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("l_lead_inductor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_r_node_capacitor(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" + lumpdesign.leads_and_nodes.r_node_capacitor = "1n" + assert lumpdesign.leads_and_nodes.r_node_capacitor == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("r_node_capacitor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_r_lead_inductor(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" + lumpdesign.leads_and_nodes.r_lead_inductor = "1n" + assert lumpdesign.leads_and_nodes.r_lead_inductor == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("r_lead_inductor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_c_node_compensate(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.c_node_compensate is False + lumpdesign.leads_and_nodes.c_node_compensate = True + assert lumpdesign.leads_and_nodes.c_node_compensate + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("c_node_compensate.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_l_node_compensate(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.leads_and_nodes.l_node_compensate is False + lumpdesign.leads_and_nodes.l_node_compensate = True + assert lumpdesign.leads_and_nodes.l_node_compensate + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("l_node_compensate.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 6411682c24b..4fe7599ae6e 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -10,119 +10,99 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_capacitor_q(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.capacitor_q == "Inf" - lumpdesign.parasitics.capacitor_q = "100" - assert lumpdesign.parasitics.capacitor_q == "100" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_q.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_capacitor_rs(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.capacitor_rs == "0" - lumpdesign.parasitics.capacitor_rs = "1" - assert lumpdesign.parasitics.capacitor_rs == "1" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_rs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_capacitor_rp(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.capacitor_rp == "Inf" - lumpdesign.parasitics.capacitor_rp = "1000" - assert lumpdesign.parasitics.capacitor_rp == "1000" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_rp.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_capacitor_ls(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.capacitor_ls == "0" - lumpdesign.parasitics.capacitor_ls = "1n" - assert lumpdesign.parasitics.capacitor_ls == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_ls.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_inductor_q(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.inductor_q == "Inf" - lumpdesign.parasitics.inductor_q = "100" - assert lumpdesign.parasitics.inductor_q == "100" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_q.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_inductor_rs(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.inductor_rs == "0" - lumpdesign.parasitics.inductor_rs = "1" - assert lumpdesign.parasitics.inductor_rs == "1" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_rs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_inductor_rp(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.inductor_rp == "Inf" - lumpdesign.parasitics.inductor_rp = "1000" - assert lumpdesign.parasitics.inductor_rp == "1000" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_rp.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_inductor_cp(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.parasitics.inductor_cp == "0" - lumpdesign.parasitics.inductor_cp = "1n" - assert lumpdesign.parasitics.inductor_cp == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_cp.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" +class TestClass: + def test_lumped_capacitor_q(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.capacitor_q == "Inf" + lumpdesign.parasitics.capacitor_q = "100" + assert lumpdesign.parasitics.capacitor_q == "100" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("capacitor_q.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_capacitor_rs(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.capacitor_rs == "0" + lumpdesign.parasitics.capacitor_rs = "1" + assert lumpdesign.parasitics.capacitor_rs == "1" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("capacitor_rs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_capacitor_rp(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.capacitor_rp == "Inf" + lumpdesign.parasitics.capacitor_rp = "1000" + assert lumpdesign.parasitics.capacitor_rp == "1000" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("capacitor_rp.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_capacitor_ls(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.capacitor_ls == "0" + lumpdesign.parasitics.capacitor_ls = "1n" + assert lumpdesign.parasitics.capacitor_ls == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("capacitor_ls.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_inductor_q(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.inductor_q == "Inf" + lumpdesign.parasitics.inductor_q = "100" + assert lumpdesign.parasitics.inductor_q == "100" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("inductor_q.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_inductor_rs(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.inductor_rs == "0" + lumpdesign.parasitics.inductor_rs = "1" + assert lumpdesign.parasitics.inductor_rs == "1" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("inductor_rs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_inductor_rp(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.inductor_rp == "Inf" + lumpdesign.parasitics.inductor_rp = "1000" + assert lumpdesign.parasitics.inductor_rp == "1000" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("inductor_rp.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_inductor_cp(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.parasitics.inductor_cp == "0" + lumpdesign.parasitics.inductor_cp = "1n" + assert lumpdesign.parasitics.inductor_cp == "1n" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("inductor_cp.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index 2f50eea1426..ea1e79af6d2 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -10,158 +10,132 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_row_count(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - assert lumpdesign.source_impedance_table.row_count == 3 - assert lumpdesign.load_impedance_table.row_count == 3 - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_row(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - assert lumpdesign.source_impedance_table.row(0) == ("0.100G", "1.000", "0.000") - assert lumpdesign.load_impedance_table.row(0) == ("0.100G", "1.000", "0.000") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_update_row(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - with pytest.raises(RuntimeError) as info: - lumpdesign.source_impedance_table.update_row(0) - assert info.value.args[0] == "There is no input value to update" - with pytest.raises(RuntimeError) as info: - lumpdesign.load_impedance_table.update_row(0) - assert info.value.args[0] == "There is no input value to update" - lumpdesign.source_impedance_table.update_row(0, "2G", "22", "11") - assert lumpdesign.source_impedance_table.row(0) == ("2G", "22", "11") - lumpdesign.load_impedance_table.update_row(0, "2G", "22", "11") - assert lumpdesign.load_impedance_table.row(0) == ("2G", "22", "11") - lumpdesign.source_impedance_table.update_row(0, frequency="4G") - assert lumpdesign.source_impedance_table.row(0) == ("4G", "22", "11") - lumpdesign.load_impedance_table.update_row(0, frequency="4G") - assert lumpdesign.load_impedance_table.row(0) == ("4G", "22", "11") - lumpdesign.source_impedance_table.update_row(0, "2G", "50", "0") - assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") - lumpdesign.load_impedance_table.update_row(0, "2G", "50", "0") - assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_append_row(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - lumpdesign.source_impedance_table.append_row("100M", "10", "20") - assert lumpdesign.source_impedance_table.row_count == 4 - assert lumpdesign.source_impedance_table.row(3) == ("100M", "10", "20") - lumpdesign.topology.complex_termination = True - lumpdesign.load_impedance_table.append_row("100M", "10", "20") - assert lumpdesign.load_impedance_table.row_count == 4 - assert lumpdesign.load_impedance_table.row(3) == ("100M", "10", "20") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_insert_row(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - lumpdesign.source_impedance_table.insert_row(0, "2G", "50", "0") - assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") - lumpdesign.load_impedance_table.insert_row(0, "2G", "50", "0") - assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_remove_row(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - lumpdesign.source_impedance_table.remove_row(0) - assert lumpdesign.source_impedance_table.row(0) == ("1.000G", "1.000", "0.000") - with pytest.raises(RuntimeError) as info: - lumpdesign.source_impedance_table.row(2) - assert info.value.args[0] == "No value is set for this band" - lumpdesign.load_impedance_table.remove_row(0) - assert lumpdesign.load_impedance_table.row(0) == ("1.000G", "1.000", "0.000") - with pytest.raises(RuntimeError) as info: - lumpdesign.load_impedance_table.row(2) - assert info.value.args[0] == "No value is set for this band" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_complex_definition(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - assert len(ComplexTerminationDefinition) == 4 - assert lumpdesign.source_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN - for cdef in ComplexTerminationDefinition: - lumpdesign.source_impedance_table.complex_definition = cdef - assert lumpdesign.source_impedance_table.complex_definition == cdef - assert lumpdesign.load_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN - for cdef in ComplexTerminationDefinition: - lumpdesign.load_impedance_table.complex_definition = cdef - assert lumpdesign.load_impedance_table.complex_definition == cdef - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_reactance_type(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - assert len(ComplexReactanceType) == 3 - assert lumpdesign.source_impedance_table.reactance_type == ComplexReactanceType.REAC - for creac in ComplexReactanceType: - lumpdesign.source_impedance_table.reactance_type = creac - assert lumpdesign.source_impedance_table.reactance_type == creac - assert lumpdesign.load_impedance_table.reactance_type == ComplexReactanceType.REAC - for creac in ComplexReactanceType: - lumpdesign.load_impedance_table.reactance_type = creac - assert lumpdesign.load_impedance_table.reactance_type == creac - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_compensation_enabled(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - assert lumpdesign.source_impedance_table.compensation_enabled is False - lumpdesign.source_impedance_table.compensation_enabled = True - assert lumpdesign.source_impedance_table.compensation_enabled - assert lumpdesign.load_impedance_table.compensation_enabled is False - lumpdesign.load_impedance_table.compensation_enabled = True - assert lumpdesign.load_impedance_table.compensation_enabled - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_compensation_order(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - lumpdesign.source_impedance_table.compensation_enabled = True - assert lumpdesign.source_impedance_table.compensation_order == 2 - with pytest.raises(RuntimeError) as info: - lumpdesign.source_impedance_table.compensation_order = 0 - assert info.value.args[0] == "The minimum impedance compensation order is 1" - for i in range(1, 22): - lumpdesign.source_impedance_table.compensation_order = i - assert lumpdesign.source_impedance_table.compensation_order == i - with pytest.raises(RuntimeError) as info: - lumpdesign.source_impedance_table.compensation_order = 22 - assert info.value.args[0] == "The maximum impedance compensation order is 21" - lumpdesign.load_impedance_table.compensation_enabled = True - assert lumpdesign.load_impedance_table.compensation_order == 2 - with pytest.raises(RuntimeError) as info: - lumpdesign.load_impedance_table.compensation_order = 0 - assert info.value.args[0] == "The minimum impedance compensation order is 1" - for i in range(1, 22): - lumpdesign.load_impedance_table.compensation_order = i - assert lumpdesign.load_impedance_table.compensation_order == i - with pytest.raises(RuntimeError) as info: - lumpdesign.load_impedance_table.compensation_order = 22 - assert info.value.args[0] == "The maximum impedance compensation order is 21" +class TestClass: + def test_row_count(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + assert lumpdesign.source_impedance_table.row_count == 3 + assert lumpdesign.load_impedance_table.row_count == 3 + + def test_row(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + assert lumpdesign.source_impedance_table.row(0) == ("0.100G", "1.000", "0.000") + assert lumpdesign.load_impedance_table.row(0) == ("0.100G", "1.000", "0.000") + + def test_update_row(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.update_row(0) + assert info.value.args[0] == "There is no input value to update" + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.update_row(0) + assert info.value.args[0] == "There is no input value to update" + lumpdesign.source_impedance_table.update_row(0, "2G", "22", "11") + assert lumpdesign.source_impedance_table.row(0) == ("2G", "22", "11") + lumpdesign.load_impedance_table.update_row(0, "2G", "22", "11") + assert lumpdesign.load_impedance_table.row(0) == ("2G", "22", "11") + lumpdesign.source_impedance_table.update_row(0, frequency="4G") + assert lumpdesign.source_impedance_table.row(0) == ("4G", "22", "11") + lumpdesign.load_impedance_table.update_row(0, frequency="4G") + assert lumpdesign.load_impedance_table.row(0) == ("4G", "22", "11") + lumpdesign.source_impedance_table.update_row(0, "2G", "50", "0") + assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") + lumpdesign.load_impedance_table.update_row(0, "2G", "50", "0") + assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") + + def test_append_row(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.append_row("100M", "10", "20") + assert lumpdesign.source_impedance_table.row_count == 4 + assert lumpdesign.source_impedance_table.row(3) == ("100M", "10", "20") + lumpdesign.topology.complex_termination = True + lumpdesign.load_impedance_table.append_row("100M", "10", "20") + assert lumpdesign.load_impedance_table.row_count == 4 + assert lumpdesign.load_impedance_table.row(3) == ("100M", "10", "20") + + def test_insert_row(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.insert_row(0, "2G", "50", "0") + assert lumpdesign.source_impedance_table.row(0) == ("2G", "50", "0") + lumpdesign.load_impedance_table.insert_row(0, "2G", "50", "0") + assert lumpdesign.load_impedance_table.row(0) == ("2G", "50", "0") + + def test_remove_row(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.remove_row(0) + assert lumpdesign.source_impedance_table.row(0) == ("1.000G", "1.000", "0.000") + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.row(2) + assert info.value.args[0] == "No value is set for this band" + lumpdesign.load_impedance_table.remove_row(0) + assert lumpdesign.load_impedance_table.row(0) == ("1.000G", "1.000", "0.000") + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.row(2) + assert info.value.args[0] == "No value is set for this band" + + def test_complex_definition(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + assert len(ComplexTerminationDefinition) == 4 + assert lumpdesign.source_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN + for cdef in ComplexTerminationDefinition: + lumpdesign.source_impedance_table.complex_definition = cdef + assert lumpdesign.source_impedance_table.complex_definition == cdef + assert lumpdesign.load_impedance_table.complex_definition == ComplexTerminationDefinition.CARTESIAN + for cdef in ComplexTerminationDefinition: + lumpdesign.load_impedance_table.complex_definition = cdef + assert lumpdesign.load_impedance_table.complex_definition == cdef + + def test_reactance_type(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + assert len(ComplexReactanceType) == 3 + assert lumpdesign.source_impedance_table.reactance_type == ComplexReactanceType.REAC + for creac in ComplexReactanceType: + lumpdesign.source_impedance_table.reactance_type = creac + assert lumpdesign.source_impedance_table.reactance_type == creac + assert lumpdesign.load_impedance_table.reactance_type == ComplexReactanceType.REAC + for creac in ComplexReactanceType: + lumpdesign.load_impedance_table.reactance_type = creac + assert lumpdesign.load_impedance_table.reactance_type == creac + + def test_compensation_enabled(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + assert lumpdesign.source_impedance_table.compensation_enabled is False + lumpdesign.source_impedance_table.compensation_enabled = True + assert lumpdesign.source_impedance_table.compensation_enabled + assert lumpdesign.load_impedance_table.compensation_enabled is False + lumpdesign.load_impedance_table.compensation_enabled = True + assert lumpdesign.load_impedance_table.compensation_enabled + + def test_compensation_order(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + lumpdesign.source_impedance_table.compensation_enabled = True + assert lumpdesign.source_impedance_table.compensation_order == 2 + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.compensation_order = 0 + assert info.value.args[0] == "The minimum impedance compensation order is 1" + for i in range(1, 22): + lumpdesign.source_impedance_table.compensation_order = i + assert lumpdesign.source_impedance_table.compensation_order == i + with pytest.raises(RuntimeError) as info: + lumpdesign.source_impedance_table.compensation_order = 22 + assert info.value.args[0] == "The maximum impedance compensation order is 21" + lumpdesign.load_impedance_table.compensation_enabled = True + assert lumpdesign.load_impedance_table.compensation_order == 2 + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.compensation_order = 0 + assert info.value.args[0] == "The minimum impedance compensation order is 1" + for i in range(1, 22): + lumpdesign.load_impedance_table.compensation_order = i + assert lumpdesign.load_impedance_table.compensation_order == i + with pytest.raises(RuntimeError) as info: + lumpdesign.load_impedance_table.compensation_order = 22 + assert info.value.args[0] == "The maximum impedance compensation order is 21" diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 4bdd3f30fbd..6eac6673b74 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -13,496 +13,413 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_generator_resistor_30(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.topology.generator_resistor == "50" - lumpdesign.topology.generator_resistor = "30" - assert lumpdesign.topology.generator_resistor == "30" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("generator_resistor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_load_resistor_30(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.topology.load_resistor == "50" - lumpdesign.topology.load_resistor = "30" - assert lumpdesign.topology.load_resistor == "30" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("laod_resistor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_current_source(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.topology.current_source is False - lumpdesign.topology.current_source = True - assert lumpdesign.topology.current_source - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("current_source.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_first_shunt(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.topology.first_shunt - lumpdesign.topology.first_shunt = True - assert lumpdesign.topology.first_shunt - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("first_shunt.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_first_series(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.topology.first_shunt - lumpdesign.topology.first_shunt = False - assert lumpdesign.topology.first_shunt is False - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("first_series.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_bridge_t(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.bridge_t is False - lumpdesign.topology.bridge_t = True - assert lumpdesign.topology.bridge_t - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("bridge_t.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_bridge_t_low(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 - lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO - assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.bridge_t_low is False - lumpdesign.topology.bridge_t_low = True - assert lumpdesign.topology.bridge_t_low - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("bridge_t_low.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_bridge_t_high(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 - lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO - assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.bridge_t_high is False - lumpdesign.topology.bridge_t_high = True - assert lumpdesign.topology.bridge_t_high - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("bridge_t_high.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_equal_inductors(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.topology.equal_inductors is False - lumpdesign.topology.equal_inductors = True - assert lumpdesign.topology.equal_inductors - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("equal_inductors.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_equal_capacitors(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - lumpdesign.topology.zig_zag = True - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.zig_zag - assert lumpdesign.topology.min_cap is False - assert lumpdesign.topology.equal_capacitors is False - lumpdesign.topology.min_cap = True - lumpdesign.topology.equal_capacitors = True - assert lumpdesign.topology.min_cap - assert lumpdesign.topology.equal_capacitors - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("equal_capacitors.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_equal_legs(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.topology.equal_legs is False - lumpdesign.topology.equal_legs = True - assert lumpdesign.topology.equal_legs - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("equal_legs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_high_low_pass(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.topology.high_low_pass is False - lumpdesign.topology.high_low_pass = True - assert lumpdesign.topology.high_low_pass - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("high_low_pass.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_high_low_pass_min_ind(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.high_low_pass_min_ind is False - lumpdesign.topology.high_low_pass_min_ind = True - assert lumpdesign.topology.high_low_pass_min_ind - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("high_low_pass_min_ind.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_zig_zag(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.zig_zag is False - lumpdesign.topology.zig_zag = True - assert lumpdesign.topology.zig_zag - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("zig_zag.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_min_ind(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - lumpdesign.topology.zig_zag = True - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.zig_zag - assert lumpdesign.topology.min_ind - lumpdesign.topology.min_ind = True - assert lumpdesign.topology.min_ind - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("min_ind.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_min_cap(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - lumpdesign.topology.zig_zag = True - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.zig_zag - assert lumpdesign.topology.min_cap is False - lumpdesign.topology.min_cap = True - assert lumpdesign.topology.min_cap - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("min_cap.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_set_source_res(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - lumpdesign.topology.zig_zag = True - lumpdesign.topology.set_source_res = False - assert lumpdesign.topology.set_source_res is False - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.zig_zag - lumpdesign.topology.set_source_res = True - assert lumpdesign.topology.set_source_res - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("set_source_res.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_trap_topology(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - lumpdesign.topology.zig_zag = True - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.zig_zag - assert lumpdesign.topology.trap_topology is False - lumpdesign.topology.trap_topology = True - assert lumpdesign.topology.trap_topology - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("trap_topology.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_node_cap_ground(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.attributes.filter_type = FilterType.ELLIPTIC - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC - assert lumpdesign.topology.node_cap_ground is False - lumpdesign.topology.node_cap_ground = True - assert lumpdesign.topology.node_cap_ground - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("node_cap_ground.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_match_impedance(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.BAND_PASS - lumpdesign.topology.generator_resistor = "75" - assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS - assert lumpdesign.topology.generator_resistor == "75" - assert lumpdesign.topology.match_impedance is False - lumpdesign.topology.match_impedance = True - assert lumpdesign.topology.match_impedance - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("match_impedance.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_complex_termination(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert lumpdesign.topology.complex_termination is False - lumpdesign.topology.complex_termination = True - assert lumpdesign.topology.complex_termination - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_complex_element_tune_enabled(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.topology.complex_termination = True - assert lumpdesign.topology.complex_element_tune_enabled - lumpdesign.topology.complex_element_tune_enabled = False - assert lumpdesign.topology.complex_element_tune_enabled is False - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_circuit_export(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("netlist.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_diplexer1_hi_lo(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 - lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 - assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer1_hi_lo.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_diplexer1_bp_1(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 - lumpdesign.attributes.diplexer_type = DiplexerType.BP_1 - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 - assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_1 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer1_bp_1.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_diplexer1_bp_2(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 - lumpdesign.attributes.diplexer_type = DiplexerType.BP_2 - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 - assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_2 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer1_bp_2.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_diplexer2_bp_bs(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 - lumpdesign.attributes.diplexer_type = DiplexerType.BP_BS - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 - assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_BS - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer2_bp_bs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_diplexer2_triplexer_1(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 - lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_1 - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 - assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_1 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer2_triplexer_1.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" - - -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_lumped_diplexer2_triplexer_2(): - lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 - lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_2 - assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 - assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_2 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer2_triplexer_2.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" +class TestClass: + def test_lumped_generator_resistor_30(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.topology.generator_resistor == "50" + lumpdesign.topology.generator_resistor = "30" + assert lumpdesign.topology.generator_resistor == "30" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("generator_resistor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_load_resistor_30(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.topology.load_resistor == "50" + lumpdesign.topology.load_resistor = "30" + assert lumpdesign.topology.load_resistor == "30" + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("laod_resistor.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_current_source(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.topology.current_source is False + lumpdesign.topology.current_source = True + assert lumpdesign.topology.current_source + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("current_source.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_first_shunt(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.topology.first_shunt + lumpdesign.topology.first_shunt = True + assert lumpdesign.topology.first_shunt + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("first_shunt.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_first_series(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.topology.first_shunt + lumpdesign.topology.first_shunt = False + assert lumpdesign.topology.first_shunt is False + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("first_series.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_bridge_t(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.bridge_t is False + lumpdesign.topology.bridge_t = True + assert lumpdesign.topology.bridge_t + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("bridge_t.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_bridge_t_low(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.bridge_t_low is False + lumpdesign.topology.bridge_t_low = True + assert lumpdesign.topology.bridge_t_low + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("bridge_t_low.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_bridge_t_high(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.bridge_t_high is False + lumpdesign.topology.bridge_t_high = True + assert lumpdesign.topology.bridge_t_high + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("bridge_t_high.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_equal_inductors(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.equal_inductors is False + lumpdesign.topology.equal_inductors = True + assert lumpdesign.topology.equal_inductors + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("equal_inductors.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_equal_capacitors(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.min_cap is False + assert lumpdesign.topology.equal_capacitors is False + lumpdesign.topology.min_cap = True + lumpdesign.topology.equal_capacitors = True + assert lumpdesign.topology.min_cap + assert lumpdesign.topology.equal_capacitors + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("equal_capacitors.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_equal_legs(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.equal_legs is False + lumpdesign.topology.equal_legs = True + assert lumpdesign.topology.equal_legs + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("equal_legs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_high_low_pass(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.high_low_pass is False + lumpdesign.topology.high_low_pass = True + assert lumpdesign.topology.high_low_pass + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("high_low_pass.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_high_low_pass_min_ind(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.high_low_pass_min_ind is False + lumpdesign.topology.high_low_pass_min_ind = True + assert lumpdesign.topology.high_low_pass_min_ind + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("high_low_pass_min_ind.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_zig_zag(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag is False + lumpdesign.topology.zig_zag = True + assert lumpdesign.topology.zig_zag + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("zig_zag.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_min_ind(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.min_ind + lumpdesign.topology.min_ind = True + assert lumpdesign.topology.min_ind + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("min_ind.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_min_cap(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.min_cap is False + lumpdesign.topology.min_cap = True + assert lumpdesign.topology.min_cap + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("min_cap.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_set_source_res(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + lumpdesign.topology.set_source_res = False + assert lumpdesign.topology.set_source_res is False + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + lumpdesign.topology.set_source_res = True + assert lumpdesign.topology.set_source_res + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("set_source_res.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_trap_topology(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + lumpdesign.topology.zig_zag = True + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.zig_zag + assert lumpdesign.topology.trap_topology is False + lumpdesign.topology.trap_topology = True + assert lumpdesign.topology.trap_topology + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("trap_topology.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_node_cap_ground(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.attributes.filter_type = FilterType.ELLIPTIC + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.attributes.filter_type == FilterType.ELLIPTIC + assert lumpdesign.topology.node_cap_ground is False + lumpdesign.topology.node_cap_ground = True + assert lumpdesign.topology.node_cap_ground + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("node_cap_ground.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_match_impedance(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.BAND_PASS + lumpdesign.topology.generator_resistor = "75" + assert lumpdesign.attributes.filter_class == FilterClass.BAND_PASS + assert lumpdesign.topology.generator_resistor == "75" + assert lumpdesign.topology.match_impedance is False + lumpdesign.topology.match_impedance = True + assert lumpdesign.topology.match_impedance + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("match_impedance.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_complex_termination(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert lumpdesign.topology.complex_termination is False + lumpdesign.topology.complex_termination = True + assert lumpdesign.topology.complex_termination + + def test_complex_element_tune_enabled(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.topology.complex_termination = True + assert lumpdesign.topology.complex_element_tune_enabled + lumpdesign.topology.complex_element_tune_enabled = False + assert lumpdesign.topology.complex_element_tune_enabled is False + + def test_lumped_circuit_export(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("netlist.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_diplexer1_hi_lo(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer1_hi_lo.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_diplexer1_bp_1(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.BP_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_1 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer1_bp_1.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_diplexer1_bp_2(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_1 + lumpdesign.attributes.diplexer_type = DiplexerType.BP_2 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 + assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_2 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer1_bp_2.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_diplexer2_bp_bs(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.attributes.diplexer_type = DiplexerType.BP_BS + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_BS + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer2_bp_bs.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_diplexer2_triplexer_1(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_1 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_1 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer2_triplexer_1.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" + + def test_lumped_diplexer2_triplexer_2(self): + lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + lumpdesign.attributes.filter_class = FilterClass.DIPLEXER_2 + lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_2 + assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 + assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_2 + netlist = lumpdesign.topology.circuit_response() + netlist_file = open(resource_path("diplexer2_triplexer_2.ckt")) + lines_netlist = netlist.splitlines() + lines_netlist_file = netlist_file.readlines() + for i in range(len(lines_netlist_file)): + assert lines_netlist_file[i] == lines_netlist[i] + "\n" diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index 27f6a0357bf..f6067312c1b 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -8,8 +8,9 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") -def test_raise_error(): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - with pytest.raises(RuntimeError) as info: - design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" +class TestClass: + def test_raise_error(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + with pytest.raises(RuntimeError) as info: + design.transmission_zeros_ratio.row(0) + assert info.value.args[0] == "This filter has no transmission zero at row 0" From c32e25c879b5a021d1f451040ec07737e126a5dc Mon Sep 17 00:00:00 2001 From: raghajaf Date: Tue, 11 Jun 2024 16:31:20 -0400 Subject: [PATCH 13/26] feat/draft_filtersolutions: resource file name changed --- .../{resource.py => filtersolutions_resource.py} | 0 .../test_filter/test_ideal_response.py | 7 +------ .../{resource.py => filtersolutions_resource.py} | 0 .../test_lumped_filter/test_lumped_nodes_and_leads.py | 3 +-- .../test_lumped_filter/test_lumped_parasitics.py | 3 +-- .../test_lumped_filter/test_lumped_topology.py | 3 +-- 6 files changed, 4 insertions(+), 12 deletions(-) rename _unittest/test_45_FilterSolutions/test_filter/{resource.py => filtersolutions_resource.py} (100%) rename _unittest/test_45_FilterSolutions/test_lumped_filter/{resource.py => filtersolutions_resource.py} (100%) diff --git a/_unittest/test_45_FilterSolutions/test_filter/resource.py b/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py similarity index 100% rename from _unittest/test_45_FilterSolutions/test_filter/resource.py rename to _unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index 19a6820649b..00409c7b69f 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -1,6 +1,5 @@ -from resource import resource_path - from _unittest_solvers.conftest import config +from filtersolutions_resource import resource_path import pytest import pyaedt @@ -69,10 +68,6 @@ def test_frequency_response_getter(self): assert freqs[300] == 8669097136.772985 assert freqs[-1] == 31214328219.225075 - @pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") - @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") - class TestClass: - def test_time_response_getter(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/resource.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py similarity index 100% rename from _unittest/test_45_FilterSolutions/test_lumped_filter/resource.py rename to _unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index 87f52599b25..cb157820b9b 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -1,6 +1,5 @@ -from resource import resource_path - from _unittest_solvers.conftest import config +from filtersolutions_resource import resource_path import pytest import pyaedt diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 4fe7599ae6e..7a96c7c59f0 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -1,6 +1,5 @@ -from resource import resource_path - from _unittest_solvers.conftest import config +from filtersolutions_resource import resource_path import pytest import pyaedt diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 6eac6673b74..4c1a3113fd5 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -1,6 +1,5 @@ -from resource import resource_path - from _unittest_solvers.conftest import config +from filtersolutions_resource import resource_path import pytest import pyaedt From d1ab44137481fbeb479a78c9492c7b51bd2e3397 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 19 Jun 2024 15:27:44 +0000 Subject: [PATCH 14/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../test_filter/filtersolutions_resource.py | 24 +++++++++++++++++++ .../test_filter/test_attributes.py | 24 +++++++++++++++++++ .../test_filter/test_dll_interface.py | 24 +++++++++++++++++++ .../test_filter/test_graph_setup.py | 24 +++++++++++++++++++ .../test_filter/test_ideal_response.py | 24 +++++++++++++++++++ .../test_filter/test_multiple_bands_table.py | 24 +++++++++++++++++++ .../test_filter/test_transmission_zeros.py | 24 +++++++++++++++++++ .../filtersolutions_resource.py | 24 +++++++++++++++++++ .../test_lumped_nodes_and_leads.py | 24 +++++++++++++++++++ .../test_lumped_parasitics.py | 24 +++++++++++++++++++ .../test_lumped_termination_impedance.py | 24 +++++++++++++++++++ .../test_lumped_topology.py | 24 +++++++++++++++++++ .../test_raise_error.py | 24 +++++++++++++++++++ pyaedt/filtersolutions.py | 24 +++++++++++++++++++ pyaedt/filtersolutions_core/__init__.py | 24 +++++++++++++++++++ pyaedt/filtersolutions_core/attributes.py | 24 +++++++++++++++++++ pyaedt/filtersolutions_core/dll_interface.py | 24 +++++++++++++++++++ pyaedt/filtersolutions_core/graph_setup.py | 24 +++++++++++++++++++ pyaedt/filtersolutions_core/ideal_response.py | 24 +++++++++++++++++++ .../lumped_nodes_and_leads.py | 24 +++++++++++++++++++ .../filtersolutions_core/lumped_parasitics.py | 24 +++++++++++++++++++ .../lumped_termination_impedance.py | 24 +++++++++++++++++++ .../filtersolutions_core/lumped_topology.py | 24 +++++++++++++++++++ .../multiple_bands_table.py | 24 +++++++++++++++++++ .../transmission_zeros.py | 24 +++++++++++++++++++ 25 files changed, 600 insertions(+) diff --git a/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py b/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py index f5db364f802..e551e4afa7a 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py +++ b/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 4427bac9b9e..32cd7707d46 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index 1a9d0a93c15..7b28d4e7cb0 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index af952a0900d..52e921e9a3d 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index 00409c7b69f..a558ebac04a 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config from filtersolutions_resource import resource_path import pytest diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index 4f39e9feb6d..78450d3e996 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index 96481fda03c..0aaaf5b4f6d 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py index f5db364f802..e551e4afa7a 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import os diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index cb157820b9b..1fbe146ba21 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config from filtersolutions_resource import resource_path import pytest diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 7a96c7c59f0..730b14ea9c4 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config from filtersolutions_resource import resource_path import pytest diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index ea1e79af6d2..f53f7cd249a 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 4c1a3113fd5..442ddedf2c9 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config from filtersolutions_resource import resource_path import pytest diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index f6067312c1b..f6dd7d108df 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from _unittest_solvers.conftest import config import pytest diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index 215089adfc2..14c83f13678 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from pyaedt.filtersolutions_core.attributes import Attributes from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.filtersolutions_core.graph_setup import GraphSetup diff --git a/pyaedt/filtersolutions_core/__init__.py b/pyaedt/filtersolutions_core/__init__.py index 309279c5b14..e47fca5707a 100644 --- a/pyaedt/filtersolutions_core/__init__.py +++ b/pyaedt/filtersolutions_core/__init__.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import sys from pyaedt.filtersolutions_core.dll_interface import DllInterface diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 886b45bd19d..097cb979e80 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_bool diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index 1d558c3b990..42204832fe0 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + import ctypes from enum import Enum import os diff --git a/pyaedt/filtersolutions_core/graph_setup.py b/pyaedt/filtersolutions_core/graph_setup.py index 429d9a8daeb..f9c886522c4 100644 --- a/pyaedt/filtersolutions_core/graph_setup.py +++ b/pyaedt/filtersolutions_core/graph_setup.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import c_char_p from ctypes import c_int diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py index 03fd61c7f4d..7bda88fc1ca 100644 --- a/pyaedt/filtersolutions_core/ideal_response.py +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_bool diff --git a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py index 0a7968c2262..5c6adbeaebd 100644 --- a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py +++ b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_bool diff --git a/pyaedt/filtersolutions_core/lumped_parasitics.py b/pyaedt/filtersolutions_core/lumped_parasitics.py index dbbc30c9cfe..d62bb007b09 100644 --- a/pyaedt/filtersolutions_core/lumped_parasitics.py +++ b/pyaedt/filtersolutions_core/lumped_parasitics.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import c_char_p from ctypes import c_int diff --git a/pyaedt/filtersolutions_core/lumped_termination_impedance.py b/pyaedt/filtersolutions_core/lumped_termination_impedance.py index c0fb9403fdb..de769a8f716 100644 --- a/pyaedt/filtersolutions_core/lumped_termination_impedance.py +++ b/pyaedt/filtersolutions_core/lumped_termination_impedance.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_bool diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index 25bb868af50..00939ee97f5 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_bool diff --git a/pyaedt/filtersolutions_core/multiple_bands_table.py b/pyaedt/filtersolutions_core/multiple_bands_table.py index 791cac4c950..3f0c99df07b 100644 --- a/pyaedt/filtersolutions_core/multiple_bands_table.py +++ b/pyaedt/filtersolutions_core/multiple_bands_table.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_char_p diff --git a/pyaedt/filtersolutions_core/transmission_zeros.py b/pyaedt/filtersolutions_core/transmission_zeros.py index 61e0e1c24fa..04516a5682b 100644 --- a/pyaedt/filtersolutions_core/transmission_zeros.py +++ b/pyaedt/filtersolutions_core/transmission_zeros.py @@ -1,3 +1,27 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + from ctypes import POINTER from ctypes import byref from ctypes import c_bool From e8f80a7f8eba3089c9238dbc892da5875416cedb Mon Sep 17 00:00:00 2001 From: raghajaf Date: Thu, 20 Jun 2024 07:55:13 -0400 Subject: [PATCH 15/26] feat/draft_filtersolutions: diplexer parameters and version added. --- .../test_filter/test_attributes.py | 78 +++++++ .../Lumped_Element_Response.py | 3 +- .../filltersolutionsexample.py | 42 ---- pyaedt/filtersolutions.py | 18 +- pyaedt/filtersolutions_core/attributes.py | 206 ++++++++++++++++++ pyaedt/filtersolutions_core/dll_interface.py | 8 +- pyaedt/generic/design_types.py | 12 + 7 files changed, 319 insertions(+), 48 deletions(-) delete mode 100644 examples/08-Filtersolutions/filltersolutionsexample.py diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 32cd7707d46..1879e0007b7 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -109,6 +109,84 @@ def test_diplexer_type(self): design.attributes.diplexer_type = diplexer_type assert design.attributes.diplexer_type == diplexer_type + def test_diplexer_center_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + assert design.attributes.diplexer_center_frequency == "1G" + design.attributes.diplexer_center_frequency = "500M" + assert design.attributes.diplexer_center_frequency == "500M" + + def test_diplexer_pass_band_width_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + assert design.attributes.diplexer_pass_band_width_frequency == "200M" + design.attributes.diplexer_pass_band_width_frequency = "500M" + assert design.attributes.diplexer_pass_band_width_frequency == "500M" + + def test_diplexer_lower_corner_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.diplexer_lower_corner_frequency == "905 M" + design.attributes.diplexer_lower_corner_frequency = "800 M" + assert design.attributes.diplexer_lower_corner_frequency == "800 M" + + def test_diplexer_upper_corner_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES + assert design.attributes.diplexer_upper_corner_frequency == "1.105 G" + design.attributes.diplexer_upper_corner_frequency = "1.2 G" + assert design.attributes.diplexer_upper_corner_frequency == "1.2 G" + + def test_diplexer_inner_band_width_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.diplexer_type = DiplexerType.BP_1 + assert design.attributes.diplexer_inner_band_width_frequency == "200M" + design.attributes.diplexer_inner_band_width_frequency = "300M" + assert design.attributes.diplexer_inner_band_width_frequency == "300M" + + def test_diplexer_outer_band_width_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.diplexer_type = DiplexerType.BP_1 + assert design.attributes.diplexer_outer_band_width_frequency == "2G" + design.attributes.diplexer_outer_band_width_frequency = "3G" + assert design.attributes.diplexer_outer_band_width_frequency == "3G" + + def test_diplexer_lower_side_center_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.diplexer_type = DiplexerType.BP_2 + assert design.attributes.diplexer_lower_side_center_frequency == "500M" + design.attributes.diplexer_lower_side_center_frequency = "300M" + assert design.attributes.diplexer_lower_side_center_frequency == "300M" + + def test_diplexer_higher_side_center_frequency(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.diplexer_type = DiplexerType.BP_2 + assert design.attributes.diplexer_higher_side_center_frequency == "2G" + design.attributes.diplexer_higher_side_center_frequency = "3G" + assert design.attributes.diplexer_higher_side_center_frequency == "3G" + + def test_diplexer_lower_side_band_width(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.diplexer_type = DiplexerType.BP_2 + assert design.attributes.diplexer_lower_side_band_width == "500M" + design.attributes.diplexer_lower_side_band_width = "300M" + assert design.attributes.diplexer_lower_side_band_width == "300M" + + def test_diplexer_higher_side_band_width(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.DIPLEXER_1 + design.attributes.diplexer_type = DiplexerType.BP_2 + assert design.attributes.diplexer_higher_side_band_width == "2G" + design.attributes.diplexer_higher_side_band_width = "3G" + assert design.attributes.diplexer_higher_side_band_width == "3G" + def test_order(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py index 4d47dc026a5..1c987acf14a 100644 --- a/examples/08-FilterSolutions/Lumped_Element_Response.py +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -20,8 +20,7 @@ # Create the Lumped Design # ~~~~~~~~~~~~~~~~~~~~~~~~ # Create a lumped element filter design and assign the class, type, frequency, and order. - -design = pyaedt.FilterSolutions(implementation_type= FilterImplementation.LUMPED) +design = pyaedt.FilterSolutions(version="2024.2", implementation_type= FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.filter_type = FilterType.BUTTERWORTH design.attributes.pass_band_center_frequency = "1G" diff --git a/examples/08-Filtersolutions/filltersolutionsexample.py b/examples/08-Filtersolutions/filltersolutionsexample.py deleted file mode 100644 index f70be71d621..00000000000 --- a/examples/08-Filtersolutions/filltersolutionsexample.py +++ /dev/null @@ -1,42 +0,0 @@ -# # Design a Lumped Element Filter -# This Python script demonstrates the use of the `fspy` library to design and -# visualize the frequency response of a band-pass Butterworth filter. - -import pyaedt -from pyaedt.filtersolutions_core.attributes import FilterType, FilterClass, FilterImplementation -from pyaedt.filtersolutions_core.ideal_response import FrequencyResponseColumn -import matplotlib.pyplot as plt - -# Create the LumpedDesign and assign the class, type, frequency, and order. -if __name__ == "__main__": - design = pyaedt.FilterSolutions(projectname= "fs1", implementation_type= FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.BAND_PASS - design.attributes.filter_type = FilterType.BUTTERWORTH - design.attributes.pass_band_center_frequency = "1G" - design.attributes.pass_band_width_frequency = "500M" - design.attributes.filter_order = 5 - - # Plot the frequency response of the filter. - freq, mag_db = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) - plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero") - def format_plot(): - plt.xlabel("Frequency (Hz)") - plt.ylabel("Magnitude S21 (dB)") - plt.title("Ideal Frequency Response") - plt.xscale("log") - plt.legend() - plt.grid() - format_plot() - plt.show() - - # Add a transmission zeros that yields nulls separated by 2 times the pass band width (1 GHz). - design.transmission_zeros_ratio.append_row("2.0") - freq_with_zero, mag_db_with_zero = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) - plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero") - plt.plot(freq_with_zero, mag_db_with_zero, linewidth=2.0, label="With Tx Zero") - format_plot() - plt.show() - - # Generate the netlist for the filter design. - netlist = design.topology.circuit_response() - print("Netlist: \n", netlist) diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index 14c83f13678..b7b92139925 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -34,6 +34,8 @@ from pyaedt.filtersolutions_core.multiple_bands_table import MultipleBandsTable from pyaedt.filtersolutions_core.transmission_zeros import TableFormat from pyaedt.filtersolutions_core.transmission_zeros import TransmissionZeros +from pyaedt.misc.misc import current_version +from pyaedt.misc.misc import installed_versions class FilterSolutions: @@ -61,8 +63,11 @@ class FilterSolutions: >>> ) """ - def __init__(self, implementation_type=FilterImplementation.LUMPED): + def __init__(self, version=None, implementation_type=FilterImplementation.LUMPED): + version = version implementation_type = implementation_type + self.version_check(version) + if implementation_type == FilterImplementation.LUMPED: self._init_lumped_design() else: @@ -82,3 +87,14 @@ def _init_lumped_design(self): self.multiple_bands_table = MultipleBandsTable() self.transmission_zeros_ratio = TransmissionZeros(TableFormat.RATIO) self.transmission_zeros_frequency = TransmissionZeros(TableFormat.FREQUENCY) + + def version_check(self, version): + self_current_version = current_version() + if current_version == "": + raise Exception("AEDT is not installed on your system. Install AEDT version 2025 R1 or higher.") + if version is None: + version = self_current_version + if float(version[0:6]) < 2024: + raise ValueError("PyAEDT supports AEDT version 2025 R1 and later. Recommended version is 2025 R1 or later.") + if not (version in installed_versions()) and not (version + "CL" in installed_versions()): + raise ValueError("Specified version {} is not installed on your system".format(version[0:6])) diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 097cb979e80..80a8fd1c5b4 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -346,6 +346,36 @@ def _define_attributes_dll_functions(self): self._dll.getUpperFrequency.argtypes = [c_char_p, c_int] self._dll.getUpperFrequency.restype = c_int + self._dll.setDiplexerInnerPassbandFrequency.argtype = c_char_p + self._dll.setDiplexerInnerPassbandFrequency.restype = c_int + self._dll.getDiplexerInnerPassbandFrequency.argtypes = [c_char_p, c_int] + self._dll.getDiplexerInnerPassbandFrequency.restype = c_int + + self._dll.setDiplexerOuterPassbandFrequency.argtype = c_char_p + self._dll.setDiplexerOuterPassbandFrequency.restype = c_int + self._dll.getDiplexerOuterPassbandFrequency.argtypes = [c_char_p, c_int] + self._dll.getDiplexerOuterPassbandFrequency.restype = c_int + + self._dll.setDiplexerLowerCenterFrequency.argtype = c_char_p + self._dll.setDiplexerLowerCenterFrequency.restype = c_int + self._dll.getDiplexerLowerCenterFrequency.argtypes = [c_char_p, c_int] + self._dll.getDiplexerLowerCenterFrequency.restype = c_int + + self._dll.setDiplexerHigherCenterFrequency.argtype = c_char_p + self._dll.setDiplexerHigherCenterFrequency.restype = c_int + self._dll.getDiplexerHigherCenterFrequency.argtypes = [c_char_p, c_int] + self._dll.getDiplexerHigherCenterFrequency.restype = c_int + + self._dll.setDiplexerLowerBandwidth.argtype = c_char_p + self._dll.setDiplexerLowerBandwidth.restype = c_int + self._dll.getDiplexerLowerBandwidth.argtypes = [c_char_p, c_int] + self._dll.getDiplexerLowerBandwidth.restype = c_int + + self._dll.setDiplexerHigherBandwidth.argtype = c_char_p + self._dll.setDiplexerHigherBandwidth.restype = c_int + self._dll.getDiplexerHigherBandwidth.argtypes = [c_char_p, c_int] + self._dll.getDiplexerHigherBandwidth.restype = c_int + self._dll.setStopbandDef.argtype = c_int self._dll.setStopbandDef.restype = c_int self._dll.getStopbandDef.argtype = POINTER(c_int) @@ -599,6 +629,182 @@ def diplexer_type(self, diplexer_type: DiplexerType): string_value = self._dll_interface.enum_to_string(diplexer_type) self._dll_interface.set_string(self._dll.setDiplexerType, string_value) + @property + def diplexer_center_frequency(self) -> str: + """Diplexer center frequency. + The default is ``1 GHz``. + + Returns + ------- + str + """ + diplexer_center_frequency_string = self._dll_interface.get_string(self._dll.getCenterFrequency) + return diplexer_center_frequency_string + + @diplexer_center_frequency.setter + def diplexer_center_frequency(self, diplexer_center_frequency_string): + self._dll_interface.set_string(self._dll.setCenterFrequency, diplexer_center_frequency_string) + + @property + def diplexer_pass_band_width_frequency(self) -> str: + """Pass band width frequency for diplexer filters. + The default is ``200 MHz``. + + Returns + ------- + str + """ + diplexer_pass_band_width_frequency_string = self._dll_interface.get_string(self._dll.getPassbandFrequency) + return diplexer_pass_band_width_frequency_string + + @diplexer_pass_band_width_frequency.setter + def diplexer_pass_band_width_frequency(self, diplexer_pass_band_width_frequency_string): + self._dll_interface.set_string(self._dll.setPassbandFrequency, diplexer_pass_band_width_frequency_string) + + @property + def diplexer_lower_corner_frequency(self) -> str: + """Diplexer lower corner frequency. + The default is ``905 MHz``. + + Returns + ------- + str + """ + diplexer_lower_corner_frequency_string = self._dll_interface.get_string(self._dll.getLowerFrequency) + return diplexer_lower_corner_frequency_string + + @diplexer_lower_corner_frequency.setter + def diplexer_lower_corner_frequency(self, diplexer_lower_corner_frequency_string): + self._dll_interface.set_string(self._dll.setLowerFrequency, diplexer_lower_corner_frequency_string) + + @property + def diplexer_upper_corner_frequency(self) -> str: + """Deiplexer upper corner frequency. + The default is ``1.105 MHz``. + + Returns + ------- + str + """ + diplexer_upper_corner_frequency_string = self._dll_interface.get_string(self._dll.getUpperFrequency) + return diplexer_upper_corner_frequency_string + + @diplexer_upper_corner_frequency.setter + def diplexer_upper_corner_frequency(self, diplexer_upper_corner_frequency_string): + self._dll_interface.set_string(self._dll.setUpperFrequency, diplexer_upper_corner_frequency_string) + + @property + def diplexer_inner_band_width_frequency(self) -> str: + """Inner band width frequency for diplexer filters. + The default is ``200 MHz``. + + Returns + ------- + str + """ + diplexer_inner_band_width_frequency_string = self._dll_interface.get_string( + self._dll.getDiplexerInnerPassbandFrequency + ) + return diplexer_inner_band_width_frequency_string + + @diplexer_inner_band_width_frequency.setter + def diplexer_inner_band_width_frequency(self, diplexer_inner_band_width_frequency_string): + self._dll_interface.set_string( + self._dll.setDiplexerInnerPassbandFrequency, diplexer_inner_band_width_frequency_string + ) + + @property + def diplexer_outer_band_width_frequency(self) -> str: + """Outer band width frequency for diplexer filters. + The default is ``2 GHz``. + + Returns + ------- + str + """ + diplexer_outer_band_width_frequency_string = self._dll_interface.get_string( + self._dll.getDiplexerOuterPassbandFrequency + ) + return diplexer_outer_band_width_frequency_string + + @diplexer_outer_band_width_frequency.setter + def diplexer_outer_band_width_frequency(self, diplexer_outer_band_width_frequency_string): + self._dll_interface.set_string( + self._dll.setDiplexerOuterPassbandFrequency, diplexer_outer_band_width_frequency_string + ) + + @property + def diplexer_lower_side_center_frequency(self) -> str: + """Lower side center frequency of diplexer filters. + The default is ``500 MHz``. + + Returns + ------- + str + """ + diplexer_lower_side_center_frequency_string = self._dll_interface.get_string( + self._dll.getDiplexerLowerCenterFrequency + ) + return diplexer_lower_side_center_frequency_string + + @diplexer_lower_side_center_frequency.setter + def diplexer_lower_side_center_frequency(self, diplexer_lower_side_center_frequency_string): + self._dll_interface.set_string( + self._dll.setDiplexerLowerCenterFrequency, diplexer_lower_side_center_frequency_string + ) + + @property + def diplexer_higher_side_center_frequency(self) -> str: + """Higher side center frequency of diplexer filters. + The default is ``2 GHz``. + + Returns + ------- + str + """ + diplexer_higher_side_center_frequency_string = self._dll_interface.get_string( + self._dll.getDiplexerHigherCenterFrequency + ) + return diplexer_higher_side_center_frequency_string + + @diplexer_higher_side_center_frequency.setter + def diplexer_higher_side_center_frequency(self, diplexer_higher_side_center_frequency_string): + self._dll_interface.set_string( + self._dll.setDiplexerHigherCenterFrequency, diplexer_higher_side_center_frequency_string + ) + + @property + def diplexer_lower_side_band_width(self) -> str: + """Lower side bandwidth of diplexer filters. + The default is ``500 MHz``. + + Returns + ------- + str + """ + diplexer_lower_side_band_width_string = self._dll_interface.get_string(self._dll.getDiplexerLowerBandwidth) + return diplexer_lower_side_band_width_string + + @diplexer_lower_side_band_width.setter + def diplexer_lower_side_band_width(self, diplexer_lower_side_band_width_string): + self._dll_interface.set_string(self._dll.setDiplexerLowerBandwidth, diplexer_lower_side_band_width_string) + + @property + def diplexer_higher_side_band_width(self) -> str: + """Higher side bandwidth of diplexer filters. + The default is ``2 GHz``. + + Returns + ------- + str + """ + diplexer_higher_side_band_width_string = self._dll_interface.get_string(self._dll.getDiplexerHigherBandwidth) + return diplexer_higher_side_band_width_string + + @diplexer_higher_side_band_width.setter + def diplexer_higher_side_band_width(self, diplexer_higher_side_band_width_string): + self._dll_interface.set_string(self._dll.setDiplexerHigherBandwidth, diplexer_higher_side_band_width_string) + @property def filter_multiple_bands_enabled(self) -> bool: """Flag indicating if the multiple bands table is enabled. diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index 42204832fe0..a101189669e 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -29,6 +29,9 @@ import time from typing import Callable +from pyaedt.misc.misc import current_version +from pyaedt.misc.misc import installed_versions + class DllInterface: """Interfaces with the FilterSolutions C++ API DLL.""" @@ -47,9 +50,8 @@ def _init_dll_path(self): relative_path = "../../../build_output/64Release/nuhertz/FilterSolutionsAPI.dll" self.dll_path = os.path.join(os.path.dirname(__file__), relative_path) if not os.path.isfile(self.dll_path): - self.dll_path = os.path.join( - os.environ["ANSYSEM_ROOT242"], "nuhertz/FilterSolutionsAPI.dll" - ) # pragma: no cover + self.dll_path = os.path.join(installed_versions()[current_version()], "nuhertz/FilterSolutionsAPI.dll") + # pragma: no cover print("DLL Path:", self.dll_path) if not os.path.isfile(self.dll_path): raise RuntimeError(f"The 'FilterSolution' API DLL was not found at {self.dll_path}.") # pragma: no cover diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index e54feb076b8..dac7a2e0646 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -49,6 +49,18 @@ Simplorer = TwinBuilder +def FilterSolutions( + version=None, + implementation_type=None, +): + from pyaedt.filtersolutions import FilterSolutions as app + + return app( + version=version, + implementation_type=implementation_type, + ) + + def launch_desktop( version=None, non_graphical=False, From 3648fe5e12252bb33b428b2519927edd3beb5447 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Fri, 21 Jun 2024 14:05:37 -0400 Subject: [PATCH 16/26] feat/draft_filtersolutions: added diplexer parameters are reverted --- .../test_filter/test_attributes.py | 78 ------- pyaedt/filtersolutions_core/attributes.py | 206 ------------------ 2 files changed, 284 deletions(-) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 1879e0007b7..32cd7707d46 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -109,84 +109,6 @@ def test_diplexer_type(self): design.attributes.diplexer_type = diplexer_type assert design.attributes.diplexer_type == diplexer_type - def test_diplexer_center_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - assert design.attributes.diplexer_center_frequency == "1G" - design.attributes.diplexer_center_frequency = "500M" - assert design.attributes.diplexer_center_frequency == "500M" - - def test_diplexer_pass_band_width_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - assert design.attributes.diplexer_pass_band_width_frequency == "200M" - design.attributes.diplexer_pass_band_width_frequency = "500M" - assert design.attributes.diplexer_pass_band_width_frequency == "500M" - - def test_diplexer_lower_corner_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES - assert design.attributes.diplexer_lower_corner_frequency == "905 M" - design.attributes.diplexer_lower_corner_frequency = "800 M" - assert design.attributes.diplexer_lower_corner_frequency == "800 M" - - def test_diplexer_upper_corner_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.pass_band_definition = PassbandDefinition.CORNER_FREQUENCIES - assert design.attributes.diplexer_upper_corner_frequency == "1.105 G" - design.attributes.diplexer_upper_corner_frequency = "1.2 G" - assert design.attributes.diplexer_upper_corner_frequency == "1.2 G" - - def test_diplexer_inner_band_width_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.diplexer_type = DiplexerType.BP_1 - assert design.attributes.diplexer_inner_band_width_frequency == "200M" - design.attributes.diplexer_inner_band_width_frequency = "300M" - assert design.attributes.diplexer_inner_band_width_frequency == "300M" - - def test_diplexer_outer_band_width_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.diplexer_type = DiplexerType.BP_1 - assert design.attributes.diplexer_outer_band_width_frequency == "2G" - design.attributes.diplexer_outer_band_width_frequency = "3G" - assert design.attributes.diplexer_outer_band_width_frequency == "3G" - - def test_diplexer_lower_side_center_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.diplexer_type = DiplexerType.BP_2 - assert design.attributes.diplexer_lower_side_center_frequency == "500M" - design.attributes.diplexer_lower_side_center_frequency = "300M" - assert design.attributes.diplexer_lower_side_center_frequency == "300M" - - def test_diplexer_higher_side_center_frequency(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.diplexer_type = DiplexerType.BP_2 - assert design.attributes.diplexer_higher_side_center_frequency == "2G" - design.attributes.diplexer_higher_side_center_frequency = "3G" - assert design.attributes.diplexer_higher_side_center_frequency == "3G" - - def test_diplexer_lower_side_band_width(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.diplexer_type = DiplexerType.BP_2 - assert design.attributes.diplexer_lower_side_band_width == "500M" - design.attributes.diplexer_lower_side_band_width = "300M" - assert design.attributes.diplexer_lower_side_band_width == "300M" - - def test_diplexer_higher_side_band_width(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.attributes.filter_class = FilterClass.DIPLEXER_1 - design.attributes.diplexer_type = DiplexerType.BP_2 - assert design.attributes.diplexer_higher_side_band_width == "2G" - design.attributes.diplexer_higher_side_band_width = "3G" - assert design.attributes.diplexer_higher_side_band_width == "3G" - def test_order(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.attributes.order == 5 diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 80a8fd1c5b4..097cb979e80 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -346,36 +346,6 @@ def _define_attributes_dll_functions(self): self._dll.getUpperFrequency.argtypes = [c_char_p, c_int] self._dll.getUpperFrequency.restype = c_int - self._dll.setDiplexerInnerPassbandFrequency.argtype = c_char_p - self._dll.setDiplexerInnerPassbandFrequency.restype = c_int - self._dll.getDiplexerInnerPassbandFrequency.argtypes = [c_char_p, c_int] - self._dll.getDiplexerInnerPassbandFrequency.restype = c_int - - self._dll.setDiplexerOuterPassbandFrequency.argtype = c_char_p - self._dll.setDiplexerOuterPassbandFrequency.restype = c_int - self._dll.getDiplexerOuterPassbandFrequency.argtypes = [c_char_p, c_int] - self._dll.getDiplexerOuterPassbandFrequency.restype = c_int - - self._dll.setDiplexerLowerCenterFrequency.argtype = c_char_p - self._dll.setDiplexerLowerCenterFrequency.restype = c_int - self._dll.getDiplexerLowerCenterFrequency.argtypes = [c_char_p, c_int] - self._dll.getDiplexerLowerCenterFrequency.restype = c_int - - self._dll.setDiplexerHigherCenterFrequency.argtype = c_char_p - self._dll.setDiplexerHigherCenterFrequency.restype = c_int - self._dll.getDiplexerHigherCenterFrequency.argtypes = [c_char_p, c_int] - self._dll.getDiplexerHigherCenterFrequency.restype = c_int - - self._dll.setDiplexerLowerBandwidth.argtype = c_char_p - self._dll.setDiplexerLowerBandwidth.restype = c_int - self._dll.getDiplexerLowerBandwidth.argtypes = [c_char_p, c_int] - self._dll.getDiplexerLowerBandwidth.restype = c_int - - self._dll.setDiplexerHigherBandwidth.argtype = c_char_p - self._dll.setDiplexerHigherBandwidth.restype = c_int - self._dll.getDiplexerHigherBandwidth.argtypes = [c_char_p, c_int] - self._dll.getDiplexerHigherBandwidth.restype = c_int - self._dll.setStopbandDef.argtype = c_int self._dll.setStopbandDef.restype = c_int self._dll.getStopbandDef.argtype = POINTER(c_int) @@ -629,182 +599,6 @@ def diplexer_type(self, diplexer_type: DiplexerType): string_value = self._dll_interface.enum_to_string(diplexer_type) self._dll_interface.set_string(self._dll.setDiplexerType, string_value) - @property - def diplexer_center_frequency(self) -> str: - """Diplexer center frequency. - The default is ``1 GHz``. - - Returns - ------- - str - """ - diplexer_center_frequency_string = self._dll_interface.get_string(self._dll.getCenterFrequency) - return diplexer_center_frequency_string - - @diplexer_center_frequency.setter - def diplexer_center_frequency(self, diplexer_center_frequency_string): - self._dll_interface.set_string(self._dll.setCenterFrequency, diplexer_center_frequency_string) - - @property - def diplexer_pass_band_width_frequency(self) -> str: - """Pass band width frequency for diplexer filters. - The default is ``200 MHz``. - - Returns - ------- - str - """ - diplexer_pass_band_width_frequency_string = self._dll_interface.get_string(self._dll.getPassbandFrequency) - return diplexer_pass_band_width_frequency_string - - @diplexer_pass_band_width_frequency.setter - def diplexer_pass_band_width_frequency(self, diplexer_pass_band_width_frequency_string): - self._dll_interface.set_string(self._dll.setPassbandFrequency, diplexer_pass_band_width_frequency_string) - - @property - def diplexer_lower_corner_frequency(self) -> str: - """Diplexer lower corner frequency. - The default is ``905 MHz``. - - Returns - ------- - str - """ - diplexer_lower_corner_frequency_string = self._dll_interface.get_string(self._dll.getLowerFrequency) - return diplexer_lower_corner_frequency_string - - @diplexer_lower_corner_frequency.setter - def diplexer_lower_corner_frequency(self, diplexer_lower_corner_frequency_string): - self._dll_interface.set_string(self._dll.setLowerFrequency, diplexer_lower_corner_frequency_string) - - @property - def diplexer_upper_corner_frequency(self) -> str: - """Deiplexer upper corner frequency. - The default is ``1.105 MHz``. - - Returns - ------- - str - """ - diplexer_upper_corner_frequency_string = self._dll_interface.get_string(self._dll.getUpperFrequency) - return diplexer_upper_corner_frequency_string - - @diplexer_upper_corner_frequency.setter - def diplexer_upper_corner_frequency(self, diplexer_upper_corner_frequency_string): - self._dll_interface.set_string(self._dll.setUpperFrequency, diplexer_upper_corner_frequency_string) - - @property - def diplexer_inner_band_width_frequency(self) -> str: - """Inner band width frequency for diplexer filters. - The default is ``200 MHz``. - - Returns - ------- - str - """ - diplexer_inner_band_width_frequency_string = self._dll_interface.get_string( - self._dll.getDiplexerInnerPassbandFrequency - ) - return diplexer_inner_band_width_frequency_string - - @diplexer_inner_band_width_frequency.setter - def diplexer_inner_band_width_frequency(self, diplexer_inner_band_width_frequency_string): - self._dll_interface.set_string( - self._dll.setDiplexerInnerPassbandFrequency, diplexer_inner_band_width_frequency_string - ) - - @property - def diplexer_outer_band_width_frequency(self) -> str: - """Outer band width frequency for diplexer filters. - The default is ``2 GHz``. - - Returns - ------- - str - """ - diplexer_outer_band_width_frequency_string = self._dll_interface.get_string( - self._dll.getDiplexerOuterPassbandFrequency - ) - return diplexer_outer_band_width_frequency_string - - @diplexer_outer_band_width_frequency.setter - def diplexer_outer_band_width_frequency(self, diplexer_outer_band_width_frequency_string): - self._dll_interface.set_string( - self._dll.setDiplexerOuterPassbandFrequency, diplexer_outer_band_width_frequency_string - ) - - @property - def diplexer_lower_side_center_frequency(self) -> str: - """Lower side center frequency of diplexer filters. - The default is ``500 MHz``. - - Returns - ------- - str - """ - diplexer_lower_side_center_frequency_string = self._dll_interface.get_string( - self._dll.getDiplexerLowerCenterFrequency - ) - return diplexer_lower_side_center_frequency_string - - @diplexer_lower_side_center_frequency.setter - def diplexer_lower_side_center_frequency(self, diplexer_lower_side_center_frequency_string): - self._dll_interface.set_string( - self._dll.setDiplexerLowerCenterFrequency, diplexer_lower_side_center_frequency_string - ) - - @property - def diplexer_higher_side_center_frequency(self) -> str: - """Higher side center frequency of diplexer filters. - The default is ``2 GHz``. - - Returns - ------- - str - """ - diplexer_higher_side_center_frequency_string = self._dll_interface.get_string( - self._dll.getDiplexerHigherCenterFrequency - ) - return diplexer_higher_side_center_frequency_string - - @diplexer_higher_side_center_frequency.setter - def diplexer_higher_side_center_frequency(self, diplexer_higher_side_center_frequency_string): - self._dll_interface.set_string( - self._dll.setDiplexerHigherCenterFrequency, diplexer_higher_side_center_frequency_string - ) - - @property - def diplexer_lower_side_band_width(self) -> str: - """Lower side bandwidth of diplexer filters. - The default is ``500 MHz``. - - Returns - ------- - str - """ - diplexer_lower_side_band_width_string = self._dll_interface.get_string(self._dll.getDiplexerLowerBandwidth) - return diplexer_lower_side_band_width_string - - @diplexer_lower_side_band_width.setter - def diplexer_lower_side_band_width(self, diplexer_lower_side_band_width_string): - self._dll_interface.set_string(self._dll.setDiplexerLowerBandwidth, diplexer_lower_side_band_width_string) - - @property - def diplexer_higher_side_band_width(self) -> str: - """Higher side bandwidth of diplexer filters. - The default is ``2 GHz``. - - Returns - ------- - str - """ - diplexer_higher_side_band_width_string = self._dll_interface.get_string(self._dll.getDiplexerHigherBandwidth) - return diplexer_higher_side_band_width_string - - @diplexer_higher_side_band_width.setter - def diplexer_higher_side_band_width(self, diplexer_higher_side_band_width_string): - self._dll_interface.set_string(self._dll.setDiplexerHigherBandwidth, diplexer_higher_side_band_width_string) - @property def filter_multiple_bands_enabled(self) -> bool: """Flag indicating if the multiple bands table is enabled. From 018b40b8b1ad6981ca7beefdac90056811a85e1f Mon Sep 17 00:00:00 2001 From: raghajaf Date: Thu, 27 Jun 2024 12:17:38 -0400 Subject: [PATCH 17/26] feat/draft_filtersolutions: comments are applied. --- _unittest/test_45_FilterSolutions/__init__.py | 23 + .../resources/__init__.py | 25 + .../resources.py} | 5 + .../test_filter/__init__.py | 23 + .../test_filter/test_attributes.py | 4 +- .../test_filter/test_dll_interface.py | 4 +- .../test_filter/test_graph_setup.py | 4 +- .../test_filter/test_ideal_response.py | 509 +++++++++--------- .../test_filter/test_multiple_bands_table.py | 4 +- .../test_filter/test_transmission_zeros.py | 64 +-- .../test_lumped_filter/__init__.py | 23 + .../test_lumped_nodes_and_leads.py | 66 +-- .../test_lumped_parasitics.py | 64 +-- .../test_lumped_termination_impedance.py | 4 +- .../test_lumped_topology.py | 195 ++----- .../test_raise_error.py | 4 +- .../Lumped_Element_Response.py | 2 +- pyaedt/filtersolutions.py | 31 +- pyaedt/filtersolutions_core/__init__.py | 8 +- pyaedt/filtersolutions_core/attributes.py | 12 - pyaedt/filtersolutions_core/dll_interface.py | 38 +- pyaedt/filtersolutions_core/graph_setup.py | 15 +- pyaedt/filtersolutions_core/ideal_response.py | 73 ++- .../lumped_nodes_and_leads.py | 30 +- .../filtersolutions_core/lumped_parasitics.py | 14 +- .../lumped_termination_impedance.py | 22 +- .../filtersolutions_core/lumped_topology.py | 16 +- .../multiple_bands_table.py | 54 +- .../transmission_zeros.py | 79 ++- pyaedt/generic/design_types.py | 25 + 30 files changed, 635 insertions(+), 805 deletions(-) create mode 100644 _unittest/test_45_FilterSolutions/__init__.py create mode 100644 _unittest/test_45_FilterSolutions/resources/__init__.py rename _unittest/test_45_FilterSolutions/{test_lumped_filter/filtersolutions_resource.py => resources/resources.py} (92%) create mode 100644 _unittest/test_45_FilterSolutions/test_filter/__init__.py create mode 100644 _unittest/test_45_FilterSolutions/test_lumped_filter/__init__.py diff --git a/_unittest/test_45_FilterSolutions/__init__.py b/_unittest/test_45_FilterSolutions/__init__.py new file mode 100644 index 00000000000..9c4476773da --- /dev/null +++ b/_unittest/test_45_FilterSolutions/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/_unittest/test_45_FilterSolutions/resources/__init__.py b/_unittest/test_45_FilterSolutions/resources/__init__.py new file mode 100644 index 00000000000..d2b2bdb76b9 --- /dev/null +++ b/_unittest/test_45_FilterSolutions/resources/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from .resources import read_resource_file diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py b/_unittest/test_45_FilterSolutions/resources/resources.py similarity index 92% rename from _unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py rename to _unittest/test_45_FilterSolutions/resources/resources.py index e551e4afa7a..628027d14c5 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/filtersolutions_resource.py +++ b/_unittest/test_45_FilterSolutions/resources/resources.py @@ -34,3 +34,8 @@ def resources_driectory(): def resource_path(resource_file_name): return os.path.join(resources_driectory(), resource_file_name) + + +def read_resource_file(filename): + with open(resource_path(filename)) as f: + return f.read().splitlines() diff --git a/_unittest/test_45_FilterSolutions/test_filter/__init__.py b/_unittest/test_45_FilterSolutions/test_filter/__init__.py new file mode 100644 index 00000000000..9c4476773da --- /dev/null +++ b/_unittest/test_45_FilterSolutions/test_filter/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 32cd7707d46..99e78ee5794 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -40,7 +40,7 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_filter_type(self): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index 7b28d4e7cb0..d9611445246 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -31,7 +31,7 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_version(self): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index 52e921e9a3d..ef2138265f3 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -30,7 +30,7 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index a558ebac04a..396ca8fd401 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -22,8 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config -from filtersolutions_resource import resource_path +from _unittest.conftest import config import pytest import pyaedt @@ -34,8 +33,10 @@ from pyaedt.filtersolutions_core.ideal_response import TimeResponseColumn from pyaedt.generic.general_methods import is_linux +from ..resources import read_resource_file -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_frequency_response_getter(self): @@ -92,264 +93,260 @@ def test_frequency_response_getter(self): assert freqs[300] == 8669097136.772985 assert freqs[-1] == 31214328219.225075 - def test_time_response_getter(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) - assert len(step_response) == 300 - assert step_response[100] == pytest.approx(1.0006647872833518) - assert step_response[200] == pytest.approx(0.9999988501385255) - assert step_response[-1] == pytest.approx(0.9999999965045667) - ramp_response = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE) - assert len(ramp_response) == 300 - assert ramp_response[100] == pytest.approx(2.8184497075983895e-09) - assert ramp_response[200] == pytest.approx(6.151630831481296e-09) - assert ramp_response[-1] == pytest.approx(9.45163045223663e-09) - impulse_response = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE) - assert len(impulse_response) == 300 - assert impulse_response[100] == pytest.approx(-8537300.294689251) - assert impulse_response[200] == pytest.approx(-8538.227868086184) - assert impulse_response[-1] == pytest.approx(3.996366349798659) - step_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE_DB) - assert len(step_response_db) == 300 - assert step_response_db[100] == pytest.approx(-1.0381882969997027) - assert step_response_db[200] == pytest.approx(-1.0439706350712086) - assert step_response_db[-1] == pytest.approx(-1.0439606778565478) - ramp_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE_DB) - assert len(ramp_response_db) == 300 - assert ramp_response_db[100] == pytest.approx(-10.540507747401335) - assert ramp_response_db[200] == pytest.approx(-3.7609082425924782) - assert ramp_response_db[-1] == pytest.approx(-0.03057888328183367) - impulse_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE_DB) - assert len(impulse_response_db) == 300 - assert impulse_response_db[100] == pytest.approx(-48.60282519370875) - assert impulse_response_db[200] == pytest.approx(-100.0) - assert impulse_response_db[-1] == pytest.approx(-100.0) - time = design.ideal_response._time_response_getter(TimeResponseColumn.TIME) - assert len(time) == 300 - assert time[1] == pytest.approx(3.3333333333333335e-11) - assert time[200] == pytest.approx(6.666666666666667e-09) - assert time[-1] == pytest.approx(9.966666666666667e-09) - - def test_sparameters_response_getter(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) - assert len(s11_response_db) == 500 - assert s11_response_db[100] == pytest.approx(-41.93847819973562) - assert s11_response_db[300] == pytest.approx(-0.1703333929877981) - assert s11_response_db[-1] == pytest.approx(-4.742889883456317e-07) - s21_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_DB) - assert len(s21_response_db) == 500 - assert s21_response_db[100] == pytest.approx(-0.0002779395744451339) - assert s21_response_db[300] == pytest.approx(-14.14973347970826) - assert s21_response_db[-1] == pytest.approx(-69.61741290615645) - s11_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_ARITH) - assert len(s11_response) == 500 - assert s11_response[100] == pytest.approx(0.007999744012287301) - assert s11_response[300] == pytest.approx(0.9805806756909208) - assert s11_response[-1] == pytest.approx(0.9999999453954638) - s21_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_ARITH) - assert len(s21_response) == 500 - assert s21_response[100] == pytest.approx(0.9999680015359182) - assert s21_response[300] == pytest.approx(0.1961161351381822) - assert s21_response[-1] == pytest.approx(0.000330467956321812) - freqs = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.FREQUENCY) - assert len(freqs) == 500 - assert freqs[100] == pytest.approx(2392202091.5388284) - assert freqs[300] == pytest.approx(8669097136.772985) - assert freqs[-1] == pytest.approx(31214328219.225075) + def test_time_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + step_response = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE) + assert len(step_response) == 300 + assert step_response[100] == pytest.approx(1.0006647872833518) + assert step_response[200] == pytest.approx(0.9999988501385255) + assert step_response[-1] == pytest.approx(0.9999999965045667) + ramp_response = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE) + assert len(ramp_response) == 300 + assert ramp_response[100] == pytest.approx(2.8184497075983895e-09) + assert ramp_response[200] == pytest.approx(6.151630831481296e-09) + assert ramp_response[-1] == pytest.approx(9.45163045223663e-09) + impulse_response = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE) + assert len(impulse_response) == 300 + assert impulse_response[100] == pytest.approx(-8537300.294689251) + assert impulse_response[200] == pytest.approx(-8538.227868086184) + assert impulse_response[-1] == pytest.approx(3.996366349798659) + step_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.STEP_RESPONSE_DB) + assert len(step_response_db) == 300 + assert step_response_db[100] == pytest.approx(-1.0381882969997027) + assert step_response_db[200] == pytest.approx(-1.0439706350712086) + assert step_response_db[-1] == pytest.approx(-1.0439606778565478) + ramp_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.RAMP_RESPONSE_DB) + assert len(ramp_response_db) == 300 + assert ramp_response_db[100] == pytest.approx(-10.540507747401335) + assert ramp_response_db[200] == pytest.approx(-3.7609082425924782) + assert ramp_response_db[-1] == pytest.approx(-0.03057888328183367) + impulse_response_db = design.ideal_response._time_response_getter(TimeResponseColumn.IMPULSE_RESPONSE_DB) + assert len(impulse_response_db) == 300 + assert impulse_response_db[100] == pytest.approx(-48.60282519370875) + assert impulse_response_db[200] == pytest.approx(-100.0) + assert impulse_response_db[-1] == pytest.approx(-100.0) + time = design.ideal_response._time_response_getter(TimeResponseColumn.TIME) + assert len(time) == 300 + assert time[1] == pytest.approx(3.3333333333333335e-11) + assert time[200] == pytest.approx(6.666666666666667e-09) + assert time[-1] == pytest.approx(9.966666666666667e-09) - def test_pole_zeros_response_getter(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) - assert len(pole_zero_den_x) == 5 - assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) - assert pole_zero_den_x[1] == pytest.approx(-809016994.3749474) - assert pole_zero_den_x[2] == pytest.approx(-809016994.3749474) - assert pole_zero_den_x[3] == pytest.approx(-309016994.3749475) - assert pole_zero_den_x[4] == pytest.approx(-309016994.3749475) - pole_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_Y) - assert len(pole_zero_den_y) == 5 - assert pole_zero_den_y[0] == pytest.approx(0.0) - assert pole_zero_den_y[1] == pytest.approx(587785252.2924731) - assert pole_zero_den_y[2] == pytest.approx(-587785252.2924731) - assert pole_zero_den_y[3] == pytest.approx(951056516.2951534) - assert pole_zero_den_y[4] == pytest.approx(-951056516.2951534) - pole_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_X) - assert len(pole_zero_num_x) == 0 - pole_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_Y) - assert len(pole_zero_num_y) == 0 - proto_pole_zero_den_x = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_X - ) - assert len(proto_pole_zero_den_x) == 5 - assert proto_pole_zero_den_x[0] == pytest.approx(-0.30901699437494745) - assert proto_pole_zero_den_x[1] == pytest.approx(-0.30901699437494745) - assert proto_pole_zero_den_x[2] == pytest.approx(-0.8090169943749475) - assert proto_pole_zero_den_x[3] == pytest.approx(-0.8090169943749475) - assert proto_pole_zero_den_x[4] == pytest.approx(-1.0) - proto_pole_zero_den_y = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_Y - ) - assert len(proto_pole_zero_den_y) == 5 - assert proto_pole_zero_den_y[0] == pytest.approx(0.9510565162951534) - assert proto_pole_zero_den_y[1] == pytest.approx(-0.9510565162951534) - assert proto_pole_zero_den_y[2] == pytest.approx(-0.5877852522924731) - assert proto_pole_zero_den_y[3] == pytest.approx(0.5877852522924731) - assert proto_pole_zero_den_y[4] == pytest.approx(0.0) - proto_pole_zero_num_x = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_X - ) - assert len(proto_pole_zero_num_x) == 0 - proto_pole_zero_num_y = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_Y - ) - assert len(proto_pole_zero_num_y) == 0 - rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_X) - assert len(rx_zero_den_x) == 5 - assert rx_zero_den_x[0] == pytest.approx(-1000000000.0) - assert rx_zero_den_x[1] == pytest.approx(-809016994.3749474) - assert rx_zero_den_x[2] == pytest.approx(-809016994.3749474) - assert rx_zero_den_x[3] == pytest.approx(-309016994.3749475) - assert rx_zero_den_x[4] == pytest.approx(-309016994.3749475) - rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_Y) - assert len(rx_zero_den_y) == 5 - assert rx_zero_den_y[0] == pytest.approx(0.0) - assert rx_zero_den_y[1] == pytest.approx(587785252.2924731) - assert rx_zero_den_y[2] == pytest.approx(-587785252.2924731) - assert rx_zero_den_y[3] == pytest.approx(951056516.2951534) - assert rx_zero_den_y[4] == pytest.approx(-951056516.2951534) - rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_X) - assert len(rx_zero_num_x) == 5 - assert rx_zero_num_x[0] == pytest.approx(0.0) - assert rx_zero_num_x[1] == pytest.approx(0.0) - assert rx_zero_num_x[2] == pytest.approx(0.0) - assert rx_zero_num_x[3] == pytest.approx(0.0) - assert rx_zero_num_x[4] == pytest.approx(0.0) - rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_Y) - assert len(rx_zero_num_y) == 5 - assert rx_zero_num_y[0] == pytest.approx(0.0) - assert rx_zero_num_y[1] == pytest.approx(0.0) - assert rx_zero_num_y[2] == pytest.approx(0.0) - assert rx_zero_num_y[3] == pytest.approx(0.0) - assert rx_zero_num_y[4] == pytest.approx(0.0) - proto_rx_zero_den_x = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_X - ) - assert len(proto_rx_zero_den_x) == 5 - assert proto_rx_zero_den_x[0] == pytest.approx(-0.30901699437494745) - assert proto_rx_zero_den_x[1] == pytest.approx(-0.30901699437494745) - assert proto_rx_zero_den_x[2] == pytest.approx(-0.8090169943749475) - assert proto_rx_zero_den_x[3] == pytest.approx(-0.8090169943749475) - assert proto_rx_zero_den_x[4] == pytest.approx(-1.0) - proto_rx_zero_den_y = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_Y - ) - assert len(proto_rx_zero_den_y) == 5 - assert proto_rx_zero_den_y[0] == pytest.approx(0.9510565162951534) - assert proto_rx_zero_den_y[1] == pytest.approx(-0.9510565162951534) - assert proto_rx_zero_den_y[2] == pytest.approx(-0.5877852522924731) - assert proto_rx_zero_den_y[3] == pytest.approx(0.5877852522924731) - assert proto_rx_zero_den_y[4] == pytest.approx(0.0) - proto_rx_zero_num_x = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_X - ) - assert len(proto_rx_zero_num_x) == 5 - assert proto_rx_zero_num_x[0] == pytest.approx(0.0) - assert proto_rx_zero_num_x[1] == pytest.approx(0.0) - assert proto_rx_zero_num_x[2] == pytest.approx(0.0) - assert proto_rx_zero_num_x[3] == pytest.approx(0.0) - assert proto_rx_zero_num_x[4] == pytest.approx(0.0) - proto_rx_zero_num_y = design.ideal_response._pole_zeros_response_getter( - PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_Y - ) - assert len(proto_rx_zero_num_y) == 5 - assert proto_rx_zero_num_y[0] == pytest.approx(0.0) - assert proto_rx_zero_num_y[1] == pytest.approx(0.0) - assert proto_rx_zero_num_y[2] == pytest.approx(0.0) - assert proto_rx_zero_num_y[3] == pytest.approx(0.0) - assert proto_rx_zero_num_y[4] == pytest.approx(0.0) + def test_sparameters_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + s11_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_DB) + assert len(s11_response_db) == 500 + assert s11_response_db[100] == pytest.approx(-41.93847819973562) + assert s11_response_db[300] == pytest.approx(-0.1703333929877981) + assert s11_response_db[-1] == pytest.approx(-4.742889883456317e-07) + s21_response_db = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_DB) + assert len(s21_response_db) == 500 + assert s21_response_db[100] == pytest.approx(-0.0002779395744451339) + assert s21_response_db[300] == pytest.approx(-14.14973347970826) + assert s21_response_db[-1] == pytest.approx(-69.61741290615645) + s11_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S11_ARITH) + assert len(s11_response) == 500 + assert s11_response[100] == pytest.approx(0.007999744012287301) + assert s11_response[300] == pytest.approx(0.9805806756909208) + assert s11_response[-1] == pytest.approx(0.9999999453954638) + s21_response = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.S21_ARITH) + assert len(s21_response) == 500 + assert s21_response[100] == pytest.approx(0.9999680015359182) + assert s21_response[300] == pytest.approx(0.1961161351381822) + assert s21_response[-1] == pytest.approx(0.000330467956321812) + freqs = design.ideal_response._sparamaters_response_getter(SParametersResponseColumn.FREQUENCY) + assert len(freqs) == 500 + assert freqs[100] == pytest.approx(2392202091.5388284) + assert freqs[300] == pytest.approx(8669097136.772985) + assert freqs[-1] == pytest.approx(31214328219.225075) - def test_filter_vsg_analysis_enabled(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.ideal_response.vsg_analysis_enabled is False - design.ideal_response.vsg_analysis_enabled = True - assert design.ideal_response.vsg_analysis_enabled + def test_pole_zeros_response_getter(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + pole_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_X) + assert len(pole_zero_den_x) == 5 + assert pole_zero_den_x[0] == pytest.approx(-1000000000.0) + assert pole_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert pole_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert pole_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert pole_zero_den_x[4] == pytest.approx(-309016994.3749475) + pole_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_DEN_Y) + assert len(pole_zero_den_y) == 5 + assert pole_zero_den_y[0] == pytest.approx(0.0) + assert pole_zero_den_y[1] == pytest.approx(587785252.2924731) + assert pole_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert pole_zero_den_y[3] == pytest.approx(951056516.2951534) + assert pole_zero_den_y[4] == pytest.approx(-951056516.2951534) + pole_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_X) + assert len(pole_zero_num_x) == 0 + pole_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.TX_ZERO_NUM_Y) + assert len(pole_zero_num_y) == 0 + proto_pole_zero_den_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_X + ) + assert len(proto_pole_zero_den_x) == 5 + assert proto_pole_zero_den_x[0] == pytest.approx(-0.30901699437494745) + assert proto_pole_zero_den_x[1] == pytest.approx(-0.30901699437494745) + assert proto_pole_zero_den_x[2] == pytest.approx(-0.8090169943749475) + assert proto_pole_zero_den_x[3] == pytest.approx(-0.8090169943749475) + assert proto_pole_zero_den_x[4] == pytest.approx(-1.0) + proto_pole_zero_den_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_DEN_Y + ) + assert len(proto_pole_zero_den_y) == 5 + assert proto_pole_zero_den_y[0] == pytest.approx(0.9510565162951534) + assert proto_pole_zero_den_y[1] == pytest.approx(-0.9510565162951534) + assert proto_pole_zero_den_y[2] == pytest.approx(-0.5877852522924731) + assert proto_pole_zero_den_y[3] == pytest.approx(0.5877852522924731) + assert proto_pole_zero_den_y[4] == pytest.approx(0.0) + proto_pole_zero_num_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_X + ) + assert len(proto_pole_zero_num_x) == 0 + proto_pole_zero_num_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_TX_ZERO_NUM_Y + ) + assert len(proto_pole_zero_num_y) == 0 + rx_zero_den_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_X) + assert len(rx_zero_den_x) == 5 + assert rx_zero_den_x[0] == pytest.approx(-1000000000.0) + assert rx_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert rx_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert rx_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert rx_zero_den_x[4] == pytest.approx(-309016994.3749475) + rx_zero_den_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_DEN_Y) + assert len(rx_zero_den_y) == 5 + assert rx_zero_den_y[0] == pytest.approx(0.0) + assert rx_zero_den_y[1] == pytest.approx(587785252.2924731) + assert rx_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert rx_zero_den_y[3] == pytest.approx(951056516.2951534) + assert rx_zero_den_y[4] == pytest.approx(-951056516.2951534) + rx_zero_num_x = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_X) + assert len(rx_zero_num_x) == 5 + assert rx_zero_num_x[0] == pytest.approx(0.0) + assert rx_zero_num_x[1] == pytest.approx(0.0) + assert rx_zero_num_x[2] == pytest.approx(0.0) + assert rx_zero_num_x[3] == pytest.approx(0.0) + assert rx_zero_num_x[4] == pytest.approx(0.0) + rx_zero_num_y = design.ideal_response._pole_zeros_response_getter(PoleZerosResponseColumn.RX_ZERO_NUM_Y) + assert len(rx_zero_num_y) == 5 + assert rx_zero_num_y[0] == pytest.approx(0.0) + assert rx_zero_num_y[1] == pytest.approx(0.0) + assert rx_zero_num_y[2] == pytest.approx(0.0) + assert rx_zero_num_y[3] == pytest.approx(0.0) + assert rx_zero_num_y[4] == pytest.approx(0.0) + proto_rx_zero_den_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_X + ) + assert len(proto_rx_zero_den_x) == 5 + assert proto_rx_zero_den_x[0] == pytest.approx(-0.30901699437494745) + assert proto_rx_zero_den_x[1] == pytest.approx(-0.30901699437494745) + assert proto_rx_zero_den_x[2] == pytest.approx(-0.8090169943749475) + assert proto_rx_zero_den_x[3] == pytest.approx(-0.8090169943749475) + assert proto_rx_zero_den_x[4] == pytest.approx(-1.0) + proto_rx_zero_den_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_DEN_Y + ) + assert len(proto_rx_zero_den_y) == 5 + assert proto_rx_zero_den_y[0] == pytest.approx(0.9510565162951534) + assert proto_rx_zero_den_y[1] == pytest.approx(-0.9510565162951534) + assert proto_rx_zero_den_y[2] == pytest.approx(-0.5877852522924731) + assert proto_rx_zero_den_y[3] == pytest.approx(0.5877852522924731) + assert proto_rx_zero_den_y[4] == pytest.approx(0.0) + proto_rx_zero_num_x = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_X + ) + assert len(proto_rx_zero_num_x) == 5 + assert proto_rx_zero_num_x[0] == pytest.approx(0.0) + assert proto_rx_zero_num_x[1] == pytest.approx(0.0) + assert proto_rx_zero_num_x[2] == pytest.approx(0.0) + assert proto_rx_zero_num_x[3] == pytest.approx(0.0) + assert proto_rx_zero_num_x[4] == pytest.approx(0.0) + proto_rx_zero_num_y = design.ideal_response._pole_zeros_response_getter( + PoleZerosResponseColumn.PROTO_RX_ZERO_NUM_Y + ) + assert len(proto_rx_zero_num_y) == 5 + assert proto_rx_zero_num_y[0] == pytest.approx(0.0) + assert proto_rx_zero_num_y[1] == pytest.approx(0.0) + assert proto_rx_zero_num_y[2] == pytest.approx(0.0) + assert proto_rx_zero_num_y[3] == pytest.approx(0.0) + assert proto_rx_zero_num_y[4] == pytest.approx(0.0) - def test_frequency_response(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - freq, mag_db = design.ideal_response.frequency_response( - y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, - minimum_frequency="200 MHz", - maximum_frequency="5 GHz", - vsg_analysis_enabled=False, - ) - assert len(freq) == 500 - assert freq[100] == pytest.approx(380730787.74317527) - assert freq[300] == pytest.approx(1379729661.4612174) - assert freq[-1] == pytest.approx(4967914631.382509) - assert len(mag_db) == 500 - assert mag_db[100] == pytest.approx(-0.0002779395744451339) - assert mag_db[300] == pytest.approx(-14.14973347970826) - assert mag_db[-1] == pytest.approx(-69.61741290615645) + def test_filter_vsg_analysis_enabled(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.ideal_response.vsg_analysis_enabled is False + design.ideal_response.vsg_analysis_enabled = True + assert design.ideal_response.vsg_analysis_enabled - def test_time_response(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - time, step_response = design.ideal_response.time_response( - y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, - minimum_time="0 ns", - maximum_time="10 ns", - vsg_analysis_enabled=False, - ) - assert len(time) == 300 - assert time[100] == pytest.approx(3.334e-09) - assert time[200] == pytest.approx(6.667e-09) - assert time[-1] == pytest.approx(9.9667e-09) + def test_frequency_response(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + freq, mag_db = design.ideal_response.frequency_response( + y_axis_parameter=FrequencyResponseColumn.MAGNITUDE_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + vsg_analysis_enabled=False, + ) + assert len(freq) == 500 + assert freq[100] == pytest.approx(380730787.74317527) + assert freq[300] == pytest.approx(1379729661.4612174) + assert freq[-1] == pytest.approx(4967914631.382509) + assert len(mag_db) == 500 + assert mag_db[100] == pytest.approx(-0.0002779395744451339) + assert mag_db[300] == pytest.approx(-14.14973347970826) + assert mag_db[-1] == pytest.approx(-69.61741290615645) - assert len(step_response) == 300 - assert step_response[100] == pytest.approx(1.0006647872833518) - assert step_response[200] == pytest.approx(0.9999988501385255) - assert step_response[-1] == pytest.approx(0.9999999965045667) + def test_time_response(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + time, step_response = design.ideal_response.time_response( + y_axis_parameter=TimeResponseColumn.STEP_RESPONSE, + minimum_time="0 ns", + maximum_time="10 ns", + vsg_analysis_enabled=False, + ) + assert len(time) == 300 + assert time[100] == pytest.approx(3.334e-09) + assert time[200] == pytest.approx(6.667e-09) + assert time[-1] == pytest.approx(9.9667e-09) + assert len(step_response) == 300 + assert step_response[100] == pytest.approx(1.0006647872833518) + assert step_response[200] == pytest.approx(0.9999988501385255) + assert step_response[-1] == pytest.approx(0.9999999965045667) - def test_s_parameters(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - freq, s21_db = design.ideal_response.s_parameters( - y_axis_parameter=SParametersResponseColumn.S21_DB, - minimum_frequency="200 MHz", - maximum_frequency="5 GHz", - ) - assert len(freq) == 500 - assert freq[100] == pytest.approx(380730787.74317527) - assert freq[300] == pytest.approx(1379729661.4612174) - assert freq[-1] == pytest.approx(4967914631.382509) - assert len(s21_db) == 500 - assert s21_db[100] == pytest.approx(-0.0002779395744451339) - assert s21_db[300] == pytest.approx(-14.14973347970826) - assert s21_db[-1] == pytest.approx(-69.61741290615645) + def test_s_parameters(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + freq, s21_db = design.ideal_response.s_parameters( + y_axis_parameter=SParametersResponseColumn.S21_DB, + minimum_frequency="200 MHz", + maximum_frequency="5 GHz", + ) + assert len(freq) == 500 + assert freq[100] == pytest.approx(380730787.74317527) + assert freq[300] == pytest.approx(1379729661.4612174) + assert freq[-1] == pytest.approx(4967914631.382509) + assert len(s21_db) == 500 + assert s21_db[100] == pytest.approx(-0.0002779395744451339) + assert s21_db[300] == pytest.approx(-14.14973347970826) + assert s21_db[-1] == pytest.approx(-69.61741290615645) - def test_pole_zero_locations(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( - x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, - y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, - ) - assert len(tx_zero_den_x) == 5 - assert tx_zero_den_x[0] == pytest.approx(-1000000000.0) - assert tx_zero_den_x[1] == pytest.approx(-809016994.3749474) - assert tx_zero_den_x[2] == pytest.approx(-809016994.3749474) - assert tx_zero_den_x[3] == pytest.approx(-309016994.3749475) - assert tx_zero_den_x[4] == pytest.approx(-309016994.3749475) - assert len(tx_zero_den_y) == 5 - assert tx_zero_den_y[0] == pytest.approx(0.0) - assert tx_zero_den_y[1] == pytest.approx(587785252.2924731) - assert tx_zero_den_y[2] == pytest.approx(-587785252.2924731) - assert tx_zero_den_y[3] == pytest.approx(951056516.2951534) - assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) + def test_pole_zero_locations(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + tx_zero_den_x, tx_zero_den_y = design.ideal_response.pole_zero_locations( + x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, + y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, + ) + assert len(tx_zero_den_x) == 5 + assert tx_zero_den_x[0] == pytest.approx(-1000000000.0) + assert tx_zero_den_x[1] == pytest.approx(-809016994.3749474) + assert tx_zero_den_x[2] == pytest.approx(-809016994.3749474) + assert tx_zero_den_x[3] == pytest.approx(-309016994.3749475) + assert tx_zero_den_x[4] == pytest.approx(-309016994.3749475) + assert len(tx_zero_den_y) == 5 + assert tx_zero_den_y[0] == pytest.approx(0.0) + assert tx_zero_den_y[1] == pytest.approx(587785252.2924731) + assert tx_zero_den_y[2] == pytest.approx(-587785252.2924731) + assert tx_zero_den_y[3] == pytest.approx(951056516.2951534) + assert tx_zero_den_y[4] == pytest.approx(-951056516.2951534) - def test_transfer_function_response(self): - design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - list = design.ideal_response.transfer_function_response() - list_file = open(resource_path("transferfunction.ckt")) - lines_list = list.splitlines() - lines_list_file = list_file.readlines() - for i in range(len(lines_list_file)): - assert lines_list_file[i] == lines_list[i] + "\n" + def test_transfer_function_response(self): + design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) + assert design.ideal_response.transfer_function_response().splitlines() == read_resource_file( + "transferfunction.ckt" + ) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index 78450d3e996..3bac5c883f1 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -30,7 +30,7 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_row_count(self): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index 0aaaf5b4f6d..4e9841decd8 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -30,18 +30,18 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_row_count(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - assert design.transmission_zeros_frequency.row_count == 0 + assert design.transmission_zeros_bandwidth.row_count == 0 assert design.transmission_zeros_ratio.row_count == 0 def test_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.row(0) + design.transmission_zeros_bandwidth.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) @@ -50,7 +50,7 @@ def test_row(self): def test_update_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.update_row(0, zero="1.3G", position="2") + design.transmission_zeros_bandwidth.update_row(0, zero="1.3G", position="2") assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.update_row(0, "1.3", "2") @@ -59,17 +59,17 @@ def test_update_row(self): def test_append_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.append_row(zero="", position="") + design.transmission_zeros_bandwidth.append_row(zero="", position="") assert info.value.args[0] == "The input value is blank" with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.append_row("", "") assert info.value.args[0] == "The input value is blank" - design.transmission_zeros_frequency.append_row("1600M") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "") - design.transmission_zeros_frequency.clear_row() - design.transmission_zeros_frequency.append_row(zero="1600M", position="2") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") - design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_bandwidth.append_row("1600M") + assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "") + design.transmission_zeros_bandwidth.clear_row() + design.transmission_zeros_bandwidth.append_row(zero="1600M", position="2") + assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "2") + design.transmission_zeros_bandwidth.clear_row() design.transmission_zeros_ratio.append_row("1.6") assert design.transmission_zeros_ratio.row(0) == ("1.6", "") design.transmission_zeros_ratio.clear_row() @@ -79,22 +79,22 @@ def test_append_row(self): def test_insert_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.insert_row(6, zero="1.3G", position="2") + design.transmission_zeros_bandwidth.insert_row(6, zero="1.3G", position="2") assert info.value.args[0] == "The given index 6 is larger than zeros order" with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.insert_row(6, "1.3", "2") assert info.value.args[0] == "The given index 6 is larger than zeros order" with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.insert_row(0, zero="", position="2") + design.transmission_zeros_bandwidth.insert_row(0, zero="", position="2") assert info.value.args[0] == "The input value is blank" with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.insert_row(0, "", "") assert info.value.args[0] == "The input value is blank" - design.transmission_zeros_frequency.insert_row(0, "1600M") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "") - design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") - design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_bandwidth.insert_row(0, "1600M") + assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "") + design.transmission_zeros_bandwidth.insert_row(0, zero="1600M", position="2") + assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "2") + design.transmission_zeros_bandwidth.clear_row() design.transmission_zeros_ratio.insert_row(0, "1.6") assert design.transmission_zeros_ratio.row(0) == ("1.6", "") design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") @@ -103,21 +103,21 @@ def test_insert_row(self): def test_remove_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.remove_row(2) + design.transmission_zeros_bandwidth.remove_row(2) assert info.value.args[0] == "The given index 2 is larger than zeros order" - design.transmission_zeros_frequency.append_row(zero="1600M", position="2") - design.transmission_zeros_frequency.remove_row(0) + design.transmission_zeros_bandwidth.append_row(zero="1600M", position="2") + design.transmission_zeros_bandwidth.remove_row(0) with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.row(0) + design.transmission_zeros_bandwidth.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" def test_clear_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") - assert design.transmission_zeros_frequency.row(0) == ("1600M", "2") - design.transmission_zeros_frequency.clear_row() + design.transmission_zeros_bandwidth.insert_row(0, zero="1600M", position="2") + assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "2") + design.transmission_zeros_bandwidth.clear_row() with pytest.raises(RuntimeError) as info: - design.transmission_zeros_frequency.row(0) + design.transmission_zeros_bandwidth.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") @@ -126,11 +126,11 @@ def test_clear_row(self): design.transmission_zeros_ratio.row(0) assert info.value.args[0] == "This filter has no transmission zero at row 0" - def test_default_position(self): + def test_restore_default_positions(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - design.transmission_zeros_frequency.insert_row(0, zero="1600M", position="2") - design.transmission_zeros_frequency.default_position() - assert design.transmission_zeros_frequency.row(0) == ("1600M", "3") + design.transmission_zeros_bandwidth.insert_row(0, zero="1600M", position="2") + design.transmission_zeros_bandwidth.restore_default_positions() + assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "3") design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") - design.transmission_zeros_ratio.default_position() + design.transmission_zeros_ratio.restore_default_positions() assert design.transmission_zeros_ratio.row(0) == ("1.6", "3") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/__init__.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/__init__.py new file mode 100644 index 00000000000..9c4476773da --- /dev/null +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index 1fbe146ba21..772b3fc3b91 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -22,110 +22,74 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config -from filtersolutions_resource import resource_path +from _unittest.conftest import config + +# from ..filtersolutions_resources import resource_path import pytest import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.generic.general_methods import is_linux +from ..resources import read_resource_file + -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: + def test_lumped_c_node_capacitor(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_capacitor == "0" lumpdesign.leads_and_nodes.c_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.c_node_capacitor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("c_node_capacitor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("c_node_capacitor.ckt") def test_lumped_c_lead_inductor(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_lead_inductor == "0" lumpdesign.leads_and_nodes.c_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.c_lead_inductor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("c_lead_inductor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("c_lead_inductor.ckt") def test_lumped_l_node_capacitor(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_capacitor == "0" lumpdesign.leads_and_nodes.l_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.l_node_capacitor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("l_node_capacitor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("l_node_capacitor.ckt") def test_lumped_l_lead_inductor(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_lead_inductor == "0" lumpdesign.leads_and_nodes.l_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.l_lead_inductor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("l_lead_inductor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("l_lead_inductor.ckt") def test_lumped_r_node_capacitor(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_node_capacitor == "0" lumpdesign.leads_and_nodes.r_node_capacitor = "1n" assert lumpdesign.leads_and_nodes.r_node_capacitor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("r_node_capacitor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("r_node_capacitor.ckt") def test_lumped_r_lead_inductor(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.r_lead_inductor == "0" lumpdesign.leads_and_nodes.r_lead_inductor = "1n" assert lumpdesign.leads_and_nodes.r_lead_inductor == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("r_lead_inductor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("r_lead_inductor.ckt") def test_lumped_c_node_compensate(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.c_node_compensate is False lumpdesign.leads_and_nodes.c_node_compensate = True assert lumpdesign.leads_and_nodes.c_node_compensate - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("c_node_compensate.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("c_node_compensate.ckt") def test_lumped_l_node_compensate(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.leads_and_nodes.l_node_compensate is False lumpdesign.leads_and_nodes.l_node_compensate = True assert lumpdesign.leads_and_nodes.l_node_compensate - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("l_node_compensate.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("l_node_compensate.ckt") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 730b14ea9c4..5c57781c728 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -22,110 +22,72 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config -from filtersolutions_resource import resource_path +from _unittest.conftest import config import pytest import pyaedt from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.generic.general_methods import is_linux +from ..resources import read_resource_file -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: + def test_lumped_capacitor_q(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_q == "Inf" lumpdesign.parasitics.capacitor_q = "100" assert lumpdesign.parasitics.capacitor_q == "100" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_q.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("capacitor_q.ckt") def test_lumped_capacitor_rs(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rs == "0" lumpdesign.parasitics.capacitor_rs = "1" assert lumpdesign.parasitics.capacitor_rs == "1" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_rs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("capacitor_rs.ckt") def test_lumped_capacitor_rp(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_rp == "Inf" lumpdesign.parasitics.capacitor_rp = "1000" assert lumpdesign.parasitics.capacitor_rp == "1000" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_rp.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("capacitor_rp.ckt") def test_lumped_capacitor_ls(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.capacitor_ls == "0" lumpdesign.parasitics.capacitor_ls = "1n" assert lumpdesign.parasitics.capacitor_ls == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("capacitor_ls.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("capacitor_ls.ckt") def test_lumped_inductor_q(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_q == "Inf" lumpdesign.parasitics.inductor_q = "100" assert lumpdesign.parasitics.inductor_q == "100" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_q.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("inductor_q.ckt") def test_lumped_inductor_rs(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rs == "0" lumpdesign.parasitics.inductor_rs = "1" assert lumpdesign.parasitics.inductor_rs == "1" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_rs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("inductor_rs.ckt") def test_lumped_inductor_rp(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_rp == "Inf" lumpdesign.parasitics.inductor_rp = "1000" assert lumpdesign.parasitics.inductor_rp == "1000" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_rp.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("inductor_rp.ckt") def test_lumped_inductor_cp(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.parasitics.inductor_cp == "0" lumpdesign.parasitics.inductor_cp = "1n" assert lumpdesign.parasitics.inductor_cp == "1n" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("inductor_cp.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("inductor_cp.ckt") diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index f53f7cd249a..ddb735ce6ac 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -32,7 +32,7 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_row_count(self): diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index 442ddedf2c9..f5b8f4dec7c 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -22,8 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config -from filtersolutions_resource import resource_path +from _unittest.conftest import config import pytest import pyaedt @@ -33,8 +32,10 @@ from pyaedt.filtersolutions_core.attributes import FilterType from pyaedt.generic.general_methods import is_linux +from ..resources import read_resource_file -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") + +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_lumped_generator_resistor_30(self): @@ -42,60 +43,34 @@ def test_lumped_generator_resistor_30(self): assert lumpdesign.topology.generator_resistor == "50" lumpdesign.topology.generator_resistor = "30" assert lumpdesign.topology.generator_resistor == "30" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("generator_resistor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("generator_resistor.ckt") def test_lumped_load_resistor_30(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.load_resistor == "50" lumpdesign.topology.load_resistor = "30" assert lumpdesign.topology.load_resistor == "30" - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("laod_resistor.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("laod_resistor.ckt") def test_lumped_current_source(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.current_source is False lumpdesign.topology.current_source = True assert lumpdesign.topology.current_source - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("current_source.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" def test_lumped_first_shunt(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt lumpdesign.topology.first_shunt = True assert lumpdesign.topology.first_shunt - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("first_shunt.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("first_shunt.ckt") def test_lumped_first_series(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert lumpdesign.topology.first_shunt lumpdesign.topology.first_shunt = False assert lumpdesign.topology.first_shunt is False - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("first_series.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("first_series.ckt") def test_lumped_bridge_t(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -104,12 +79,7 @@ def test_lumped_bridge_t(self): assert lumpdesign.topology.bridge_t is False lumpdesign.topology.bridge_t = True assert lumpdesign.topology.bridge_t - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("bridge_t.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("bridge_t.ckt") def test_lumped_bridge_t_low(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -122,12 +92,7 @@ def test_lumped_bridge_t_low(self): assert lumpdesign.topology.bridge_t_low is False lumpdesign.topology.bridge_t_low = True assert lumpdesign.topology.bridge_t_low - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("bridge_t_low.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("bridge_t_low.ckt") def test_lumped_bridge_t_high(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -140,12 +105,7 @@ def test_lumped_bridge_t_high(self): assert lumpdesign.topology.bridge_t_high is False lumpdesign.topology.bridge_t_high = True assert lumpdesign.topology.bridge_t_high - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("bridge_t_high.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("bridge_t_high.ckt") def test_lumped_equal_inductors(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -154,12 +114,7 @@ def test_lumped_equal_inductors(self): assert lumpdesign.topology.equal_inductors is False lumpdesign.topology.equal_inductors = True assert lumpdesign.topology.equal_inductors - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("equal_inductors.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("equal_inductors.ckt") def test_lumped_equal_capacitors(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -175,12 +130,7 @@ def test_lumped_equal_capacitors(self): lumpdesign.topology.equal_capacitors = True assert lumpdesign.topology.min_cap assert lumpdesign.topology.equal_capacitors - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("equal_capacitors.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("equal_capacitors.ckt") def test_lumped_equal_legs(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -189,12 +139,7 @@ def test_lumped_equal_legs(self): assert lumpdesign.topology.equal_legs is False lumpdesign.topology.equal_legs = True assert lumpdesign.topology.equal_legs - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("equal_legs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("equal_legs.ckt") def test_lumped_high_low_pass(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -203,12 +148,7 @@ def test_lumped_high_low_pass(self): assert lumpdesign.topology.high_low_pass is False lumpdesign.topology.high_low_pass = True assert lumpdesign.topology.high_low_pass - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("high_low_pass.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("high_low_pass.ckt") def test_lumped_high_low_pass_min_ind(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -219,12 +159,7 @@ def test_lumped_high_low_pass_min_ind(self): assert lumpdesign.topology.high_low_pass_min_ind is False lumpdesign.topology.high_low_pass_min_ind = True assert lumpdesign.topology.high_low_pass_min_ind - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("high_low_pass_min_ind.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("high_low_pass_min_ind.ckt") def test_lumped_zig_zag(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -235,12 +170,7 @@ def test_lumped_zig_zag(self): assert lumpdesign.topology.zig_zag is False lumpdesign.topology.zig_zag = True assert lumpdesign.topology.zig_zag - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("zig_zag.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("zig_zag.ckt") def test_lumped_min_ind(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -253,12 +183,7 @@ def test_lumped_min_ind(self): assert lumpdesign.topology.min_ind lumpdesign.topology.min_ind = True assert lumpdesign.topology.min_ind - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("min_ind.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("min_ind.ckt") def test_lumped_min_cap(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -271,12 +196,7 @@ def test_lumped_min_cap(self): assert lumpdesign.topology.min_cap is False lumpdesign.topology.min_cap = True assert lumpdesign.topology.min_cap - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("min_cap.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("min_cap.ckt") def test_lumped_set_source_res(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -290,12 +210,7 @@ def test_lumped_set_source_res(self): assert lumpdesign.topology.zig_zag lumpdesign.topology.set_source_res = True assert lumpdesign.topology.set_source_res - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("set_source_res.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("set_source_res.ckt") def test_lumped_trap_topology(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -308,12 +223,7 @@ def test_lumped_trap_topology(self): assert lumpdesign.topology.trap_topology is False lumpdesign.topology.trap_topology = True assert lumpdesign.topology.trap_topology - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("trap_topology.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("trap_topology.ckt") def test_lumped_node_cap_ground(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -324,12 +234,7 @@ def test_lumped_node_cap_ground(self): assert lumpdesign.topology.node_cap_ground is False lumpdesign.topology.node_cap_ground = True assert lumpdesign.topology.node_cap_ground - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("node_cap_ground.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("node_cap_ground.ckt") def test_lumped_match_impedance(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -340,12 +245,7 @@ def test_lumped_match_impedance(self): assert lumpdesign.topology.match_impedance is False lumpdesign.topology.match_impedance = True assert lumpdesign.topology.match_impedance - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("match_impedance.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("match_impedance.ckt") def test_lumped_complex_termination(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -362,12 +262,7 @@ def test_complex_element_tune_enabled(self): def test_lumped_circuit_export(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("netlist.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("netlist.ckt") def test_lumped_diplexer1_hi_lo(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -375,12 +270,7 @@ def test_lumped_diplexer1_hi_lo(self): lumpdesign.attributes.diplexer_type = DiplexerType.HI_LO assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 assert lumpdesign.attributes.diplexer_type == DiplexerType.HI_LO - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer1_hi_lo.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("diplexer1_hi_lo.ckt") def test_lumped_diplexer1_bp_1(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -388,12 +278,7 @@ def test_lumped_diplexer1_bp_1(self): lumpdesign.attributes.diplexer_type = DiplexerType.BP_1 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_1 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer1_bp_1.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("diplexer1_bp_1.ckt") def test_lumped_diplexer1_bp_2(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -401,12 +286,7 @@ def test_lumped_diplexer1_bp_2(self): lumpdesign.attributes.diplexer_type = DiplexerType.BP_2 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_1 assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_2 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer1_bp_2.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("diplexer1_bp_2.ckt") def test_lumped_diplexer2_bp_bs(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -414,12 +294,7 @@ def test_lumped_diplexer2_bp_bs(self): lumpdesign.attributes.diplexer_type = DiplexerType.BP_BS assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 assert lumpdesign.attributes.diplexer_type == DiplexerType.BP_BS - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer2_bp_bs.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("diplexer2_bp_bs.ckt") def test_lumped_diplexer2_triplexer_1(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -427,12 +302,7 @@ def test_lumped_diplexer2_triplexer_1(self): lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_1 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_1 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer2_triplexer_1.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("diplexer2_triplexer_1.ckt") def test_lumped_diplexer2_triplexer_2(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -440,9 +310,4 @@ def test_lumped_diplexer2_triplexer_2(self): lumpdesign.attributes.diplexer_type = DiplexerType.TRIPLEXER_2 assert lumpdesign.attributes.filter_class == FilterClass.DIPLEXER_2 assert lumpdesign.attributes.diplexer_type == DiplexerType.TRIPLEXER_2 - netlist = lumpdesign.topology.circuit_response() - netlist_file = open(resource_path("diplexer2_triplexer_2.ckt")) - lines_netlist = netlist.splitlines() - lines_netlist_file = netlist_file.readlines() - for i in range(len(lines_netlist_file)): - assert lines_netlist_file[i] == lines_netlist[i] + "\n" + assert lumpdesign.topology.circuit_response().splitlines() == read_resource_file("diplexer2_triplexer_2.ckt") diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index f6dd7d108df..e1b5c0d0866 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from _unittest_solvers.conftest import config +from _unittest.conftest import config import pytest import pyaedt @@ -30,7 +30,7 @@ from pyaedt.generic.general_methods import is_linux -@pytest.mark.skipif(is_linux, reason="FilterSolutions API fails on linux.") +@pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") @pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_raise_error(self): diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py index 1c987acf14a..b6a44555de3 100644 --- a/examples/08-FilterSolutions/Lumped_Element_Response.py +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -20,7 +20,7 @@ # Create the Lumped Design # ~~~~~~~~~~~~~~~~~~~~~~~~ # Create a lumped element filter design and assign the class, type, frequency, and order. -design = pyaedt.FilterSolutions(version="2024.2", implementation_type= FilterImplementation.LUMPED) +design = pyaedt.FilterSolutions(version="2025.1", implementation_type= FilterImplementation.LUMPED) design.attributes.filter_class = FilterClass.BAND_PASS design.attributes.filter_type = FilterType.BUTTERWORTH design.attributes.pass_band_center_frequency = "1G" diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index b7b92139925..b42d682821a 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import pyaedt from pyaedt.filtersolutions_core.attributes import Attributes from pyaedt.filtersolutions_core.attributes import FilterImplementation from pyaedt.filtersolutions_core.graph_setup import GraphSetup @@ -34,8 +35,6 @@ from pyaedt.filtersolutions_core.multiple_bands_table import MultipleBandsTable from pyaedt.filtersolutions_core.transmission_zeros import TableFormat from pyaedt.filtersolutions_core.transmission_zeros import TransmissionZeros -from pyaedt.misc.misc import current_version -from pyaedt.misc.misc import installed_versions class FilterSolutions: @@ -45,8 +44,9 @@ class FilterSolutions: Parameters ---------- + version: str, optional + The version of AEDT in ``xxxx.x`` format. The default is None. implementation_type: FilterImplementation, optional - The technology used to implement the filter. The technology used to implement the filter. The default is ``LUMPED``. The ``FilterImplementation`` enum provides the list of implementations. @@ -58,17 +58,17 @@ class FilterSolutions: >>> import pyaedt >>> from pyaedt.filtersolutions_core.attributes import FilterImplementation - >>> design = pyaedt.FilterSolutions(projectname= "fs1", + >>> design = pyaedt.FilterSolutions(version="2025 R1", projectname= "fs1", >>> implementation_type= FilterImplementation.LUMPED, >>> ) """ - def __init__(self, version=None, implementation_type=FilterImplementation.LUMPED): - version = version - implementation_type = implementation_type - self.version_check(version) + def __init__(self, version=None, implementation_type=None): + self.version = version + self.implementation_type = implementation_type + pyaedt.filtersolutions_core._dll_interface(version) - if implementation_type == FilterImplementation.LUMPED: + if implementation_type == FilterImplementation.LUMPED or implementation_type is None: self._init_lumped_design() else: raise RuntimeError("The " + str(implementation_type) + " is not supported in this release.") @@ -86,15 +86,4 @@ def _init_lumped_design(self): self.load_impedance_table = LumpedTerminationImpedance(TerminationType.LOAD) self.multiple_bands_table = MultipleBandsTable() self.transmission_zeros_ratio = TransmissionZeros(TableFormat.RATIO) - self.transmission_zeros_frequency = TransmissionZeros(TableFormat.FREQUENCY) - - def version_check(self, version): - self_current_version = current_version() - if current_version == "": - raise Exception("AEDT is not installed on your system. Install AEDT version 2025 R1 or higher.") - if version is None: - version = self_current_version - if float(version[0:6]) < 2024: - raise ValueError("PyAEDT supports AEDT version 2025 R1 and later. Recommended version is 2025 R1 or later.") - if not (version in installed_versions()) and not (version + "CL" in installed_versions()): - raise ValueError("Specified version {} is not installed on your system".format(version[0:6])) + self.transmission_zeros_bandwidth = TransmissionZeros(TableFormat.BANDWIDTH) diff --git a/pyaedt/filtersolutions_core/__init__.py b/pyaedt/filtersolutions_core/__init__.py index e47fca5707a..13c3fff050a 100644 --- a/pyaedt/filtersolutions_core/__init__.py +++ b/pyaedt/filtersolutions_core/__init__.py @@ -26,13 +26,17 @@ from pyaedt.filtersolutions_core.dll_interface import DllInterface +# Store the current module in a variable for easy access and modification within the module itself. _this = sys.modules[__name__] + +# Initialize the internal DLL interface attribute to None. This will be set to an actual +# DllInterface instance when needed, implementing a lazy initialization pattern. _this._internal_dll_interface = None -def _dll_interface() -> DllInterface: +def _dll_interface(version=None) -> DllInterface: if _this._internal_dll_interface is None: - _this._internal_dll_interface = DllInterface(show_gui=False) + _this._internal_dll_interface = DllInterface(show_gui=False, version=version) return _this._internal_dll_interface diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 097cb979e80..8dc94e5a33c 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -223,18 +223,6 @@ class Attributes: """Defines attributes and parameters of filters. This class allows you to construct all the necessary attributes for the ``FilterDesign`` class. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class. - - Methods - ---------- - _define_attributes_dll_functions: - Define argument types of DLL functions. """ def __init__(self): diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index a101189669e..cd6749bb101 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -36,7 +36,8 @@ class DllInterface: """Interfaces with the FilterSolutions C++ API DLL.""" - def __init__(self, show_gui=True): + def __init__(self, show_gui=False, version=None): + self.version = version self._init_dll_path() self._init_dll(show_gui) @@ -47,9 +48,18 @@ def restore_defaults(self): def _init_dll_path(self): """Set DLL path and print the status of the DLL access to the screen.""" - relative_path = "../../../build_output/64Release/nuhertz/FilterSolutionsAPI.dll" - self.dll_path = os.path.join(os.path.dirname(__file__), relative_path) - if not os.path.isfile(self.dll_path): + self_current_version = current_version() + if current_version() == "": + raise Exception("AEDT is not installed on your system. Install AEDT version 2025 R1 or higher.") + if self.version is None: + self.version = self_current_version + if float(self.version[0:6]) < 2025: + raise ValueError("PyAEDT supports AEDT version 2025 R1 and later. Recommended version is 2025 R1 or later.") + if not (self.version in installed_versions()) and not (self.version + "CL" in installed_versions()): + raise ValueError("Specified version {} is not installed on your system".format(self.version[0:6])) + if self.version != self_current_version: + self.dll_path = os.path.join(installed_versions()[self.version], "nuhertz/FilterSolutionsAPI.dll") + else: self.dll_path = os.path.join(installed_versions()[current_version()], "nuhertz/FilterSolutionsAPI.dll") # pragma: no cover print("DLL Path:", self.dll_path) @@ -98,10 +108,14 @@ def get_string(self, dll_function: Callable, max_size=100) -> str: max_size: int Maximum number of string characters to return. This value is used for the string buffer size. - Returns + Raises ------- + If there is an error in the execution of the DLL function, an exception is raised. + + Returns + -------- str - Requested string. If '`status`', an error message is returned. + The return value of the called DLL function. """ text_buffer = ctypes.create_string_buffer(max_size) status = dll_function(text_buffer, max_size) @@ -131,28 +145,26 @@ def string_to_enum(self, enum_type: Enum, string: str) -> Enum: Parameters ---------- enum_type: Enum - Enum to call. + Type of Enum to convert. string: str String to convert. Returns ------- str - Converted enum string. + Enum value of the converted string. """ fixed_string = string.upper().replace(" ", "_") return enum_type[fixed_string] def enum_to_string(self, enum_value: Enum) -> str: """ - Convert a string defined by an enum to a string. + Convert an enum value to a string. Parameters ---------- - enum_type: Enum - Enum to call. - string: str - String to convert. + enum_value: Enum + Enum value to convert to string. Returns ------- diff --git a/pyaedt/filtersolutions_core/graph_setup.py b/pyaedt/filtersolutions_core/graph_setup.py index f9c886522c4..58039d738a4 100644 --- a/pyaedt/filtersolutions_core/graph_setup.py +++ b/pyaedt/filtersolutions_core/graph_setup.py @@ -29,20 +29,7 @@ class GraphSetup: - """Defines the minimum and maximum of the frequency and time parameters of the filter - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class. - - Methods - ---------- - _define_graph_dll_functions: - Define argument types of DLL functions. - """ + """Defines the frequency and time limits of the exported responses""" def __init__(self): self._dll = pyaedt.filtersolutions_core._dll_interface()._dll diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py index 7bda88fc1ca..e4394d08c7f 100644 --- a/pyaedt/filtersolutions_core/ideal_response.py +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -144,24 +144,10 @@ class PoleZerosResponseColumn(Enum): class IdealResponse: - """Exports the data for available ideal filter responses. + """Returns the data for available ideal filter responses. Includes ``frequency``, ``time``, ``S parameters``, ``transfer function``, or ``pole zero location`` responses. This class allows you to construct all the necessary ideal response attributes for the ``FilterDesign`` class. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - graph_setup: GraphSetup - Instance of the ``GraphSetup`` class - - Methods - ---------- - _define_response_dll_functions: - Define argument types of DLL functions. """ def __init__(self): @@ -207,17 +193,17 @@ def _define_response_dll_functions(self): self._dll.getVSGAnalsyis.restype = c_int def _frequency_response_getter(self, column: FrequencyResponseColumn): - """Export the ideal filter frequency response. + """Return the ideal filter frequency response. Parameters ---------- column: `FrequencyResponseColumn` - Parameter to export. + Parameter to return. Returns ------- list - The requested parameter array. + The values for the requested frequency response column (e.g., magnitude, phase, etc.). """ size = c_int() status = self._dll.getIdealFrequencyResponseSize(byref(size)) @@ -229,17 +215,17 @@ def _frequency_response_getter(self, column: FrequencyResponseColumn): return values def _time_response_getter(self, column: TimeResponseColumn): - """Export the ideal filter time response. + """Return the ideal filter time response. Parameters ---------- column: `TimeResponseColumn` - Parameter to export. + Parameter to return. Returns ------- list - The requested parameter array. + The values for the requested time response column (e.g., step, pulse, etc.). """ size = c_int() status = self._dll.getIdealTimeResponseSize(byref(size)) @@ -251,17 +237,17 @@ def _time_response_getter(self, column: TimeResponseColumn): return values def _sparamaters_response_getter(self, column: SParametersResponseColumn): - """Export the ideal filter S parameters response. + """Return the ideal filter S parameters response. Parameters ---------- column: `SParametersResponseColumn` - Parameter to export. + Parameter to return. Returns ------- list - The requested parameter array. + The values for the requested S parameters response column (e.g., S11, S21, etc.). """ size = c_int() status = self._dll.getIdealSParamatersResponseSize(byref(size)) @@ -273,17 +259,18 @@ def _sparamaters_response_getter(self, column: SParametersResponseColumn): return values def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): - """Export ideal pole zero location parameters. + """Return ideal pole zero location parameters (e.g., x coordinate of + the denominator of transmission zeros, etc.). Parameters ---------- column: `PoleZerosResponseColumn` - Parameter to export. + Parameter to return. Returns ------- list - The requested parameter array. + The values for the requested pole zero column. """ size = c_int() status = self._dll.getIdealPoleZerosResponseSize(byref(size), column.value) @@ -295,12 +282,18 @@ def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): return values def transfer_function_response(self): - """Export ideal filter transfer function parameters. + """Return ideal filter transfer function parameters. Returns ------- - list + str The requested parameter array. + + + str + Multi-line string where each line contains a coefficient from + the numerator and/or the denominator of the transfer function. + The coefficient for the highest-order term is first and the terms are in decreasing order. """ size = c_int() status = self._dll.getIdealTransferFunctionResponseSize(byref(size)) @@ -336,12 +329,12 @@ def frequency_response( maximum_frequency="5 GHz", vsg_analysis_enabled=False, ): - """Export the ideal filter frequency response for the given parameters. + """Return the ideal filter frequency response for the given parameters. Parameters ---------- y_axis_parameter: `FrequencyResponseColumn`, optional - Parameter to export. The default is frequency response magnitude in dB. + Parameter to return. The default is frequency response magnitude in dB. minimum_frequency: str, optional The default is ``200 MHz``. maximum_frequency: str, optional @@ -374,12 +367,12 @@ def time_response( maximum_time="10 ns", vsg_analysis_enabled=False, ): - """Export the ideal filter time response for the given parameters. + """Return the ideal filter time response for the given parameters. Parameters ---------- y_axis_parameter: `TimeResponseColumn`, optional - Parameter to export. The default is step time response. + Parameter to return. The default is step time response. minimum_time: str, optional The default is ``0 s``. maximum_time: str, optional @@ -408,12 +401,12 @@ def s_parameters( minimum_frequency="200 MHz", maximum_frequency="5 GHz", ): - """Export the ideal filter S parameters response for the given parameters. + """Return the ideal filter S parameters response for the given parameters. Parameters ---------- y_axis_parameter: `SParametersResponseColumn`, optional - Parameter to export. The default is S21 parameter response in dB. + Parameter to return. The default is S21 parameter response in dB. minimum_frequency: str, optional The default is ``200 MHz``. maximum_frequency: str, optional @@ -443,22 +436,22 @@ def pole_zero_locations( x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, ): - """Export the ideal pole zero location for the given parameters. + """Return the ideal pole zero location for the given parameters. Parameters ---------- x_axis_parameter: `PoleZerosResponseColumn`, optional - Parameter to export. The default is x coordinate of filter transmission zero denominator. + Parameter to return. The default is x coordinate of filter transmission zero denominator. y_axis_parameter: `PoleZerosResponseColumn`, optional - Parameter to export. The default is y coordinate of filter transmission zero denominator. + Parameter to return. The default is y coordinate of filter transmission zero denominator. Returns ------- tuple: The tuple contains list of str: - The requested parameter. + The x coordinates of the requested parameter. list of str: - The requested parameter. + The y coordinates of the requested parameter. """ x_parameter = self._pole_zeros_response_getter(x_axis_parameter) y_parameter = self._pole_zeros_response_getter(y_axis_parameter) diff --git a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py index 5c6adbeaebd..45f3353e77a 100644 --- a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py +++ b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py @@ -36,18 +36,6 @@ class LumpedNodesandLeads: This class allows you to construct all the necessary node capacitor and lead inductor attributes of lumped elements for the LumpedDesign class. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - - Methods - ---------- - _define_nodes_and_leads_dll_functions: - Define argument types of DLL functions. """ def __init__(self): @@ -99,7 +87,7 @@ def _define_nodes_and_leads_dll_functions(self): @property def c_node_capacitor(self) -> str: - """Shunt capacitors value of non ideal capacitors nodes in synthesized circuit + """Shunt capacitance assigned to each capacitor node The default is ``0``. Returns @@ -115,7 +103,7 @@ def c_node_capacitor(self, c_node_capacitor): @property def c_lead_inductor(self) -> str: - """Series inductors value of non ideal capacitors leades in synthesized circuit + """Series inductance assigned to each capacitor lead The default is ``0``. Returns @@ -131,7 +119,7 @@ def c_lead_inductor(self, c_lead_inductor): @property def l_node_capacitor(self) -> str: - """Shunt capacitors value of non ideal inductors nodes in synthesized circuit + """Shunt capacitance assigned to each inductor node The default is` ``0``. Returns @@ -147,7 +135,7 @@ def l_node_capacitor(self, l_node_capacitor): @property def l_lead_inductor(self) -> str: - """Series inductors value of non ideal inductors leades in synthesized circuit + """Series inductance assigned to each inductor lead The default is ``0``. Returns @@ -163,7 +151,7 @@ def l_lead_inductor(self, l_lead_inductor): @property def r_node_capacitor(self) -> str: - """Shunt capacitors value of non ideal resistors nodes in synthesized circuit + """Shunt capacitance assigned to each resistor node The default is ``0``. Returns @@ -179,7 +167,7 @@ def r_node_capacitor(self, r_node_capacitor): @property def r_lead_inductor(self) -> str: - """Series inductors value of non ideal resistors leades in synthesized circuit + """Series inductance assigned to each resistor lead The default is ``0``. Returns @@ -195,7 +183,8 @@ def r_lead_inductor(self, r_lead_inductor): @property def c_node_compensate(self) -> bool: - """Flag indicating if the possible adjust capacitor values to compensate for node capacitance is enabled. + """Flag indicating if the capacitor values may be adjusted + in an attempt to compensate for node capacitance is enabled. Returns ------- @@ -213,7 +202,8 @@ def c_node_compensate(self, c_node_compensate: bool): @property def l_node_compensate(self) -> bool: - """Flag indicating if the possible adjust inductor values to compensate for lead inductance is enabled. + """Flag indicating if the inductor values may be adjusted + in an attempt to compensate for lead inductance is enabled. Returns ------- diff --git a/pyaedt/filtersolutions_core/lumped_parasitics.py b/pyaedt/filtersolutions_core/lumped_parasitics.py index d62bb007b09..4707ecb35d8 100644 --- a/pyaedt/filtersolutions_core/lumped_parasitics.py +++ b/pyaedt/filtersolutions_core/lumped_parasitics.py @@ -31,20 +31,8 @@ class LumpedParasitics: """Defines attributes of lumped element parasitics. - This class allows you to construct all the necessary parasitics + This class allows you to construct all the necessary parasitic attributes of lumped elements for the LumpedDesign class. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - - Methods - ---------- - _define_parasitics_dll_functions: - Define argument types of DLL functions. """ def __init__(self): diff --git a/pyaedt/filtersolutions_core/lumped_termination_impedance.py b/pyaedt/filtersolutions_core/lumped_termination_impedance.py index de769a8f716..92972761646 100644 --- a/pyaedt/filtersolutions_core/lumped_termination_impedance.py +++ b/pyaedt/filtersolutions_core/lumped_termination_impedance.py @@ -49,12 +49,12 @@ class ComplexTerminationDefinition(Enum): class ComplexReactanceType(Enum): - """Selects type of complex impedance as reactance, equivalent inductance, or equivalent capacitqnce. + """Selects type of complex impedance as reactance, equivalent inductance, or equivalent capacitance. Attributes: REAC: Represents pure reactance of complex impedance. - IND: Represents equivalent inductance in Henrys. - CAP: Represents equivalent capacitance in Farads. + IND: Represents equivalent inductance in henries. + CAP: Represents equivalent capacitance in farads. """ REAC = 0 @@ -78,20 +78,6 @@ class LumpedTerminationImpedance: """Manipulates access to the entries of source and load complex impedance tables. This class allows you to enter, edit or remove the entries of source and load complex impedance tables. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - table_type: `TerminationType` - Whether selects source or load complex impedance table. - - Methods - ---------- - _define_termination_impedance_dll_functions: - Define argument types of DLL functions. """ def __init__(self, table_type): @@ -194,7 +180,7 @@ def row_count(self) -> int: return int(table_row_count.value) def row(self, row_index): - """Export frequencies and complex impedances at given index of the complex impedances tables. + """Return frequencies and complex impedances at given index of the complex impedances tables. Parameters ---------- diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index 00939ee97f5..1d32f4d4c2a 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -35,18 +35,6 @@ class LumpedTopology: """Defines attributes and parameters of lumped filters. This class allows you to construct all the necessary attributes for the LumpedDesign class. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - - Methods - ---------- - _define_topology_dll_functions: - Define argument types of DLL functions. """ def __init__(self): @@ -216,8 +204,8 @@ def current_source(self, current_source: bool): @property def first_shunt(self) -> bool: - """Flag indicating if the shunt element(s) as first element(s) in synthesized circuit is enabled. - If ``False`` implements series element(s) as first element(s) in synthesized circuit . + """Flag indicating if shunt element(s) are first in the synthesized circuit. + If ``False``, series element(s) are first. Returns ------- diff --git a/pyaedt/filtersolutions_core/multiple_bands_table.py b/pyaedt/filtersolutions_core/multiple_bands_table.py index 3f0c99df07b..10422053160 100644 --- a/pyaedt/filtersolutions_core/multiple_bands_table.py +++ b/pyaedt/filtersolutions_core/multiple_bands_table.py @@ -35,18 +35,9 @@ class MultipleBandsTable: """Manipulates access to the entries of multiple bands table. This class allows you to enter, edit or remove the entries of multiple bands table. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - - Methods - ---------- - _define_multiple_bands_dll_functions: - Define argument types of DLL functions. + The table includes the lower and upper frequencies of the bands. + To access the multiple bands table, use the ``multiple_bands_table`` attribute of the ``FilterSolutions`` class. + A valid multiple bands table must include at both lower and upper frequencies for each band. """ def __init__(self): @@ -76,12 +67,13 @@ def _define_multiple_bands_dll_functions(self): @property def row_count(self) -> int: - """The count of accumulated frequenices in the multiple bands table. + """Retrieve the total number of rows present in the multiple bands table. The default is ``2``. Returns ------- int + The current number of rows in the multiple bands table. """ table_row_count = c_int() status = self._dll.getMultipleBandsTableRowCount(byref(table_row_count)) @@ -89,20 +81,19 @@ def row_count(self) -> int: return int(table_row_count.value) def row(self, row_index): - """Export lower and upper frequencies at given index. + """Retrieve the lower and upper frequency values for a specified row in the multiple bands table. Parameters ---------- row_index: int - The row index on multiple bands table. Starting value is 0 and maximum value is 6. + The index of the row from which to retrieve the frequency values. + Valid values range from ``0`` to ``6``, inclusive. Returns ------- - tuple: The tuple contains - str: - Lower frequency value. - str: - Upper frequency value. + tuple of (str, str) + A tuple containing the lower and upper frequency values as strings. + """ lower_value_buffer = create_string_buffer(100) upper_value_buffer = create_string_buffer(100) @@ -113,16 +104,18 @@ def row(self, row_index): return lower_value_string, upper_value_string def update_row(self, row_index, lower_frequency="", upper_frequency=""): - """Update lower and upper frequencies at given index. + """Update lower and upper frequency values for a specified row in the multiple bands table. Parameters ---------- row_index: int - The row index on multiple bands table. Starting value is 0 and maximum value is 6. + The index of the row to update, with a valid range from ``0`` to ``6`` inclusive. lower_frequency: str, optional - The default is blank. + The new lower frequency value to set for the specified row. + If this value is not provided, the row's lower frequency remains unchanged. upper_frequency: str, optional - The default is blank. + The new upper frequency value to set for the specified row. + If this value is not provided, the row's upper frequency remains unchanged. """ lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") @@ -130,12 +123,14 @@ def update_row(self, row_index, lower_frequency="", upper_frequency=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, lower_frequency, upper_frequency): - """Append lower and upper frequencies at the end row of multiple bands table. + """Appends a new row with specified lower and upper frequency values to the end of the multiple bands table. Parameters ---------- lower_frequency: str + The lower frequency value to append. upper_frequency: str + The upper frequency value to append. """ lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") @@ -148,9 +143,11 @@ def insert_row(self, row_index, lower_frequency, upper_frequency): Parameters ---------- row_index: int - The row index on multiple bands table. Starting value is ``0`` and maximum value is ``6``. + The index of the row to update, with a valid range from ``0`` to ``6`` inclusive. lower_frequency: str + The lower frequency value to insert. upper_frequency: str + The upper frequency value to insert. """ lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") @@ -158,12 +155,13 @@ def insert_row(self, row_index, lower_frequency, upper_frequency): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): - """Remove lower and upper frequencies at given index. + """Remove a row specified by its index from the multiple bands table. Parameters ---------- row_index: int - The row index on multiple bands table. Starting value is ``0`` and maximum value is ``6``. + The index of the row to be removed from the multiple bands table. + Valid values range from ``0``to ``6``, inclusive. """ status = self._dll.removeMultipleBandsTableRow(row_index) pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/filtersolutions_core/transmission_zeros.py b/pyaedt/filtersolutions_core/transmission_zeros.py index 04516a5682b..22574aea896 100644 --- a/pyaedt/filtersolutions_core/transmission_zeros.py +++ b/pyaedt/filtersolutions_core/transmission_zeros.py @@ -38,31 +38,23 @@ class TableFormat(Enum): Attributes: RATIO: Represents transmission zeros ratio table. - FREQUENCY: Represents transmission zeros frequency table. + BANDWIDTH: Represents transmission zeros bandwidth table. """ RATIO = 0 - FREQUENCY = 1 + BANDWIDTH = 1 class TransmissionZeros: - """Manipulates access to the entries of ratio and frequency of tranmsission zeros table. - - This class allows you to enter, edit or remove the entries of ratio and frequency of tranmsission zeros table. - - Attributes - ---------- - _dll: CDLL - FilterSolutions C++ API DLL. - _dll_interface: DllInterface - Instance of the ``DllInterface`` class - table_format: TableFormat - Whether selects ratio or frequency transmission zeros table. - - Methods - ---------- - _define_transmission_zeros_dll_functions: - Define argument types of DLL functions. + """Manipulates access to the entries of ratio and bandwidth of tranmsission zeros table. + + This class allows you to enter, edit or remove the entries of ratio and bandwidth + of tranmsission zeros table. + The table includes the ratio or bandwidth and the position of the element creating + the transmission zero in the associated circuit. + The position of the transmission zero is the position of the element in + the associated circuit that creates the transmission zero. + The position is defined automatically if no value is provided. """ def __init__(self, table_format): @@ -118,20 +110,21 @@ def _define_transmission_zeros_dll_functions(self): self._dll.defaultPositionEnabled.restype = c_int def table_format_to_bool(self): - """Set a flag to recognize ratio or frequency transmission zeros tables. + """Return a boolean value to indicate whether the entry format of + the transmission zeros tables is ratio or bandwidth. Returns ------- bool """ - if self.table_format.value == TableFormat.FREQUENCY.value: + if self.table_format.value == TableFormat.BANDWIDTH.value: return False else: return True @property def row_count(self) -> int: - """The count of accumulated transmission zeros in the transmission zeros table. + """The number of transmission zeros in the transmission zeros table. The default is ``2``. Returns @@ -144,20 +137,20 @@ def row_count(self) -> int: return int(table_row_count.value) def row(self, row_index): - """Export ratios or frequencies at given index of the transmission zeros table. + """Retrieve the transmission zero ratio or bandwidth and the position of the element + causing the transmission zero for a specified entry in the transmission zeros table. Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. + The index of the row to retrieve from the transmission zeros table. + Valid values range from ``0`` to ``9``, inclusive. Returns ------- - tuple: The tuple contains - str: - Transmission zero ratio or frequency value. - str: - Position of the element creating transmission zero in the associated circuit. + tuple of (str, str) + A tuple containing the transmission zero ratio or bandwidth value and the position of the element causing + the transmission zero, both as strings. """ zero_value_buffer = create_string_buffer(100) position_value_buffer = create_string_buffer(100) @@ -174,18 +167,20 @@ def row(self, row_index): return zero_value_string, position_value_string def update_row(self, row_index, zero="", position=""): - """Update ratios or frequencies at given index of the transmission zeros table. + """Update the transmission zero ratio or bandwidth and its position + for a specified row in the transmission zeros table. Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. + The index of the row to update in the transmission zeros table. + Valid values range from ``0`` to ``9``, inclusive. zero: str, optional - Transmission zero ratio or frequency value. - The default is blank. + The new transmission zero ratio or bandwidth value to set. + If not specified, the value remains unchanged. position: str, optional - Position of the element creating transmission zero in the associated circuit. - The default is blank. + The new position of the element causing the transmission zero in the circuit. + If not specified, the value remains unchanged. """ zero_bytes_value = bytes(zero, "ascii") position_bytes_value = bytes(position, "ascii") @@ -198,12 +193,12 @@ def update_row(self, row_index, zero="", position=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, zero, position=""): - """Append ratios or frequencies at the end row of transmission zeros table. + """Append a new row which includes the ratio or bandwidth and position. Parameters ---------- zero: str - Transmission zero ratio or frequency value. + Transmission zero ratio or bandwidth value. position: str Position of the element creating transmission zero in the associated circuit. """ @@ -215,14 +210,14 @@ def append_row(self, zero, position=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, zero, position=""): - """Insert ratios or frequencies at given index of the transmission zeros table. + """Insert a new row which includes the ratio or bandwidth and position. Parameters ---------- row_index: int The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. zero: str - Transmission zero ratio or frequency value. + Transmission zero ratio or bandwidth value. position: str Position of the element creating transmission zero in the associated circuit. """ @@ -237,7 +232,7 @@ def insert_row(self, row_index, zero, position=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): - """Remove ratios or frequencies at given index of the transmission zeros table. + """Remove the specified row including the ratio or bandwidth and position. Parameters ---------- @@ -252,7 +247,7 @@ def clear_row(self): status = self._dll.clearTransmissionZerosTableRow(self.table_format_to_bool()) pyaedt.filtersolutions_core._dll_interface().raise_error(status) - def default_position(self): - """Restore default position of transmissison zeros.""" + def restore_default_positions(self): + """Restore default positions of transmissison zeros.""" status = self._dll.defaultPositionEnabled(self.table_format_to_bool()) pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index dac7a2e0646..ddd04a60caf 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -53,6 +53,31 @@ def FilterSolutions( version=None, implementation_type=None, ): + """Initializes the FilterSolutions application. + + Parameters + ---------- + version : str optional + Version of AEDT in ``xxxx.x`` format to use. The default is ``None``, in which case the + active setup or latest installed version is used. + implementation_type : enum, optional + Type of filter implementation available from FilterImplementation enum. + The default is ``None``, in which case the lumped implementation is used. + + Returns + ------- + :class:`pyaedt.filtersolutions.FilterSolutions` + + Examples + -------- + Define a band-pass Butterworth filter with a center frequency of 1 GHz and a pass band width of 500 MHz. + + design = pyaedt.FilterSolutions(version="2025.1", implementation_type= FilterImplementation.LUMPED) + design.attributes.filter_class = FilterClass.BAND_PASS + design.attributes.filter_type = FilterType.BUTTERWORTH + design.attributes.pass_band_center_frequency = "1G" + design.attributes.pass_band_width_frequency = "500M" + """ from pyaedt.filtersolutions import FilterSolutions as app return app( From 53e149fd842b9615ad0d1e9450e08193eccaf5d2 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Fri, 28 Jun 2024 07:21:41 -0400 Subject: [PATCH 18/26] Feat Filtersolutions: Version check updated. --- pyaedt/filtersolutions_core/__init__.py | 7 ++++++ pyaedt/filtersolutions_core/dll_interface.py | 26 +++++++++----------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pyaedt/filtersolutions_core/__init__.py b/pyaedt/filtersolutions_core/__init__.py index 13c3fff050a..924e98e76eb 100644 --- a/pyaedt/filtersolutions_core/__init__.py +++ b/pyaedt/filtersolutions_core/__init__.py @@ -37,6 +37,13 @@ def _dll_interface(version=None) -> DllInterface: if _this._internal_dll_interface is None: _this._internal_dll_interface = DllInterface(show_gui=False, version=version) + elif version is not None and version != _this._internal_dll_interface.version: + raise Exception( + "The requested version {} does not match with the previously defined version {}.".format( + version, _this._internal_dll_interface.version + ) + ) + return _this._internal_dll_interface diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index cd6749bb101..509243d5f8a 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -37,8 +37,7 @@ class DllInterface: """Interfaces with the FilterSolutions C++ API DLL.""" def __init__(self, show_gui=False, version=None): - self.version = version - self._init_dll_path() + self._init_dll_path(version) self._init_dll(show_gui) def restore_defaults(self): @@ -46,25 +45,22 @@ def restore_defaults(self): status = self._dll.startApplication(self.show_gui) self.raise_error(status) - def _init_dll_path(self): + def _init_dll_path(self, version): """Set DLL path and print the status of the DLL access to the screen.""" - self_current_version = current_version() - if current_version() == "": + latest_version = current_version() + if latest_version == "": raise Exception("AEDT is not installed on your system. Install AEDT version 2025 R1 or higher.") - if self.version is None: - self.version = self_current_version - if float(self.version[0:6]) < 2025: + if version is None: + version = latest_version + if float(version[0:6]) < 2025: raise ValueError("PyAEDT supports AEDT version 2025 R1 and later. Recommended version is 2025 R1 or later.") - if not (self.version in installed_versions()) and not (self.version + "CL" in installed_versions()): - raise ValueError("Specified version {} is not installed on your system".format(self.version[0:6])) - if self.version != self_current_version: - self.dll_path = os.path.join(installed_versions()[self.version], "nuhertz/FilterSolutionsAPI.dll") - else: - self.dll_path = os.path.join(installed_versions()[current_version()], "nuhertz/FilterSolutionsAPI.dll") - # pragma: no cover + if not (version in installed_versions()) and not (version + "CL" in installed_versions()): + raise ValueError("Specified version {} is not installed on your system".format(version[0:6])) + self.dll_path = os.path.join(installed_versions()[version], "nuhertz/FilterSolutionsAPI.dll") print("DLL Path:", self.dll_path) if not os.path.isfile(self.dll_path): raise RuntimeError(f"The 'FilterSolution' API DLL was not found at {self.dll_path}.") # pragma: no cover + self.version = version def _init_dll(self, show_gui): """Load DLL and initialize application parameters to default values.""" From 87707019d9fb803b38b57107351735e66edabf8e Mon Sep 17 00:00:00 2001 From: Matthew Young <86373761+myoung301@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:48:48 -0500 Subject: [PATCH 19/26] Update examples/08-FilterSolutions/Lumped_Element_Response.py Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- examples/08-FilterSolutions/Lumped_Element_Response.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py index b6a44555de3..25be4bf059e 100644 --- a/examples/08-FilterSolutions/Lumped_Element_Response.py +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -1,7 +1,7 @@ """ -Design a Lumped Element Filter +Design a lumped element filter ------------------------------ -This example shows how you can use PyAEDT to use the `FilterSolutions` library to design and +This example shows how to use PyAEDT to use the ``FilterSolutions`` library to design and visualize the frequency response of a band-pass Butterworth filter. """ From 825a7e89453981759ea916b47c4bf4d39beda567 Mon Sep 17 00:00:00 2001 From: Matthew Young <86373761+myoung301@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:49:20 -0500 Subject: [PATCH 20/26] Update examples/08-FilterSolutions/Lumped_Element_Response.py Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- examples/08-FilterSolutions/Lumped_Element_Response.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py index 25be4bf059e..7f5ed37c4d2 100644 --- a/examples/08-FilterSolutions/Lumped_Element_Response.py +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -17,7 +17,7 @@ import matplotlib.pyplot as plt ############################################################################### -# Create the Lumped Design +# Create the lumped design # ~~~~~~~~~~~~~~~~~~~~~~~~ # Create a lumped element filter design and assign the class, type, frequency, and order. design = pyaedt.FilterSolutions(version="2025.1", implementation_type= FilterImplementation.LUMPED) From 23fa1331da3df1f938c0788ad6b444122dd248ef Mon Sep 17 00:00:00 2001 From: Matthew Young <86373761+myoung301@users.noreply.github.com> Date: Fri, 28 Jun 2024 09:53:03 -0500 Subject: [PATCH 21/26] Apply suggestions from code review Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- examples/08-FilterSolutions/Lumped_Element_Response.py | 2 +- pyaedt/filtersolutions.py | 4 ++-- pyaedt/filtersolutions_core/__init__.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py index 7f5ed37c4d2..0282777de7c 100644 --- a/examples/08-FilterSolutions/Lumped_Element_Response.py +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -60,7 +60,7 @@ def format_plot(): ############################################################################## # Generate the netlist for the designed filter. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Generate and print the netlist for the designed filter with the transmission zero.. +# Generate and print the netlist for the designed filter with the transmission zero. netlist = design.topology.circuit_response() print("Netlist: \n", netlist) diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index b42d682821a..126fca6b1c9 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -40,12 +40,12 @@ class FilterSolutions: """Provides the ``FilterSolutions`` application interface. - The class has access to ideal filter attributes and calculated output parameters. + This class has access to ideal filter attributes and calculated output parameters. Parameters ---------- version: str, optional - The version of AEDT in ``xxxx.x`` format. The default is None. + The version of AEDT in ``xxxx.x`` format. The default is ``None``. implementation_type: FilterImplementation, optional The technology used to implement the filter. The default is ``LUMPED``. The ``FilterImplementation`` enum provides the list of implementations. diff --git a/pyaedt/filtersolutions_core/__init__.py b/pyaedt/filtersolutions_core/__init__.py index 924e98e76eb..c029850e7fd 100644 --- a/pyaedt/filtersolutions_core/__init__.py +++ b/pyaedt/filtersolutions_core/__init__.py @@ -29,8 +29,8 @@ # Store the current module in a variable for easy access and modification within the module itself. _this = sys.modules[__name__] -# Initialize the internal DLL interface attribute to None. This will be set to an actual -# DllInterface instance when needed, implementing a lazy initialization pattern. +# Initialize the internal DLL interface attribute to ``None``. This is set to an actual +# ``DllInterface`` instance when needed, implementing a lazy initialization pattern. _this._internal_dll_interface = None From 04fd4c3ee0c1dfbf1034d54352c98d64ac90da28 Mon Sep 17 00:00:00 2001 From: Matthew Young <86373761+myoung301@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:12:50 +0000 Subject: [PATCH 22/26] Address the comments about the Enum doc strings. --- pyaedt/filtersolutions_core/attributes.py | 141 +++++++++++++--------- 1 file changed, 84 insertions(+), 57 deletions(-) diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 8dc94e5a33c..cbd0d8d8fcc 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -35,15 +35,17 @@ class FilterType(Enum): """Provides an enum of filter types with associated mathematical formulations. - Attributes: - GAUSSIAN: Represents a Gaussian filter. - BESSEL: Represents a Bessel filter. - BUTTERWORTH: Represents a Butterworth filter. - LEGENDRE: Represents a Legendre filter. - CHEBYSHEV_I: Represents a Chevyshev type I filter. - CHEBYSHEV_II: Represents a Chevyshev type II filter. - HOURGLASS: Represents an hourglass filter. - ELLIPTIC: Represents an elliptic filter. + **Attributes:** + + - GAUSSIAN: Represents a Gaussian filter. + - BESSEL: Represents a Bessel filter. + - BUTTERWORTH: Represents a Butterworth filter. + - LEGENDRE: Represents a Legendre filter. + - CHEBYSHEV_I: Represents a Chevyshev type I filter. + - CHEBYSHEV_II: Represents a Chevyshev type II filter. + - HOURGLASS: Represents an hourglass filter. + - ELLIPTIC: Represents an elliptic filter. + Custom, raised-cos, and matched filter types are not available in this release. """ @@ -67,17 +69,18 @@ class FilterType(Enum): class FilterClass(Enum): """Provides an enum of filter types for single-band and multiple-bands filters. - Attributes: - LOW_PASS: Represents a low-pass filter. - HIGH_PASS: Represents a high-pass filter. - DIPLEXER_1: Represents a first group of diplexer filter. - BAND_PASS: Represents a band pass filter. - BAND_STOP: Represents a band stop filter. - DIPLEXER_2: Represents a second group of diplexer filter. - LOW_BAND: Represents a combined low-pass and multi-band filter. - BAND_HIGH: Represents a combined high-pass and multi-band filter. - BAND_BAND: Represents a multi-band pass filter. - STOP_STOP: Represents a multi-band stop filter. + **Attributes:** + + - LOW_PASS: Represents a low-pass filter. + - HIGH_PASS: Represents a high-pass filter. + - DIPLEXER_1: Represents a first group of diplexer filter. + - BAND_PASS: Represents a band pass filter. + - BAND_STOP: Represents a band stop filter. + - DIPLEXER_2: Represents a second group of diplexer filter. + - LOW_BAND: Represents a combined low-pass and multi-band filter. + - BAND_HIGH: Represents a combined high-pass and multi-band filter. + - BAND_BAND: Represents a multi-band pass filter. + - STOP_STOP: Represents a multi-band stop filter. """ LOW_PASS = 0 @@ -95,12 +98,13 @@ class FilterClass(Enum): class FilterImplementation(Enum): """Provides an enum of filter implementation types. - Attributes: - LUMPED: Represents a lumped implementation. - DISTRIB: Represents a distributed implementation. - ACTIVE: Represents an active implementation. - SWCAP: Represents a switched capacitor implementation. - DIGITAL: Represents a digital implementation. + **Attributes:** + + - LUMPED: Represents a lumped implementation. + - DISTRIB: Represents a distributed implementation. + - ACTIVE: Represents an active implementation. + - SWCAP: Represents a switched capacitor implementation. + - DIGITAL: Represents a digital implementation. """ LUMPED = 0 @@ -113,13 +117,14 @@ class FilterImplementation(Enum): class DiplexerType(Enum): """Provides an enum of diplexer and triplexer types. - Attributes: - HI_LO: Represents a high-pass, low-pass diplexer type. - BP_1: Represents a band-pass, band-pass diplexer type. - BP_2: Represents a band-pass, band-pass diplexer type. - BP_BS: Represents a band-pass, band-stop diplexer type. - TRIPLEXER_1: Represents a low-pass, band-pass, and high-pass triplexer type. - TRIPLEXER_2: Represents a low-pass, band-pass, and high-pass triplexer type. + **Attributes:** + + - HI_LO: Represents a high-pass, low-pass diplexer type. + - BP_1: Represents a band-pass, band-pass diplexer type. + - BP_2: Represents a band-pass, band-pass diplexer type. + - BP_BS: Represents a band-pass, band-stop diplexer type. + - TRIPLEXER_1: Represents a low-pass, band-pass, and high-pass triplexer type. + - TRIPLEXER_2: Represents a low-pass, band-pass, and high-pass triplexer type. """ HI_LO = 0 @@ -133,13 +138,14 @@ class DiplexerType(Enum): class BesselRipplePercentage(Enum): """Provides an enum of peak-to-peak group delay ripple magnitudes as percents of averages for Bessel filters. - Attributes: - ZERO: 0% - HALF: 0.5% - ONE: 1% - TWO: 2% - FIVE: 5% - TEN: 10% + **Attributes:** + + - ZERO: 0% + - HALF: 0.5% + - ONE: 1% + - TWO: 2% + - FIVE: 5% + - TEN: 10% """ ZERO = 0 @@ -153,13 +159,14 @@ class BesselRipplePercentage(Enum): class GaussianTransition(Enum): """Provides an enum of transition attenuations in dB for Gaussian filters to improve group delay response. - Attributes: - TRANSITION_NONE: 0dB - TRANSITION_3_DB: 3dB - TRANSITION_6_DB: 6dB - TRANSITION_9_DB: 9dB - TRANSITION_12_DB: 12dB - TRANSITION_15_DB: 15dB + **Attributes:** + + - TRANSITION_NONE: 0dB + - TRANSITION_3_DB: 3dB + - TRANSITION_6_DB: 6dB + - TRANSITION_9_DB: 9dB + - TRANSITION_12_DB: 12dB + - TRANSITION_15_DB: 15dB """ TRANSITION_NONE = 0 @@ -171,8 +178,14 @@ class GaussianTransition(Enum): class GaussianBesselReflection(Enum): - """Provides an enum of synthesis methods for Gaussian and Bessel filters.""" + """Provides an enum of synthesis methods for Gaussian and Bessel filters. + **Attributes:** + + - OPTION_1: The first method for filter synthesis. + - OPTION_2: The second method for filter synthesis. + - OPTION_3: The third method for filter synthesis. + """ OPTION_1 = 0 OPTION_2 = 1 OPTION_3 = 2 @@ -181,10 +194,11 @@ class GaussianBesselReflection(Enum): class RippleConstrictionBandSelect(Enum): """Provides an enum of the bands to apply constrict the ripple parameter. - Attributes: - STOP: Stop band - PASS: Pass band - BOTH: Stop and pass bands + **Attributes:** + + - STOP: Stop band + - PASS: Pass band + - BOTH: Stop and pass bands """ STOP = 0 @@ -195,9 +209,10 @@ class RippleConstrictionBandSelect(Enum): class SinglePointRippleInfZeros(Enum): """Provides an enum for either one or three non-Infinite zeros at the single frequency point to confine the ripple. - Attributes: - RIPPLE_INF_ZEROS_1: One zero - RIPPLE_INF_ZEROS_3: Three zeros + **Attributes:** + + - RIPPLE_INF_ZEROS_1: One zero + - RIPPLE_INF_ZEROS_3: Three zeros """ RIPPLE_INF_ZEROS_1 = 0 @@ -205,15 +220,27 @@ class SinglePointRippleInfZeros(Enum): class PassbandDefinition(Enum): - """Provides an enum to get either center frequency and bandwidth or corner frequencies.""" + """Provides an enum to get either center frequency and bandwidth or corner frequencies. + + **Attributes:** + + - CENTER_FREQUENCY: Define the passband by the center frequency and bandwidth. + - CORNER_FREQUENCIES: Define the passband by the corner frequencies. + """ CENTER_FREQUENCY = 0 CORNER_FREQUENCIES = 1 class StopbandDefinition(Enum): - """Provides an enum for comparing the stop band parameter to the pass band parameter.""" + """Provides an enum for comparing the stop band parameter to the pass band parameter. + + **ATTRIBUTES:** + - RATIO: The ratio between the stop band and pass band frequencies. + - FREQUENCY: The explicit frequency. + - ATTENUATION_DB: The attenuation in decibels. + """ RATIO = 0 FREQUENCY = 1 ATTENUATION_DB = 2 From dd7295acfbbe5a3bfbd5eee824225009ce9c4f29 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:14:00 +0000 Subject: [PATCH 23/26] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyaedt/filtersolutions_core/attributes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index cbd0d8d8fcc..829a42e7ffc 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -186,6 +186,7 @@ class GaussianBesselReflection(Enum): - OPTION_2: The second method for filter synthesis. - OPTION_3: The third method for filter synthesis. """ + OPTION_1 = 0 OPTION_2 = 1 OPTION_3 = 2 @@ -239,8 +240,9 @@ class StopbandDefinition(Enum): - RATIO: The ratio between the stop band and pass band frequencies. - FREQUENCY: The explicit frequency. - - ATTENUATION_DB: The attenuation in decibels. + - ATTENUATION_DB: The attenuation in decibels. """ + RATIO = 0 FREQUENCY = 1 ATTENUATION_DB = 2 From 23ad389f0be5c998402214ccf741103fa8a39559 Mon Sep 17 00:00:00 2001 From: raghajaf Date: Wed, 3 Jul 2024 09:45:14 -0400 Subject: [PATCH 24/26] FEAT_Filtersolutions: Reviewer comments are applied. --- .../resources/resources.py | 4 +- .../test_filter/filtersolutions_resource.py | 36 ---- .../test_filter/test_attributes.py | 2 +- .../test_filter/test_dll_interface.py | 5 +- .../test_filter/test_graph_setup.py | 2 +- .../test_filter/test_ideal_response.py | 2 +- .../test_filter/test_multiple_bands_table.py | 2 +- .../test_filter/test_transmission_zeros.py | 28 +-- .../test_lumped_nodes_and_leads.py | 2 +- .../test_lumped_parasitics.py | 2 +- .../test_lumped_termination_impedance.py | 2 +- .../test_lumped_topology.py | 2 +- .../test_raise_error.py | 5 +- .../Lumped_Element_Response.py | 17 +- pyaedt/filtersolutions.py | 6 +- pyaedt/filtersolutions_core/attributes.py | 35 ++-- pyaedt/filtersolutions_core/dll_interface.py | 20 +- pyaedt/filtersolutions_core/graph_setup.py | 4 +- pyaedt/filtersolutions_core/ideal_response.py | 181 +++++++++--------- .../lumped_nodes_and_leads.py | 24 ++- .../filtersolutions_core/lumped_parasitics.py | 22 +-- .../lumped_termination_impedance.py | 103 +++++----- .../filtersolutions_core/lumped_topology.py | 39 ++-- .../multiple_bands_table.py | 39 ++-- .../transmission_zeros.py | 57 +++--- pyaedt/generic/design_types.py | 6 +- 26 files changed, 313 insertions(+), 334 deletions(-) delete mode 100644 _unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py diff --git a/_unittest/test_45_FilterSolutions/resources/resources.py b/_unittest/test_45_FilterSolutions/resources/resources.py index 628027d14c5..2cdcbbb2952 100644 --- a/_unittest/test_45_FilterSolutions/resources/resources.py +++ b/_unittest/test_45_FilterSolutions/resources/resources.py @@ -25,7 +25,7 @@ import os -def resources_driectory(): +def resources_directory(): dir_path = os.path.dirname(os.path.realpath(__file__)) test_dir = os.path.dirname(dir_path) resources_path = os.path.join(test_dir, "resources") @@ -33,7 +33,7 @@ def resources_driectory(): def resource_path(resource_file_name): - return os.path.join(resources_driectory(), resource_file_name) + return os.path.join(resources_directory(), resource_file_name) def read_resource_file(filename): diff --git a/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py b/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py deleted file mode 100644 index e551e4afa7a..00000000000 --- a/_unittest/test_45_FilterSolutions/test_filter/filtersolutions_resource.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -import os - - -def resources_driectory(): - dir_path = os.path.dirname(os.path.realpath(__file__)) - test_dir = os.path.dirname(dir_path) - resources_path = os.path.join(test_dir, "resources") - return resources_path - - -def resource_path(resource_file_name): - return os.path.join(resources_driectory(), resource_file_name) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py index 99e78ee5794..ca0088e5d2e 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_attributes.py @@ -41,7 +41,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_filter_type(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index d9611445246..513657eda45 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -23,6 +23,7 @@ # SOFTWARE. from _unittest.conftest import config +from _unittest.test_45_FilterSolutions.test_filter import test_transmission_zeros import pytest import pyaedt @@ -32,7 +33,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_version(self): assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" @@ -49,4 +50,4 @@ def test_raise_error(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == test_transmission_zeros.TestClass.no_transmission_zero_msg diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py index ef2138265f3..4336f888e61 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_graph_setup.py @@ -31,7 +31,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_minimum_frequency(self): diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py index 396ca8fd401..4d98e296e3d 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_ideal_response.py @@ -37,7 +37,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_frequency_response_getter(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py index 3bac5c883f1..39d180d9a05 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_multiple_bands_table.py @@ -31,7 +31,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_row_count(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py index 4e9841decd8..2fcc0edaae8 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_transmission_zeros.py @@ -31,8 +31,12 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: + no_transmission_zero_msg = "This filter has no transmission zero at row 0" + no_transmission_zero_update_msg = "This filter has no transmission zero at row 0 to update" + input_value_blank_msg = "The input value is blank" + def test_row_count(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) assert design.transmission_zeros_bandwidth.row_count == 0 @@ -42,28 +46,28 @@ def test_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_bandwidth.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == self.no_transmission_zero_msg with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == self.no_transmission_zero_msg def test_update_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_bandwidth.update_row(0, zero="1.3G", position="2") - assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" + assert info.value.args[0] == self.no_transmission_zero_update_msg with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.update_row(0, "1.3", "2") - assert info.value.args[0] == "This filter has no transmission zero at row 0 to update" + assert info.value.args[0] == self.no_transmission_zero_update_msg def test_append_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_bandwidth.append_row(zero="", position="") - assert info.value.args[0] == "The input value is blank" + assert info.value.args[0] == self.input_value_blank_msg with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.append_row("", "") - assert info.value.args[0] == "The input value is blank" + assert info.value.args[0] == self.input_value_blank_msg design.transmission_zeros_bandwidth.append_row("1600M") assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "") design.transmission_zeros_bandwidth.clear_row() @@ -86,10 +90,10 @@ def test_insert_row(self): assert info.value.args[0] == "The given index 6 is larger than zeros order" with pytest.raises(RuntimeError) as info: design.transmission_zeros_bandwidth.insert_row(0, zero="", position="2") - assert info.value.args[0] == "The input value is blank" + assert info.value.args[0] == self.input_value_blank_msg with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.insert_row(0, "", "") - assert info.value.args[0] == "The input value is blank" + assert info.value.args[0] == self.input_value_blank_msg design.transmission_zeros_bandwidth.insert_row(0, "1600M") assert design.transmission_zeros_bandwidth.row(0) == ("1600M", "") design.transmission_zeros_bandwidth.insert_row(0, zero="1600M", position="2") @@ -109,7 +113,7 @@ def test_remove_row(self): design.transmission_zeros_bandwidth.remove_row(0) with pytest.raises(RuntimeError) as info: design.transmission_zeros_bandwidth.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == self.no_transmission_zero_msg def test_clear_row(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) @@ -118,13 +122,13 @@ def test_clear_row(self): design.transmission_zeros_bandwidth.clear_row() with pytest.raises(RuntimeError) as info: design.transmission_zeros_bandwidth.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == self.no_transmission_zero_msg design.transmission_zeros_ratio.insert_row(0, zero="1.6", position="2") assert design.transmission_zeros_ratio.row(0) == ("1.6", "2") design.transmission_zeros_ratio.clear_row() with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == self.no_transmission_zero_msg def test_restore_default_positions(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py index 772b3fc3b91..0d213741854 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_nodes_and_leads.py @@ -35,7 +35,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_lumped_c_node_capacitor(self): diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py index 5c57781c728..c56af561f4d 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_parasitics.py @@ -33,7 +33,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_lumped_capacitor_q(self): diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py index ddb735ce6ac..69b4d1e986d 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_termination_impedance.py @@ -33,7 +33,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_row_count(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) diff --git a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py index f5b8f4dec7c..9b10710c1fb 100644 --- a/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py +++ b/_unittest/test_45_FilterSolutions/test_lumped_filter/test_lumped_topology.py @@ -36,7 +36,7 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_lumped_generator_resistor_30(self): lumpdesign = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) diff --git a/_unittest/test_45_FilterSolutions/test_raise_error.py b/_unittest/test_45_FilterSolutions/test_raise_error.py index e1b5c0d0866..d613dcded93 100644 --- a/_unittest/test_45_FilterSolutions/test_raise_error.py +++ b/_unittest/test_45_FilterSolutions/test_raise_error.py @@ -23,6 +23,7 @@ # SOFTWARE. from _unittest.conftest import config +from _unittest.test_45_FilterSolutions.test_filter import test_transmission_zeros import pytest import pyaedt @@ -31,10 +32,10 @@ @pytest.mark.skipif(is_linux, reason="FilterSolutions API is not supported on Linux.") -@pytest.mark.skipif(config["desktopVersion"] <= "2025.1", reason="Skipped on versions earlier than 2025.1") +@pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_raise_error(self): design = pyaedt.FilterSolutions(implementation_type=FilterImplementation.LUMPED) with pytest.raises(RuntimeError) as info: design.transmission_zeros_ratio.row(0) - assert info.value.args[0] == "This filter has no transmission zero at row 0" + assert info.value.args[0] == test_transmission_zeros.TestClass.no_transmission_zero_msg diff --git a/examples/08-FilterSolutions/Lumped_Element_Response.py b/examples/08-FilterSolutions/Lumped_Element_Response.py index 0282777de7c..07941e02385 100644 --- a/examples/08-FilterSolutions/Lumped_Element_Response.py +++ b/examples/08-FilterSolutions/Lumped_Element_Response.py @@ -1,7 +1,7 @@ """ Design a lumped element filter ------------------------------ -This example shows how to use PyAEDT to use the ``FilterSolutions`` library to design and +This example shows how to use PyAEDT to use the ``FilterSolutions`` module to design and visualize the frequency response of a band-pass Butterworth filter. """ @@ -28,8 +28,8 @@ design.attributes.filter_order = 5 ############################################################################## -# Plot the frequency response of the filter. -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Plot the frequency response of the filter +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Plot the frequency response of the filter without any transmission zeros. freq, mag_db = design.ideal_response.frequency_response(FrequencyResponseColumn.MAGNITUDE_DB) @@ -45,8 +45,8 @@ def format_plot(): plt.show() ############################################################################## -# Add a transmission zero to the filter design. -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Add a transmission zero to the filter design +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Add a transmission zeros that yields nulls separated by 2 times the pass band width (1 GHz). # Plot the frequency response of the filter with the transmission zero. @@ -58,9 +58,8 @@ def format_plot(): plt.show() ############################################################################## -# Generate the netlist for the designed filter. -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Generate and print the netlist for the designed filter with the transmission zero. - +# Generate the netlist for the designed filter +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Generate and print the netlist for the designed filter with the added transmission zero to filter. netlist = design.topology.circuit_response() print("Netlist: \n", netlist) diff --git a/pyaedt/filtersolutions.py b/pyaedt/filtersolutions.py index 126fca6b1c9..fe83fbc73e7 100644 --- a/pyaedt/filtersolutions.py +++ b/pyaedt/filtersolutions.py @@ -45,15 +45,15 @@ class FilterSolutions: Parameters ---------- version: str, optional - The version of AEDT in ``xxxx.x`` format. The default is ``None``. + Version of AEDT in ``xxxx.x`` format. The default is ``None``. implementation_type: FilterImplementation, optional - The technology used to implement the filter. The default is ``LUMPED``. + Technology used to implement the filter. The default is ``LUMPED``. The ``FilterImplementation`` enum provides the list of implementations. Examples -------- - Create a ``FilterSolutions`` instance with a band pass elliptic ideal filter. + Create a ``FilterSolutions`` instance with a band-pass elliptic ideal filter. >>> import pyaedt >>> from pyaedt.filtersolutions_core.attributes import FilterImplementation diff --git a/pyaedt/filtersolutions_core/attributes.py b/pyaedt/filtersolutions_core/attributes.py index 829a42e7ffc..919a02fad63 100644 --- a/pyaedt/filtersolutions_core/attributes.py +++ b/pyaedt/filtersolutions_core/attributes.py @@ -74,8 +74,8 @@ class FilterClass(Enum): - LOW_PASS: Represents a low-pass filter. - HIGH_PASS: Represents a high-pass filter. - DIPLEXER_1: Represents a first group of diplexer filter. - - BAND_PASS: Represents a band pass filter. - - BAND_STOP: Represents a band stop filter. + - BAND_PASS: Represents a band-pass filter. + - BAND_STOP: Represents a band-stop filter. - DIPLEXER_2: Represents a second group of diplexer filter. - LOW_BAND: Represents a combined low-pass and multi-band filter. - BAND_HIGH: Represents a combined high-pass and multi-band filter. @@ -208,7 +208,7 @@ class RippleConstrictionBandSelect(Enum): class SinglePointRippleInfZeros(Enum): - """Provides an enum for either one or three non-Infinite zeros at the single frequency point to confine the ripple. + """Provides an enum for either one or three non-infinite zeros at the single frequency point to confine the ripple. **Attributes:** @@ -236,11 +236,11 @@ class PassbandDefinition(Enum): class StopbandDefinition(Enum): """Provides an enum for comparing the stop band parameter to the pass band parameter. - **ATTRIBUTES:** + **Attributes:** - - RATIO: The ratio between the stop band and pass band frequencies. - - FREQUENCY: The explicit frequency. - - ATTENUATION_DB: The attenuation in decibels. + - RATIO: Ratio between the stop band and pass band frequencies. + - FREQUENCY: Explicit frequency. + - ATTENUATION_DB: Attenuation in decibels. """ RATIO = 0 @@ -581,7 +581,7 @@ def filter_class(self, filter_class: FilterClass): @property def filter_implementation(self) -> FilterImplementation: - """Technology used to implement the filter. The default is ``LUMPED``. + """Technology for implementing the filter. The default is ``LUMPED``. The ``FilterImplementation`` enum provides a list of all implementations. Returns @@ -600,8 +600,11 @@ def filter_implementation(self, filter_implementation: FilterImplementation): @property def diplexer_type(self) -> DiplexerType: """Type of diplexer topology. This property is only applicable to lumped filters. - The default is ``HI_LO`` for the ``DIPLEXER_1`` filter class. - The default is ``BP_BS`` for the ``DIPLEXER_2`` filter class. + + - The default is ``HI_LO`` for the ``DIPLEXER_1`` filter class. + + - The default is ``BP_BS`` for the ``DIPLEXER_2`` filter class. + The ``DiplexerType`` enum provides a full list of diplexer types. Returns @@ -1327,7 +1330,7 @@ def gaussian_bessel_reflection(self, column: GaussianBesselReflection): @property def even_order(self) -> bool: - """Flag indicating if the even order mode for filter with even orders is enabled. + """Flag indicating if the even order mode for a filter with even orders is enabled. Returns ------- @@ -1345,7 +1348,7 @@ def even_order(self, even_order: bool): @property def even_order_refl_zero(self) -> bool: - """Flag indicating if the even order reflection zeros to 0 is enabled. + """Flag indicating if the even order reflection zeros translation to 0 is enabled. Returns ------- @@ -1363,7 +1366,7 @@ def even_order_refl_zero(self, even_order_refl_zero: bool): @property def even_order_trn_zero(self) -> bool: - """Flag indicating if the even order reflection zeros to infinite is enabled. + """Flag indicating if the even order reflection zeros translation to infinite is enabled. Returns ------- @@ -1435,7 +1438,7 @@ def half_band_ripple(self, half_band_ripple: bool): @property def constrict_ripple_percent(self) -> str: """Filter ripple constriction percentage. - The default is ''False''. + The default is ''50%''. Returns ------- @@ -1485,7 +1488,7 @@ def single_point_ripple_inf_zeros(self, single_point_ripple_inf_zeros: SinglePoi @property def delay_equalizer(self) -> bool: - """Flag indicating if the delay equalizer enabled. + """Flag indicating if the delay equalizer is enabled. Returns ------- @@ -1521,7 +1524,7 @@ def delay_equalizer_order(self, delay_equalizer_order: int): @property def standard_delay_equ_pass_band_attenuation(self) -> bool: - """Flag indicating if the standard delay equalizer attenuation enabled. + """Flag indicating if the standard delay equalizer attenuation is enabled. Returns ------- diff --git a/pyaedt/filtersolutions_core/dll_interface.py b/pyaedt/filtersolutions_core/dll_interface.py index 509243d5f8a..5d761f7f0df 100644 --- a/pyaedt/filtersolutions_core/dll_interface.py +++ b/pyaedt/filtersolutions_core/dll_interface.py @@ -49,17 +49,19 @@ def _init_dll_path(self, version): """Set DLL path and print the status of the DLL access to the screen.""" latest_version = current_version() if latest_version == "": - raise Exception("AEDT is not installed on your system. Install AEDT version 2025 R1 or higher.") + raise Exception("AEDT is not installed on your system. Install AEDT 2025 R1 or later.") if version is None: version = latest_version if float(version[0:6]) < 2025: - raise ValueError("PyAEDT supports AEDT version 2025 R1 and later. Recommended version is 2025 R1 or later.") + raise ValueError( + "FilterSolutions supports AEDT version 2025 R1 and later. Recommended version is 2025 R1 or later." + ) if not (version in installed_versions()) and not (version + "CL" in installed_versions()): raise ValueError("Specified version {} is not installed on your system".format(version[0:6])) self.dll_path = os.path.join(installed_versions()[version], "nuhertz/FilterSolutionsAPI.dll") print("DLL Path:", self.dll_path) if not os.path.isfile(self.dll_path): - raise RuntimeError(f"The 'FilterSolution' API DLL was not found at {self.dll_path}.") # pragma: no cover + raise RuntimeError(f"The 'FilterSolutions' API DLL was not found at {self.dll_path}.") # pragma: no cover self.version = version def _init_dll(self, show_gui): @@ -71,8 +73,8 @@ def _init_dll(self, show_gui): if show_gui: # pragma: no cover self._app_thread = threading.Thread(target=self._app_thread_task) self._app_thread.start() - # TODO: Need some way to confirm that the GUI has completed initialization, - # otherwise some subsequent API calls will fail. For now, sleep a few seconds. + # TODO: Need some way to confirm that the GUI has completed initialization. + # Otherwise some subsequent API calls will fail. For now, sleep a few seconds. time.sleep(5) else: status = self._dll.startApplication(False) @@ -111,7 +113,7 @@ def get_string(self, dll_function: Callable, max_size=100) -> str: Returns -------- str - The return value of the called DLL function. + Return value of the called DLL function. """ text_buffer = ctypes.create_string_buffer(max_size) status = dll_function(text_buffer, max_size) @@ -136,12 +138,12 @@ def set_string(self, dll_function: Callable, string: str): def string_to_enum(self, enum_type: Enum, string: str) -> Enum: """ - Convert string to a string defined by an enum. + Convert a string to a string defined by an enum. Parameters ---------- enum_type: Enum - Type of Enum to convert. + Type of enum to convert. string: str String to convert. @@ -172,7 +174,7 @@ def enum_to_string(self, enum_value: Enum) -> str: def api_version(self) -> str: """ - Return the version of API. + Get the version of the API. Returns ------- diff --git a/pyaedt/filtersolutions_core/graph_setup.py b/pyaedt/filtersolutions_core/graph_setup.py index 58039d738a4..7c0ffda0cc0 100644 --- a/pyaedt/filtersolutions_core/graph_setup.py +++ b/pyaedt/filtersolutions_core/graph_setup.py @@ -29,7 +29,7 @@ class GraphSetup: - """Defines the frequency and time limits of the exported responses""" + """Defines the frequency and time limits of the exported responses.""" def __init__(self): self._dll = pyaedt.filtersolutions_core._dll_interface()._dll @@ -60,7 +60,7 @@ def _define_graph_dll_functions(self): @property def minimum_frequency(self) -> str: - """Minimum frequency value for exporting frequency and S parameters responses. The default is ``200 MHz``. + """Minimum frequency value for exporting frequency and S parameter responses. The default is ``200 MHz``. Returns ------- diff --git a/pyaedt/filtersolutions_core/ideal_response.py b/pyaedt/filtersolutions_core/ideal_response.py index e4394d08c7f..81c2a9f5272 100644 --- a/pyaedt/filtersolutions_core/ideal_response.py +++ b/pyaedt/filtersolutions_core/ideal_response.py @@ -38,17 +38,18 @@ class FrequencyResponseColumn(Enum): """Provides an enum of frequency response parameters. - Attributes: - MAGNITUDE_DB: Represents the frequency response magnitude in dB. - PHASE_DEG: Represents the frequency response phase in degree. - GROUP_DELAY: Represents the frequency response group delay. - PHASE_RAD: Represents the frequency response phase in radian. - MAGNITUDE_ARITH: Represents the frequency response magnitude. - MAGNITUDE_REAL: Represents the real part of frequency response magnitude . - MAGNITUDE_IMAG: Represents the imaginary part of frequency response magnitude. - PHASE_DEV_DEG: Represents the frequency response phase deviation in degree. - PHASE_DEV_RAD: Represents the frequency response phase deviation in radian. - FREQUENCY: Represents the frequency response frequency parameter. + **Attributes:** + + - MAGNITUDE_DB: Represents the frequency response magnitude in dB. + - PHASE_DEG: Represents the frequency response phase in degree. + - GROUP_DELAY: Represents the frequency response group delay. + - PHASE_RAD: Represents the frequency response phase in radian. + - MAGNITUDE_ARITH: Represents the frequency response magnitude. + - MAGNITUDE_REAL: Represents the real part of frequency response magnitude. + - MAGNITUDE_IMAG: Represents the imaginary part of frequency response magnitude. + - PHASE_DEV_DEG: Represents the frequency response phase deviation in degrees. + - PHASE_DEV_RAD: Represents the frequency response phase deviation in radian. + - FREQUENCY: Represents frequency parameter of the frequency response . """ MAGNITUDE_DB = 0 @@ -66,14 +67,15 @@ class FrequencyResponseColumn(Enum): class TimeResponseColumn(Enum): """Provides an enum of time response parameters. - Attributes: - STEP_RESPONSE: Represents the step time response. - RAMP_RESPONSE: Represents the ramp time response. - IMPULSE_RESPONSE: Represents the impulse time response. - STEP_RESPONSE_DB: Represents the step time response in dB. - RAMP_RESPONSE_DB: Represents the ramp time response in dB. - IMPULSE_RESPONSE_DB: Represents the impulse time response in dB. - TIME: Represents time response the time parameter. + **Attributes:** + + - STEP_RESPONSE: Represents the step time response. + - RAMP_RESPONSE: Represents the ramp time response. + - IMPULSE_RESPONSE: Represents the impulse time response. + - STEP_RESPONSE_DB: Represents the step time response in dB. + - RAMP_RESPONSE_DB: Represents the ramp time response in dB. + - IMPULSE_RESPONSE_DB: Represents the impulse time response in dB. + - TIME: Represents time parameter of the time response . """ STEP_RESPONSE = 0 @@ -88,12 +90,13 @@ class TimeResponseColumn(Enum): class SParametersResponseColumn(Enum): """Provides an enum of S parameters. - Attributes: - S21_DB: Represents the S21 parameter in dB. - S11_DB: Represents the S11 parameter in dB. - S21_ARITH: Represents the S21 parameter. - S11_ARITH: Represents the S11 parameter. - FREQUENCY: Represents the S parameters frequency parameter. + **Attributes:** + + - S21_DB: Represents the S21 parameter in dB. + - S11_DB: Represents the S11 parameter in dB. + - S21_ARITH: Represents the S21 parameter. + - S11_ARITH: Represents the S11 parameter. + - FREQUENCY: Represents the S parameters' frequency parameter. """ S21_DB = 0 @@ -106,23 +109,24 @@ class SParametersResponseColumn(Enum): class PoleZerosResponseColumn(Enum): """Provides an enum of pole zero x and y coordinates of transmission (TX) or reflection (RX) zeros. - Attributes: - TX_ZERO_DEN_X: Represents the x coordinate of filter transmission zero denominator. - TX_ZERO_DEN_Y: Represents the y coordinate of filter transmission zero denominator. - PROTO_TX_ZERO_DEN_X: Represents the x coordinate of prototype filter transmission zero denominator. - PROTO_TX_ZERO_DEN_Y: Represents the y coordinate of prototype filter transmission zero denominator. - TX_ZERO_NUM_X: Represents the x coordinate of filter transmission zero numerator. - TX_ZERO_NUM_Y: Represents the y coordinate of filter transmission zero numerator. - PROTO_TX_ZERO_NUM_X: Represents the x coordinate of prototype filter transmission zero numerator. - PROTO_TX_ZERO_NUM_Y: Represents the y coordinate of prototype filter transmission zero numerator. - RX_ZERO_DEN_X: Represents the x coordinate of filter reflection zero denominator. - RX_ZERO_DEN_Y: Represents the y coordinate of filter reflection zero denominator. - PROTO_RX_ZERO_DEN_X: Represents the x coordinate of prototype filter reflection zero denominator. - PROTO_RX_ZERO_DEN_Y: Represents the y coordinate of prototype filter reflection zero denominator. - RX_ZERO_NUM_X: Represents the x coordinate of filter reflection zero numerator. - RX_ZERO_NUM_Y: Represents the y coordinate of filter reflection zero numerator. - PROTO_RX_ZERO_NUM_X: Represents the x coordinate of prototype filter reflection zero numerator. - PROTO_RX_ZERO_NUM_Y: Represents the y coordinate of prototype filter reflection zero numerator. + **Attributes:** + + - TX_ZERO_DEN_X: Represents the x coordinate of the filter transmission zero denominator. + - TX_ZERO_DEN_Y: Represents the y coordinate of the filter transmission zero denominator. + - PROTO_TX_ZERO_DEN_X: Represents the x coordinate of the prototype filter transmission zero denominator. + - PROTO_TX_ZERO_DEN_Y: Represents the y coordinate of the prototype filter transmission zero denominator. + - TX_ZERO_NUM_X: Represents the x coordinate of the filter transmission zero numerator. + - TX_ZERO_NUM_Y: Represents the y coordinate of the filter transmission zero numerator. + - PROTO_TX_ZERO_NUM_X: Represents the x coordinate of the prototype filter transmission zero numerator. + - PROTO_TX_ZERO_NUM_Y: Represents the y coordinate of the prototype filter transmission zero numerator. + - RX_ZERO_DEN_X: Represents the x coordinate of the filter reflection zero denominator. + - RX_ZERO_DEN_Y: Represents the y coordinate of the filter reflection zero denominator. + - PROTO_RX_ZERO_DEN_X: Represents the x coordinate of the prototype filter reflection zero denominator. + - PROTO_RX_ZERO_DEN_Y: Represents the y coordinate of the prototype filter reflection zero denominator. + - RX_ZERO_NUM_X: Represents the x coordinate of the filter reflection zero numerator. + - RX_ZERO_NUM_Y: Represents the y coordinate of the filter reflection zero numerator. + - PROTO_RX_ZERO_NUM_X: Represents the x coordinate of the prototype filter reflection zero numerator. + - PROTO_RX_ZERO_NUM_Y: Represents the y coordinate of the prototype filter reflection zero numerator. """ TX_ZERO_DEN_X = 0 @@ -145,7 +149,9 @@ class PoleZerosResponseColumn(Enum): class IdealResponse: """Returns the data for available ideal filter responses. - Includes ``frequency``, ``time``, ``S parameters``, ``transfer function``, or ``pole zero location`` responses. + + Types of responses Include ``frequency``, ``time``, ``S parameters``, ``transfer function``, + and ``pole zero location``. This class allows you to construct all the necessary ideal response attributes for the ``FilterDesign`` class. """ @@ -193,17 +199,17 @@ def _define_response_dll_functions(self): self._dll.getVSGAnalsyis.restype = c_int def _frequency_response_getter(self, column: FrequencyResponseColumn): - """Return the ideal filter frequency response. + """Get the ideal filter frequency response. Parameters ---------- column: `FrequencyResponseColumn` - Parameter to return. + Frequency response column to get. Returns ------- list - The values for the requested frequency response column (e.g., magnitude, phase, etc.). + List of values for the requested frequency response column (such as magnitude or phase). """ size = c_int() status = self._dll.getIdealFrequencyResponseSize(byref(size)) @@ -215,17 +221,17 @@ def _frequency_response_getter(self, column: FrequencyResponseColumn): return values def _time_response_getter(self, column: TimeResponseColumn): - """Return the ideal filter time response. + """Get the ideal filter time response. Parameters ---------- column: `TimeResponseColumn` - Parameter to return. + Time response column to get. Returns ------- list - The values for the requested time response column (e.g., step, pulse, etc.). + List of values for the requested time response column (such as step or pulse). """ size = c_int() status = self._dll.getIdealTimeResponseSize(byref(size)) @@ -237,17 +243,17 @@ def _time_response_getter(self, column: TimeResponseColumn): return values def _sparamaters_response_getter(self, column: SParametersResponseColumn): - """Return the ideal filter S parameters response. + """Get the ideal filter S parameter's response. Parameters ---------- column: `SParametersResponseColumn` - Parameter to return. + S parameter's response column to get. Returns ------- list - The values for the requested S parameters response column (e.g., S11, S21, etc.). + List of values for the requested S parameter's response column (such as S11 or S21). """ size = c_int() status = self._dll.getIdealSParamatersResponseSize(byref(size)) @@ -259,18 +265,18 @@ def _sparamaters_response_getter(self, column: SParametersResponseColumn): return values def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): - """Return ideal pole zero location parameters (e.g., x coordinate of - the denominator of transmission zeros, etc.). + """Get the ideal pole zero's location parameters (such as the x coordinate of + the denominator of transmission zeros). Parameters ---------- column: `PoleZerosResponseColumn` - Parameter to return. + Pole zero's response column to get. Returns ------- list - The values for the requested pole zero column. + List of values for the requested pole zero's response column. """ size = c_int() status = self._dll.getIdealPoleZerosResponseSize(byref(size), column.value) @@ -282,18 +288,17 @@ def _pole_zeros_response_getter(self, column: PoleZerosResponseColumn): return values def transfer_function_response(self): - """Return ideal filter transfer function parameters. + """Get the ideal filter transfer function's parameters. Returns ------- str - The requested parameter array. - + Requested parameter array. str Multi-line string where each line contains a coefficient from the numerator and/or the denominator of the transfer function. - The coefficient for the highest-order term is first and the terms are in decreasing order. + The coefficient for the highest-order term is first, and the terms are in decreasing order. """ size = c_int() status = self._dll.getIdealTransferFunctionResponseSize(byref(size)) @@ -329,12 +334,12 @@ def frequency_response( maximum_frequency="5 GHz", vsg_analysis_enabled=False, ): - """Return the ideal filter frequency response for the given parameters. + """Get the ideal filter frequency response for the given parameters. Parameters ---------- y_axis_parameter: `FrequencyResponseColumn`, optional - Parameter to return. The default is frequency response magnitude in dB. + Frequency response column to return. The default is the frequency response magnitude in dB. minimum_frequency: str, optional The default is ``200 MHz``. maximum_frequency: str, optional @@ -344,11 +349,10 @@ def frequency_response( Returns ------- - tuple: The tuple contains - list of str: - The defined frequency range. - list of str: - The requested parameter. + tuple + The tuple contains two lists of strings. The first is a list + of the defined frequency ranges, and the second is a + list of the requested parameters. """ self.graph_setup.minimum_frequency = minimum_frequency self.graph_setup.maximum_frequency = maximum_frequency @@ -367,12 +371,12 @@ def time_response( maximum_time="10 ns", vsg_analysis_enabled=False, ): - """Return the ideal filter time response for the given parameters. + """Get the ideal filter time response for the given parameters. Parameters ---------- y_axis_parameter: `TimeResponseColumn`, optional - Parameter to return. The default is step time response. + Time response column to get. The default is the step time response. minimum_time: str, optional The default is ``0 s``. maximum_time: str, optional @@ -382,11 +386,10 @@ def time_response( Returns ------- - tuple: The tuple contains - list of str: - The defined range range. - list of str: - The requested parameter. + tuple + The tuple contains two lists of strings. The first is a list + of the defined time ranges, and the second is a + list of the requested parameters. """ self.graph_setup.minimum_time = minimum_time self.graph_setup.maximum_time = maximum_time @@ -401,12 +404,12 @@ def s_parameters( minimum_frequency="200 MHz", maximum_frequency="5 GHz", ): - """Return the ideal filter S parameters response for the given parameters. + """Get the ideal filter S parameters response for the given parameters. Parameters ---------- y_axis_parameter: `SParametersResponseColumn`, optional - Parameter to return. The default is S21 parameter response in dB. + S parameter's response column to get. The default is the S21 parameter response in dB. minimum_frequency: str, optional The default is ``200 MHz``. maximum_frequency: str, optional @@ -416,11 +419,10 @@ def s_parameters( Returns ------- - tuple: The tuple contains - list of str: - The defined frequency range. - list of str: - The requested parameter. + tuple + The tuple contains two lists of strings. The first is a list + of the defined frequency ranges, and the second is a + list of the requested parameters. """ self.graph_setup.minimum_frequency = minimum_frequency self.graph_setup.maximum_frequency = maximum_frequency @@ -436,22 +438,23 @@ def pole_zero_locations( x_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_X, y_axis_parameter=PoleZerosResponseColumn.TX_ZERO_DEN_Y, ): - """Return the ideal pole zero location for the given parameters. + """Get the ideal pole zero location for the given parameters. Parameters ---------- x_axis_parameter: `PoleZerosResponseColumn`, optional - Parameter to return. The default is x coordinate of filter transmission zero denominator. + X axis parameter of the pole zeros response column to get. The default is the x coordinate + of the filter transmission zero denominator. y_axis_parameter: `PoleZerosResponseColumn`, optional - Parameter to return. The default is y coordinate of filter transmission zero denominator. + Y axis parameter of the pole zeros response column to get. The default is the y coordinate + of the filter transmission zero denominator. Returns ------- - tuple: The tuple contains - list of str: - The x coordinates of the requested parameter. - list of str: - The y coordinates of the requested parameter. + tuple + The tuple contains two lists of strings. The first is a list + of the x coordinates of the requested parameter, and the second is a + list of the y coordinates of the requested parameter. """ x_parameter = self._pole_zeros_response_getter(x_axis_parameter) y_parameter = self._pole_zeros_response_getter(y_axis_parameter) diff --git a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py index 45f3353e77a..9a04d2ba764 100644 --- a/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py +++ b/pyaedt/filtersolutions_core/lumped_nodes_and_leads.py @@ -32,10 +32,10 @@ class LumpedNodesandLeads: - """Defines attributes of lumped element node capacitor and lead inductor. + """Defines attributes of the lumped element node capacitors and lead inductors. - This class allows you to construct all the necessary node capacitor and - lead inductor attributes of lumped elements for the LumpedDesign class. + This class lets you to construct all the necessary node capacitors and + lead inductors attributes of the lumped elements for the ``LumpedDesign`` class. """ def __init__(self): @@ -87,7 +87,7 @@ def _define_nodes_and_leads_dll_functions(self): @property def c_node_capacitor(self) -> str: - """Shunt capacitance assigned to each capacitor node + """Shunt capacitance assigned to each capacitor node. The default is ``0``. Returns @@ -103,7 +103,7 @@ def c_node_capacitor(self, c_node_capacitor): @property def c_lead_inductor(self) -> str: - """Series inductance assigned to each capacitor lead + """Series inductance assigned to each capacitor lead. The default is ``0``. Returns @@ -119,7 +119,7 @@ def c_lead_inductor(self, c_lead_inductor): @property def l_node_capacitor(self) -> str: - """Shunt capacitance assigned to each inductor node + """Shunt capacitance assigned to each inductor node. The default is` ``0``. Returns @@ -135,7 +135,7 @@ def l_node_capacitor(self, l_node_capacitor): @property def l_lead_inductor(self) -> str: - """Series inductance assigned to each inductor lead + """Series inductance assigned to each inductor lead. The default is ``0``. Returns @@ -151,7 +151,7 @@ def l_lead_inductor(self, l_lead_inductor): @property def r_node_capacitor(self) -> str: - """Shunt capacitance assigned to each resistor node + """Shunt capacitance assigned to each resistor node. The default is ``0``. Returns @@ -167,7 +167,7 @@ def r_node_capacitor(self, r_node_capacitor): @property def r_lead_inductor(self) -> str: - """Series inductance assigned to each resistor lead + """Series inductance assigned to each resistor lead. The default is ``0``. Returns @@ -183,8 +183,7 @@ def r_lead_inductor(self, r_lead_inductor): @property def c_node_compensate(self) -> bool: - """Flag indicating if the capacitor values may be adjusted - in an attempt to compensate for node capacitance is enabled. + """Flag indicating if the adjusting capacitor values to compensate for node capacitance is enabled. Returns ------- @@ -202,8 +201,7 @@ def c_node_compensate(self, c_node_compensate: bool): @property def l_node_compensate(self) -> bool: - """Flag indicating if the inductor values may be adjusted - in an attempt to compensate for lead inductance is enabled. + """Flag indicating if the adjusting inductor values to compensate for lead inductance is enabled. Returns ------- diff --git a/pyaedt/filtersolutions_core/lumped_parasitics.py b/pyaedt/filtersolutions_core/lumped_parasitics.py index 4707ecb35d8..b876ea59b15 100644 --- a/pyaedt/filtersolutions_core/lumped_parasitics.py +++ b/pyaedt/filtersolutions_core/lumped_parasitics.py @@ -29,10 +29,10 @@ class LumpedParasitics: - """Defines attributes of lumped element parasitics. + """Defines attributes of the lumped element parasitics. - This class allows you to construct all the necessary parasitic - attributes of lumped elements for the LumpedDesign class. + This class lets you to construct all the necessary parasitic + attributes of lumped elements for the ``LumpedDesign`` class. """ def __init__(self): @@ -84,7 +84,7 @@ def _define_parasitics_dll_functions(self): @property def capacitor_q(self) -> str: - """Q factor value of non ideal capacitors in synthesized circuit + """Q factor value of non-ideal capacitors in the synthesized circuit. The default is ``infinite``. Returns @@ -100,7 +100,7 @@ def capacitor_q(self, capacitor_q_string): @property def capacitor_rs(self) -> str: - """Series resistor value of non ideal capacitors in synthesized circuit + """Series resistor value of non-ideal capacitors in the synthesized circuit. The default is ``0``. Returns @@ -116,7 +116,7 @@ def capacitor_rs(self, capacitor_rs_string): @property def capacitor_rp(self) -> str: - """Shunt resistor value of non ideal capacitors in synthesized circuit + """Shunt resistor value of non-ideal capacitors in the synthesized circuit. The default is ``infinite``. Returns @@ -132,7 +132,7 @@ def capacitor_rp(self, capacitor_rp_string): @property def capacitor_ls(self) -> str: - """Series inductance value of non ideal capacitors in synthesized circuit + """Series inductance value of non-ideal capacitors in the synthesized circuit. The default is ``0``. Returns @@ -148,7 +148,7 @@ def capacitor_ls(self, capacitor_ls_string): @property def inductor_q(self) -> str: - """Q factor value of non ideal inductors in synthesized circuit + """Q factor value of non-ideal inductors in the synthesized circuit. The default is ``infinite``. Returns @@ -164,7 +164,7 @@ def inductor_q(self, inductor_q_string): @property def inductor_rs(self) -> str: - """Series resistor value of non ideal inductors in synthesized circuit + """Series resistor value of non-ideal inductors in the synthesized circuit. The default is` ``0``. Returns @@ -180,7 +180,7 @@ def inductor_rs(self, inductor_rs_string): @property def inductor_rp(self) -> str: - """Shunt resistor value of non ideal inductors in synthesized circuit + """Shunt resistor value of non-ideal inductors in the synthesized circuit. The default is ``infinite``. Returns @@ -196,7 +196,7 @@ def inductor_rp(self, inductor_rp_string): @property def inductor_cp(self) -> str: - """Shunt capacitor value of non ideal inductors in synthesized circuit + """Shunt capacitor value of non-ideal inductors in the synthesized circuit. The default is ``0``. Returns diff --git a/pyaedt/filtersolutions_core/lumped_termination_impedance.py b/pyaedt/filtersolutions_core/lumped_termination_impedance.py index 92972761646..083c214511c 100644 --- a/pyaedt/filtersolutions_core/lumped_termination_impedance.py +++ b/pyaedt/filtersolutions_core/lumped_termination_impedance.py @@ -35,11 +35,13 @@ class ComplexTerminationDefinition(Enum): """Selects type of complex presentation. - Attributes: - POLAR: Represents polar definition. - CARTESIAN: Represents Cartesian definition. - PARALLEL: Represents parallel definition with real entry parallel to imaginary entry. - REAL: Represents only real impedance definition. + + **Attributes:** + + - POLAR: Represents polar definition. + - CARTESIAN: Represents Cartesian definition. + - PARALLEL: Represents parallel definition with real entry parallel to imaginary entry. + - REAL: Represents only real impedance definition. """ POLAR = 0 @@ -51,10 +53,11 @@ class ComplexTerminationDefinition(Enum): class ComplexReactanceType(Enum): """Selects type of complex impedance as reactance, equivalent inductance, or equivalent capacitance. - Attributes: - REAC: Represents pure reactance of complex impedance. - IND: Represents equivalent inductance in henries. - CAP: Represents equivalent capacitance in farads. + **Attributes:** + + - REAC: Represents pure reactance of complex impedance. + - IND: Represents equivalent inductance in henries. + - CAP: Represents equivalent capacitance in farads. """ REAC = 0 @@ -65,9 +68,10 @@ class ComplexReactanceType(Enum): class TerminationType(Enum): """Selects either source or load complex impedance table. - Attributes: - SOURCE: Represents source impedenace table. - LOAD: Represents load impedenace table. + **Attributes:** + + - SOURCE: Represents source impedenace table. + - LOAD: Represents load impedenace table. """ SOURCE = 0 @@ -75,9 +79,9 @@ class TerminationType(Enum): class LumpedTerminationImpedance: - """Manipulates access to the entries of source and load complex impedance tables. + """Manipulates access to the entries of source and load complex impedance table. - This class allows you to enter, edit or remove the entries of source and load complex impedance tables. + This class allows you to enter, edit, or remove the entries of source and load complex impedance table. """ def __init__(self, table_type): @@ -154,7 +158,7 @@ def _define_termination_impedance_dll_functions(self): self._dll.getLumpedComplexCompOrder.restype = c_int def table_type_to_bool(self): - """Set a flag to recognize source and load complex tables. + """Set a flag to recognize source and load complex table. Returns ------- @@ -167,7 +171,7 @@ def table_type_to_bool(self): @property def row_count(self) -> int: - """The count of accumulated complex impedances in the complex impedances tables. + """Count of the accumulated complex impedances in the complex impedances's table. The default is ``3``. Returns @@ -180,22 +184,19 @@ def row_count(self) -> int: return int(table_row_count.value) def row(self, row_index): - """Return frequencies and complex impedances at given index of the complex impedances tables. + """Get frequency and complex impedance values from a row in the complex impedance table. Parameters ---------- row_index: int - The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + Row index on complex impedance table, starting at ``0`` and with a maximum value of ``99``. Returns ------- - tuple: The tuple contains - str: - Frequency value. - str: - First term of the complex impedances. - str: - Second term of the complex impedances. + tuple + The tuple contains three strings. The first is the frequency value, + the second is the real part of the complex impedance, + and the third is the imaginary part of the complex impedance. """ frequency_value_buffer = create_string_buffer(100) real_value_buffer = create_string_buffer(100) @@ -215,20 +216,18 @@ def row(self, row_index): return frequency_value_string, real_value_string, imag_value_string def update_row(self, row_index, frequency="", real="", imag=""): - """Update frequencies and complex impedances at given index of the complex impedances tables. + """Update frequency and complex impedance at a specified index in the complex impedance table. Parameters ---------- row_index: int - The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + Row index on complex impedance table, starting at ``0`` and with a maximum value of ``99``. frequency: str, optional - The default is blank. + The frequency value to update. If not specified, it remains unchanged. real: str, optional - First term of the complex impedances. - The default is blank. + The real part of the complex impedance to update. If not specified, it remains unchanged. imag: str, optional - Second term of the complex impedances. - The default is blank. + The imaginary part of the complex impedance to update. If not specified, it remains unchanged. """ frequency_bytes_value = bytes(frequency, "ascii") real_bytes_value = bytes(real, "ascii") @@ -243,15 +242,18 @@ def update_row(self, row_index, frequency="", real="", imag=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, frequency, real, imag): - """Append frequencies and complex impedances at the end row of the source and load complex tables. + """Append frequency and complex impedance values to the last row of + both the source and load complex impedance table. + Parameters ---------- frequency: str + The frequency value to append. real: str - First term of the complex impedances. + The real part of the complex impedance to append. imag: str - Second term of the complex impedances. + The imaginary part of the complex impedance to append. """ frequency_bytes_value = bytes(frequency, "ascii") real_bytes_value = bytes(real, "ascii") @@ -265,17 +267,18 @@ def append_row(self, frequency, real, imag): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, frequency, real, imag): - """Insert frequencies and complex impedances at given index of the complex impedances tables. + """Insert frequency and complex impedance values at a specified index in the complex impedance table. Parameters ---------- - row_index: int - The row index on complex impedances tables. Starting value is 0 and maximum value is 99. - frequency: str - real: str - First term of the complex impedances. - imag: str - Second term of the complex impedances. + row_index : int + Row index in the complex impedance table, starting at ``0`` and with a maximum value of ``99``. + frequency : str + The frequency value to insert. + real : str + The real part of the complex impedance to insert. + imag : str + The imaginary part of the complex impedance to insert. """ frequency_bytes_value = bytes(frequency, "ascii") real_bytes_value = bytes(real, "ascii") @@ -290,19 +293,19 @@ def insert_row(self, row_index, frequency, real, imag): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): - """Remove frequencies and complex impedances at given indexof the complex impedances tables. + """Remove frequency and complex impedance at a specified index from the complex impedance table. Parameters ---------- - row_index: int - The row index on complex impedances tables. Starting value is 0 and maximum value is 99. + row_index : int + Row index in the complex impedance table, starting at ``0`` and with a maximum value of ``99``. """ status = self._dll.removeComplexTableRow(row_index, self.table_type_to_bool()) pyaedt.filtersolutions_core._dll_interface().raise_error(status) @property def complex_definition(self) -> ComplexTerminationDefinition: - """The definition type of complex impedances in the complex impedance tables. + """Definition type of complex impedance in the complex impedance table. The default is ``Cartesian``. Returns @@ -328,7 +331,7 @@ def complex_definition(self, complex_definition: ComplexTerminationDefinition): @property def reactance_type(self) -> ComplexReactanceType: - """The reactance type of complex impedances in the complex impedance tables. + """Reactance type of complex impedance in the complex impedance table. The default is ``reactance``. Returns @@ -355,7 +358,7 @@ def reactance_type(self, reactance_type: ComplexReactanceType): @property def compensation_enabled(self) -> bool: - """Flag indicating if the impedance compnesation is enabled. + """Flag indicating if the impedance compensation is enabled. Returns ------- @@ -373,7 +376,7 @@ def compensation_enabled(self, compensation_enabled: bool): @property def compensation_order(self) -> int: - """The order of impedance compnesation. + """Order of impedance compensation. The default is` ``2``. Returns diff --git a/pyaedt/filtersolutions_core/lumped_topology.py b/pyaedt/filtersolutions_core/lumped_topology.py index 1d32f4d4c2a..cc5c3956e8f 100644 --- a/pyaedt/filtersolutions_core/lumped_topology.py +++ b/pyaedt/filtersolutions_core/lumped_topology.py @@ -34,7 +34,7 @@ class LumpedTopology: """Defines attributes and parameters of lumped filters. - This class allows you to construct all the necessary attributes for the LumpedDesign class. + This class lets you construct all the necessary attributes for the ``LumpedDesign`` class. """ def __init__(self): @@ -186,7 +186,7 @@ def load_resistor(self, load_resistor_string): @property def current_source(self) -> bool: - """Flag indicating if the current source in synthesized circuit is enabled. + """Flag indicating if the current source in the synthesized circuit is enabled. Returns ------- @@ -204,8 +204,8 @@ def current_source(self, current_source: bool): @property def first_shunt(self) -> bool: - """Flag indicating if shunt element(s) are first in the synthesized circuit. - If ``False``, series element(s) are first. + """Flag indicating if shunt elements are first in the synthesized circuit. + If ``False``, series elements are first. Returns ------- @@ -223,7 +223,7 @@ def first_shunt(self, first_shunt: bool): @property def bridge_t(self) -> bool: - """Flag indicating if the bridgeT topology in synthesized circuit is enabled. + """Flag indicating if the bridgeT topology in the synthesized circuit is enabled. Returns ------- @@ -241,7 +241,7 @@ def bridge_t(self, bridge_t: bool): @property def bridge_t_low(self) -> bool: - """Flag indicating if the bridgeT topology for lower frequency band in synthesized circuit is enabled. + """Flag indicating if the bridgeT topology for the lower frequency band in the synthesized circuit is enabled. Returns ------- @@ -259,7 +259,7 @@ def bridge_t_low(self, bridge_t_low: bool): @property def bridge_t_high(self) -> bool: - """Flag indicating if the bridgeT topology for higher frequency band in synthesized circuit is enabled. + """Flag indicating if the bridgeT topology for the higher frequency band in the synthesized circuit is enabled. Returns ------- @@ -277,7 +277,7 @@ def bridge_t_high(self, bridge_t_high: bool): @property def equal_inductors(self) -> bool: - """Flag indicating if the equal inductors topology in synthesized circuit is enabled. + """Flag indicating if the equal inductors topology in the synthesized circuit is enabled. Returns ------- @@ -295,7 +295,7 @@ def equal_inductors(self, equal_inductors: bool): @property def equal_capacitors(self) -> bool: - """Flag indicating if the equal capacitors topology in synthesized circuit is enabled. + """Flag indicating if the equal capacitors topology in the synthesized circuit is enabled. Returns ------- @@ -313,7 +313,7 @@ def equal_capacitors(self, equal_capacitors: bool): @property def equal_legs(self) -> bool: - """Flag indicating if the equal pairs shunt or series legs topology in synthesized circuit is enabled. + """Flag indicating if the equal pairs shunt or series legs topology in the synthesized circuit is enabled. Returns ------- @@ -331,7 +331,7 @@ def equal_legs(self, equal_legs: bool): @property def high_low_pass(self) -> bool: - """Flag indicating if the high and low pass topology in synthesized circuit is enabled. + """Flag indicating if the high and low pass topology in the synthesized circuit is enabled. Returns ------- @@ -349,7 +349,8 @@ def high_low_pass(self, high_low_pass: bool): @property def high_low_pass_min_ind(self) -> bool: - """Flag indicating if the high and low pass topology with minimum inductors in synthesized circuit is enabled. + """Flag indicating if the high and low pass topology with minimum inductors + in the synthesized circuit is enabled. Returns ------- @@ -367,7 +368,7 @@ def high_low_pass_min_ind(self, high_low_pass_min_ind: bool): @property def zig_zag(self) -> bool: - """Flag indicating if the zig zag topology with minimum inductors in synthesized circuit is enabled. + """Flag indicating if the zig-zag topology with minimum inductors in the synthesized circuit is enabled. Returns ------- @@ -385,7 +386,7 @@ def zig_zag(self, zig_zag: bool): @property def min_ind(self) -> bool: - """Flag indicating if the minimum inductors topology in synthesized circuit is enabled. + """Flag indicating if the minimum inductors topology in the synthesized circuit is enabled. Returns ------- @@ -403,7 +404,7 @@ def min_ind(self, min_ind: bool): @property def min_cap(self) -> bool: - """Flag indicating if the minimum capacitors topology in synthesized circuit is enabled. + """Flag indicating if the minimum capacitors topology in the synthesized circuit is enabled. Returns ------- @@ -421,7 +422,7 @@ def min_cap(self, min_cap: bool): @property def set_source_res(self) -> bool: - """Flag indicating if the matched source resistor for zig-zag topology in synthesized circuit is enabled. + """Flag indicating if the matched source resistor for zig-zag topology in the synthesized circuit is enabled. Returns ------- @@ -439,7 +440,7 @@ def set_source_res(self, set_source_res: bool): @property def trap_topology(self) -> bool: - """Flag indicating if the trap topology in synthesized circuit is enabled. + """Flag indicating if the trap topology in the synthesized circuit is enabled. Returns ------- @@ -457,7 +458,7 @@ def trap_topology(self, trap_topology: bool): @property def node_cap_ground(self) -> bool: - """Flag indicating if the parasitic capacitors to ground topology in synthesized circuit is enabled. + """Flag indicating if the parasitic capacitors to ground topology in the synthesized circuit is enabled. Returns ------- @@ -475,7 +476,7 @@ def node_cap_ground(self, node_cap_ground: bool): @property def match_impedance(self) -> bool: - """Flag indicating if the automatic matched impedance topology in synthesized circuit is enabled. + """Flag indicating if the automatic matched impedance topology in the synthesized circuit is enabled. Returns ------- diff --git a/pyaedt/filtersolutions_core/multiple_bands_table.py b/pyaedt/filtersolutions_core/multiple_bands_table.py index 10422053160..1db8ac0d5a1 100644 --- a/pyaedt/filtersolutions_core/multiple_bands_table.py +++ b/pyaedt/filtersolutions_core/multiple_bands_table.py @@ -34,10 +34,10 @@ class MultipleBandsTable: """Manipulates access to the entries of multiple bands table. - This class allows you to enter, edit or remove the entries of multiple bands table. + This class allows you to enter, edit, or remove entries in the multiple bands table. The table includes the lower and upper frequencies of the bands. To access the multiple bands table, use the ``multiple_bands_table`` attribute of the ``FilterSolutions`` class. - A valid multiple bands table must include at both lower and upper frequencies for each band. + A valid multiple bands table must include both lower and upper frequencies for each band. """ def __init__(self): @@ -67,13 +67,13 @@ def _define_multiple_bands_dll_functions(self): @property def row_count(self) -> int: - """Retrieve the total number of rows present in the multiple bands table. + """Total number of rows present in the multiple bands table. The default is ``2``. Returns ------- int - The current number of rows in the multiple bands table. + Current number of rows in the multiple bands table. """ table_row_count = c_int() status = self._dll.getMultipleBandsTableRowCount(byref(table_row_count)) @@ -81,18 +81,19 @@ def row_count(self) -> int: return int(table_row_count.value) def row(self, row_index): - """Retrieve the lower and upper frequency values for a specified row in the multiple bands table. + """Get the lower and upper frequency values for a row in the multiple bands table. Parameters ---------- row_index: int - The index of the row from which to retrieve the frequency values. + Index of the row from to get the frequency values from. Valid values range from ``0`` to ``6``, inclusive. Returns ------- - tuple of (str, str) - A tuple containing the lower and upper frequency values as strings. + tuple + The tuple contains three strings.The first is the lower frequency value, + and the second is the upper frequency value. """ lower_value_buffer = create_string_buffer(100) @@ -104,17 +105,17 @@ def row(self, row_index): return lower_value_string, upper_value_string def update_row(self, row_index, lower_frequency="", upper_frequency=""): - """Update lower and upper frequency values for a specified row in the multiple bands table. + """Update lower and upper frequency values for a row in the multiple bands table. Parameters ---------- row_index: int - The index of the row to update, with a valid range from ``0`` to ``6`` inclusive. + Index of the row to update. Valid values range from ``0`` to ``6``, inclusive. lower_frequency: str, optional - The new lower frequency value to set for the specified row. + New lower frequency value to set for the row. If this value is not provided, the row's lower frequency remains unchanged. upper_frequency: str, optional - The new upper frequency value to set for the specified row. + New upper frequency value to set for the row. If this value is not provided, the row's upper frequency remains unchanged. """ lower_bytes_value = bytes(lower_frequency, "ascii") @@ -123,14 +124,14 @@ def update_row(self, row_index, lower_frequency="", upper_frequency=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, lower_frequency, upper_frequency): - """Appends a new row with specified lower and upper frequency values to the end of the multiple bands table. + """Append a new row with specified lower and upper frequency values to the end of the multiple bands table. Parameters ---------- lower_frequency: str - The lower frequency value to append. + Lower frequency value for the new row. upper_frequency: str - The upper frequency value to append. + Upper frequency value for the new row. """ lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") @@ -138,16 +139,16 @@ def append_row(self, lower_frequency, upper_frequency): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, lower_frequency, upper_frequency): - """Insert lower and upper frequencies at given index. + """Insert lower and upper frequencies in a given row. Parameters ---------- row_index: int - The index of the row to update, with a valid range from ``0`` to ``6`` inclusive. + Index of the row. Valid values range from ``0`` to ``6``, inclusive. lower_frequency: str - The lower frequency value to insert. + Lower frequency value to insert. upper_frequency: str - The upper frequency value to insert. + Upper frequency value to insert. """ lower_bytes_value = bytes(lower_frequency, "ascii") upper_bytes_value = bytes(upper_frequency, "ascii") diff --git a/pyaedt/filtersolutions_core/transmission_zeros.py b/pyaedt/filtersolutions_core/transmission_zeros.py index 22574aea896..2153e61db69 100644 --- a/pyaedt/filtersolutions_core/transmission_zeros.py +++ b/pyaedt/filtersolutions_core/transmission_zeros.py @@ -36,9 +36,10 @@ class TableFormat(Enum): """Enumeration of transmission zeros table. - Attributes: - RATIO: Represents transmission zeros ratio table. - BANDWIDTH: Represents transmission zeros bandwidth table. + **Attributes:** + + - RATIO: Represents transmission zeros ratio table. + - BANDWIDTH: Represents transmission zeros bandwidth table. """ RATIO = 0 @@ -46,10 +47,10 @@ class TableFormat(Enum): class TransmissionZeros: - """Manipulates access to the entries of ratio and bandwidth of tranmsission zeros table. + """Manipulates access to ratio and bandwidth entries in the tranmsission zeros table. - This class allows you to enter, edit or remove the entries of ratio and bandwidth - of tranmsission zeros table. + This class lets you to enter, edit, or remove ratio and bandwidth entries + in the tranmsission zeros table. The table includes the ratio or bandwidth and the position of the element creating the transmission zero in the associated circuit. The position of the transmission zero is the position of the element in @@ -110,8 +111,8 @@ def _define_transmission_zeros_dll_functions(self): self._dll.defaultPositionEnabled.restype = c_int def table_format_to_bool(self): - """Return a boolean value to indicate whether the entry format of - the transmission zeros tables is ratio or bandwidth. + """Check if the entry format of the transmission zeros tables is ratio. + If ``False``, the entry format is bandwidth. Returns ------- @@ -124,7 +125,7 @@ def table_format_to_bool(self): @property def row_count(self) -> int: - """The number of transmission zeros in the transmission zeros table. + """Number of transmission zeros in the transmission zeros table. The default is ``2``. Returns @@ -137,20 +138,19 @@ def row_count(self) -> int: return int(table_row_count.value) def row(self, row_index): - """Retrieve the transmission zero ratio or bandwidth and the position of the element - causing the transmission zero for a specified entry in the transmission zeros table. + """Get the transmission zero ratio or bandwidth and the position of the element + causing the transmission zero from a row in the transmission zeros table. Parameters ---------- row_index: int - The index of the row to retrieve from the transmission zeros table. - Valid values range from ``0`` to ``9``, inclusive. + Index of the row. Valid values range from ``0`` to ``9``, inclusive. Returns ------- - tuple of (str, str) - A tuple containing the transmission zero ratio or bandwidth value and the position of the element causing - the transmission zero, both as strings. + tuple + The tuple contains two strings.The first is the transmission zero ratio or bandwidth value, + and the second is the position of the element causing the transmission zero. """ zero_value_buffer = create_string_buffer(100) position_value_buffer = create_string_buffer(100) @@ -168,19 +168,18 @@ def row(self, row_index): def update_row(self, row_index, zero="", position=""): """Update the transmission zero ratio or bandwidth and its position - for a specified row in the transmission zeros table. + for a row in the transmission zeros table. Parameters ---------- row_index: int - The index of the row to update in the transmission zeros table. - Valid values range from ``0`` to ``9``, inclusive. + Index of the row. Valid values range from ``0`` to ``9``, inclusive. zero: str, optional - The new transmission zero ratio or bandwidth value to set. - If not specified, the value remains unchanged. + New transmission zero ratio or bandwidth value to set. + If no value is specified, the value remains unchanged. position: str, optional - The new position of the element causing the transmission zero in the circuit. - If not specified, the value remains unchanged. + New position of the element causing the transmission zero in the circuit. + If no value is specified, the value remains unchanged. """ zero_bytes_value = bytes(zero, "ascii") position_bytes_value = bytes(position, "ascii") @@ -193,7 +192,7 @@ def update_row(self, row_index, zero="", position=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def append_row(self, zero, position=""): - """Append a new row which includes the ratio or bandwidth and position. + """Append a new row that includes the ratio or bandwidth and position. Parameters ---------- @@ -210,12 +209,12 @@ def append_row(self, zero, position=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def insert_row(self, row_index, zero, position=""): - """Insert a new row which includes the ratio or bandwidth and position. + """Insert a new row that includes the ratio or bandwidth and the position. Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. + Index for the new row in the transmission zeros table. Valid values range from ``0`` to ``9``, inclusive. zero: str Transmission zero ratio or bandwidth value. position: str @@ -232,18 +231,18 @@ def insert_row(self, row_index, zero, position=""): pyaedt.filtersolutions_core._dll_interface().raise_error(status) def remove_row(self, row_index): - """Remove the specified row including the ratio or bandwidth and position. + """Remove a row, including the ratio or bandwidth and the position. Parameters ---------- row_index: int - The row index on transmission zeros table. Starting value is ``0`` and maximum value is ``9``. + Row index in the transmission zeros table. Valid values range from ``0`` to ``9``, inclusive. """ status = self._dll.removeTransmissionZerosTableRow(row_index, self.table_format_to_bool()) pyaedt.filtersolutions_core._dll_interface().raise_error(status) def clear_row(self): - """Clear all entries of the transmission zeros table.""" + """Clear all entries in the transmission zeros table.""" status = self._dll.clearTransmissionZerosTableRow(self.table_format_to_bool()) pyaedt.filtersolutions_core._dll_interface().raise_error(status) diff --git a/pyaedt/generic/design_types.py b/pyaedt/generic/design_types.py index ddd04a60caf..10c408acfc7 100644 --- a/pyaedt/generic/design_types.py +++ b/pyaedt/generic/design_types.py @@ -53,15 +53,15 @@ def FilterSolutions( version=None, implementation_type=None, ): - """Initializes the FilterSolutions application. + """Initialize a ``FilterSolutions` instance. Parameters ---------- version : str optional - Version of AEDT in ``xxxx.x`` format to use. The default is ``None``, in which case the + Version of AEDT to use in ``xxxx.x`` format to use. The default is ``None``, in which case the active setup or latest installed version is used. implementation_type : enum, optional - Type of filter implementation available from FilterImplementation enum. + Type of filter implementation available from the ``FilterImplementation`` enum. The default is ``None``, in which case the lumped implementation is used. Returns From 78b2fa7390d0ac5bcdcabb8a2b0cd95e256e10ae Mon Sep 17 00:00:00 2001 From: raghajaf Date: Wed, 3 Jul 2024 13:07:39 -0400 Subject: [PATCH 25/26] FEAT_Filtersolutions: API version updated. --- .../test_45_FilterSolutions/test_filter/test_dll_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py index 513657eda45..e7fd0b19753 100644 --- a/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py +++ b/_unittest/test_45_FilterSolutions/test_filter/test_dll_interface.py @@ -36,7 +36,7 @@ @pytest.mark.skipif(config["desktopVersion"] < "2025.1", reason="Skipped on versions earlier than 2025.1") class TestClass: def test_version(self): - assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2024 R1 (Beta)" + assert pyaedt.filtersolutions_core.api_version() == "FilterSolutions API Version 2025 R1" def test_string_to_enum(self): assert ( From 0c2155b716e76b75e4c49fdf57471710fd4e039e Mon Sep 17 00:00:00 2001 From: Ramin Aghajafari <153928265+ramin4667@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:46:06 -0400 Subject: [PATCH 26/26] Update codecov.yml for filtersolutins coverage till 2025R1 --- codecov.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codecov.yml b/codecov.yml index d200f680ce7..77a9f15f3a4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -25,4 +25,5 @@ coverage: - "pyaedt/common_rpc.py" # ignore folders and all its contents - "pyaedt/generic/grpc_plugin_dll_class.py" # ignore file to interact with AEDT grpc api - "pyaedt/edb.py" # ignore folders and all its contents - - "pyaedt/workflows/project/kernel_converter.py" # ignore folders and all its contents + - "pyaedt/filtersolutions_core" # ignore filtersolutions feature for the current release pending 2025R1 update + - "pyaedt/filtersolutions.py" # ignore filtersolutions feature for the current release pending 2025R1 update