Skip to content

Commit

Permalink
FIX: freq sweep (#665)
Browse files Browse the repository at this point in the history
* FIX: freq sweep

* MISC: Auto fixes from pre-commit.com hooks

For more information, see https://pre-commit.ci

---------

Co-authored-by: ring630 <@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
hui-zhou-a and pre-commit-ci[bot] authored Jul 11, 2024
1 parent 2207954 commit 0944609
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
5 changes: 4 additions & 1 deletion src/pyedb/dotnet/edb_core/sim_setup_data/data/sweep_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def __init__(self, pedb, edb_object=None, name: str = None, sim_setup=None):
def _update_sweep(self):
"""Update the sweep."""
self.sim_setup.delete_frequency_sweep(self)
self.sim_setup._add_frequency_sweep(self)
ss_info = self.sim_setup.sim_setup_info
ss_info.add_sweep_data(self)
self.sim_setup.set_sim_setup_info(ss_info)
self.sim_setup._update_setup()
return

@property
Expand Down
5 changes: 1 addition & 4 deletions src/pyedb/dotnet/edb_core/utilities/simulation_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,7 @@ def _add_frequency_sweep(self, sweep_data):
"""
warnings.warn("Use new property :func:`add_sweep_data` instead.", DeprecationWarning)
self._sweep_list[sweep_data.name] = sweep_data
if self.setup_type in ["kRaptorX", "kHFSSPI"]:
edb_setup_info = self._edb_setup_info
else:
edb_setup_info = self.sim_setup_info
edb_setup_info = self.sim_setup_info

if self._setup_type in ["kSIwave", "kHFSS", "kRaptorX", "kHFSSPI"]:
for _, v in self._sweep_list.items():
Expand Down
20 changes: 4 additions & 16 deletions tests/legacy/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,22 +929,6 @@ def test_hfss_simulation_setup(self):
hfss_port_settings.set_triangles_wave_port = True
assert hfss_port_settings.set_triangles_wave_port

# mesh_operations = setup1.mesh_operations
# setup1.mesh_operations = mesh_operations

setup1.add_sweep(
"sweep1",
frequency_set=[
["linear count", "0", "1kHz", 1],
["log scale", "1kHz", "0.1GHz", 10],
["linear scale", "0.1GHz", "10GHz", "0.1GHz"],
],
)
assert "sweep1" in setup1.frequency_sweeps
sweep1 = setup1.frequency_sweeps["sweep1"]
sweep1.adaptive_sampling = True
assert sweep1.adaptive_sampling

edbapp.setups["setup1"].name = "setup1a"
assert "setup1" not in edbapp.setups
assert "setup1a" in edbapp.setups
Expand Down Expand Up @@ -993,6 +977,10 @@ def test_hfss_frequency_sweep(self, edb_examples):
assert len(setup1.sweeps["sw1"].frequencies) == 20
setup1.sweeps["sw1"].add("log_scale", "1GHz", "10GHz", 10)
assert len(setup1.sweeps["sw1"].frequencies) == 31

setup1.sweeps["sw1"].adaptive_sampling = True
assert setup1.sweeps["sw1"].adaptive_sampling

edbapp.close()

def test_hfss_simulation_setup_b(self, edb_examples):
Expand Down
2 changes: 2 additions & 0 deletions tests/legacy/system/test_edb_future_features_242.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,5 @@ def test_create_hfss_pi_setup_add_sweep(self, edb_examples):
setup = edbapp.create_hfsspi_setup("test")
setup.add_frequency_sweep(name="sweep1", frequency_sweep=["linear scale", "0.1GHz", "10GHz", "0.1GHz"])
assert setup.sweeps["sweep1"].frequencies
setup.sweeps["sweep1"].adaptive_sampling = True
assert setup.sweeps["sweep1"].adaptive_sampling

0 comments on commit 0944609

Please sign in to comment.