hfsslib package

This module contains utilities for working with hfss.

The main use case is to automatically change design variables or sweep frequencies and ranges in an automated way. You will probably only ever need to use the hfsslib.hfss.HFSSChanger class directly. Examples are given in that class’s documentation.

Submodules

hfsslib.hfss module

This contains the HFSSChanger class, which provides an object-oriented way to make changes to HFSS files.

class hfsslib.hfss.HFSSChanger(template, new, frequency, frequency_units='Hz')

Bases: object

This class provides a way to modify HFSS projects based on solution frequency.

You can access setups and variables defined in the template project.

Examples

If you have a project named “TemplateProject.aedt”, with a setup with 2 sweeps you need to change, and a couple variables you want to change. You can accomplish that like this:

>>> # Say you want a new project with setup frequencies at 900 MHZ:
>>> new_project = HFSSChanger('TemplateProject.aedt', 'NewFile.aedt', 900, 'MHz')
>>> # same as new_project = HFSSChanger('TemplateProject.aedt', 'NewFile.aedt', 900E6)
>>> # Change sweeps!
>>> # Setup8's sweep 1 to -25%, +15%, and step by 3% increments
>>> new_project.Setup8.Sweep1.change_by_fraction(0.25, 0.15, 0.03)
>>> # Setup8's sweep 2 to +- 5%, by 1% steps.
>>> new_project.Setup8.Sweep2.change_by_fraction(0.05, 0.05, 0.01)
>>> # Change some design variable (example: Lair) to 2/5 of a wavelength
>>> new_project.Lair = new_project.wavelength * 2 / 5
>>> # Actually make the changes:
>>> new_project.make_changes()
__setattr__(name, value)

Make it convenient to change HFSS variables, and not override setups.

get_script()

Get the script (as a string) that will be sent to HFSS.

make_changes(keep_open=False)

Run HFSS.

Parameters:keep_hfss_open (bool) – if True, keep HFSS open after running.
class hfsslib.hfss.Frequency(value, units='Hz')

Bases: object

A class for better working with frequencies.

hfsslib.hfss_writer module

class hfsslib.hfss_writer.ScriptWriter(hfss_changer)

Bases: object

Writes a script based on an HFSSChanger instance.

setup_changes(setup)
Parameters:setup (hfss.Setup) – The setup to do

Module contents