Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass kwargs to add_frequency_sweep rather than passing a dict with the "props" keyword. #5630

Closed
Devin-Crawford opened this issue Jan 6, 2025 · 1 comment · Fixed by #5683
Labels
enhancement New features or code improvements

Comments

@Devin-Crawford
Copy link
Contributor

Description of the current limitations

A more pythonic implementation to assign properties to a frequency sweep using the add_sweep() method would be to pass keywords according to allowed keys in the native API. Keys from the templates in core\modules\setup_templates.py could be used to parse the **kwargs. For example, the keywords in SweepHfss3D could be used to check and parse keyword arguments passed to add_sweep()

Code sample expected

Behavior would be like

setup = hfss.create_setup(name="Setup", setup_type="HFSSDriven", Frequency="5GHz", MaxPass=3)
sweep = setup.add_sweep(name="Sweep", sweep_type="Discrete", RangeStart="4GHz", RangeStop=6GHz, RangeCount=3)

instead of

setup = hfss.create_setup(name="Setup", setup_type="HFSSDriven", Frequency="5GHz", MaxPass=3)
sweep = setup.add_sweep(name="Sweep", sweep_type="Discrete")
sweep.props["RangeStart"] = "4GHz"
sweep.props["RangeStop"] = "6GHz"
sweep.props["RangeCount"] = 3
sweep.update()

Useful links and references

https://github.com/ansys/pyaedt/blob/main/src/ansys/aedt/core/modules/solve_sweeps.py
https://github.com/ansys/pyaedt/blob/main/src/ansys/aedt/core/modules/setup_templates.py

@Devin-Crawford Devin-Crawford added the enhancement New features or code improvements label Jan 6, 2025
@Devin-Crawford
Copy link
Contributor Author

Note that this can be updated without breaking the current behavior.

@Devin-Crawford Devin-Crawford changed the title Pass kwargs to add_sweep rather than passing a dict with the "props" keyword. Pass kwargs to add_frequency_sweep rather than passing a dict with the "props" keyword. Jan 7, 2025
@gmalinve gmalinve linked a pull request Feb 7, 2025 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant