pyEPR.ansys module#

pyEPR.ansys

2014-present

Purpose:

Handles Ansys interaction and control from version 2014 onward. Tested most extensively with V2016 and V2019R3.

@authors:

Originally contributed by Phil Reinhold. Developed further by Zlatko Minev, Zaki Leghtas, and the pyEPR team. For the base version of hfss.py, see PhilReinhold/pyHFSS

class pyEPR.ansys.AnsysQ3DSetup(design, setup: str)[source]#

Bases: HfssSetup

Q3D setup

add_fields_convergence_expr(expr, pct_delta, phase=0)#

note: because of hfss idiocy, you must call “commit_convergence_exprs” after adding all exprs

analyze(name=None)#

Solve a single solution setup and all its frequency sweeps.

Wraps Analyze(<SetupName>) in the HFSS scripting API. Blocks until analysis is complete; raises a COM error if aborted in HFSS.

property basis_order#
commit_convergence_exprs()#

note: this will eliminate any convergence expressions not added through this interface

delete_sweep(name)#
property delta_f#
property frequency#
get_convergence(variation='')[source]#

Return Q3D convergence data as a DataFrame (columns: Triangle, Delta %).

get_fields()#
get_frequency_Hz()[source]#
get_matrix(variation='', pass_number=0, frequency=None, MatrixType='Maxwell', solution_kind='LastAdaptive', ACPlusDCResistance=False, soln_type='C')[source]#

Export and return the Q3D capacitance/conductance matrix.

Parameters:
  • variation (str) – Empty string returns the nominal variation.

  • frequency (float, optional) – Frequency in Hz.

  • soln_type (str) – One of "C", "AC RL", or "DC RL".

  • solution_kind (str) – "LastAdaptive" or "AdaptivePass".

Returns:

(df_cmat, user_units, (df_cond, units_cond), design_variation)

Return type:

tuple

get_mesh_stats(variation='')#

variation should be in the form variation = “scale_factor=’1.2001’” …

get_profile(variation='')#
get_solutions()[source]#
get_sweep(name=None)#
get_sweep_names()#
insert_sweep(start_ghz, stop_ghz, count=None, step_ghz=None, name='Sweep', type='Fast', save_fields=False)#
static load_q3d_matrix(path, user_units='fF')[source]#

Load Q3D capacitance file exported as Maxwell matrix. Exports also conductance conductance. Units are read in automatically and converted to user units.

Parameters:

matrix] (path {[str or Path]} -- [path to file text with)

Returns:

df_cmat, user_units, (df_cond, units_cond), design_variation

dataframes: df_cmat, df_cond

property max_pass#
property min_freq#
property min_pass#
n_modes = 0#
property passes#
property pct_error#
property pct_refinement#
prop_holder = None#
prop_server = None#
prop_tab = 'CG'#
release()#
solve(name=None)#

Perform a blocking simulation via Solve(<SetupNameArray>).

Returns 0 on normal completion, -1 on simulation error. User abort also returns 0.

class pyEPR.ansys.Box(val, *args, **kwargs)[source]#

Bases: ModelEntity

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

property coordinate_system#
count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

property material#
model_command = 'CreateBox'#
partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

property position#
prop_holder = None#
prop_server = None#
prop_tab = 'Geometry3DCmdTab'#
release()#
removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

property transparency#
upper()#

Return a copy of the string converted to uppercase.

property wireframe#
property x_size#
property y_size#
property z_size#
zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class pyEPR.ansys.COMWrapper[source]#

Bases: object

release()[source]#
class pyEPR.ansys.CalcObject(stack, setup)[source]#

Bases: COMWrapper

complexmag()[source]#
conj()[source]#
dot(other)[source]#
evaluate(phase=0, lv=None, print_debug=False)[source]#
getQty(name)[source]#
imag()[source]#
integrate_line(name)[source]#
integrate_line_tangent(name)[source]#

integrate line tangent to vector expression

name = of line to integrate over

integrate_surf(name='AllObjects')[source]#
integrate_vol(name='AllObjects')[source]#
line_tangent_coor(name, coordinate)[source]#

integrate line tangent to vector expression

name = of line to integrate over

mag()[source]#
maximum_vol(name='AllObjects')[source]#
norm_2()[source]#
normal2surface(name)[source]#

return the part normal to surface. Complex Vector.

real()[source]#
release()#
save_as(name)[source]#

if the object already exists, try clearing your named expressions first with fields.clear_named_expressions

scalar_x()[source]#
scalar_y()[source]#
scalar_z()[source]#
smooth()[source]#
tangent2surface(name)[source]#

return the part tangent to surface. Complex Vector.

times_eps()[source]#
times_mu()[source]#
write_stack()[source]#
class pyEPR.ansys.ConstantCalcObject(num, setup)[source]#

Bases: CalcObject

complexmag()#
conj()#
dot(other)#
evaluate(phase=0, lv=None, print_debug=False)#
getQty(name)#
imag()#
integrate_line(name)#
integrate_line_tangent(name)#

integrate line tangent to vector expression

name = of line to integrate over

integrate_surf(name='AllObjects')#
integrate_vol(name='AllObjects')#
line_tangent_coor(name, coordinate)#

integrate line tangent to vector expression

name = of line to integrate over

mag()#
maximum_vol(name='AllObjects')#
norm_2()#
normal2surface(name)#

return the part normal to surface. Complex Vector.

real()#
release()#
save_as(name)#

if the object already exists, try clearing your named expressions first with fields.clear_named_expressions

scalar_x()#
scalar_y()#
scalar_z()#
smooth()#
tangent2surface(name)#

return the part tangent to surface. Complex Vector.

times_eps()#
times_mu()#
write_stack()#
class pyEPR.ansys.ConstantVecCalcObject(vec, setup)[source]#

Bases: CalcObject

complexmag()#
conj()#
dot(other)#
evaluate(phase=0, lv=None, print_debug=False)#
getQty(name)#
imag()#
integrate_line(name)#
integrate_line_tangent(name)#

integrate line tangent to vector expression

name = of line to integrate over

integrate_surf(name='AllObjects')#
integrate_vol(name='AllObjects')#
line_tangent_coor(name, coordinate)#

integrate line tangent to vector expression

name = of line to integrate over

mag()#
maximum_vol(name='AllObjects')#
norm_2()#
normal2surface(name)#

return the part normal to surface. Complex Vector.

real()#
release()#
save_as(name)#

if the object already exists, try clearing your named expressions first with fields.clear_named_expressions

scalar_x()#
scalar_y()#
scalar_z()#
smooth()#
tangent2surface(name)#

return the part tangent to surface. Complex Vector.

times_eps()#
times_mu()#
write_stack()#
class pyEPR.ansys.HfssApp(ProgID='AnsoftHfss.HfssScriptInterface')[source]#

Bases: COMWrapper

get_app_desktop()[source]#
release()#
class pyEPR.ansys.HfssDMDesignSolutions(setup, solutions)[source]#

Bases: HfssDesignSolutions

get_valid_solution_list()#

Get all available solution names that exist in a design.

Returns a tuple of strings such as ('Setup1 : AdaptivePass', 'Setup1 : LastAdaptive').

list_variations(setup_name: str = None)#

Get a list of solved variations.

Parameters:

setup_name (str) – Example name (“Setup1 : LastAdaptive”) Defaults to None.

Returns:

An array of strings corresponding to solved variations.

("Cj='2fF' Lj='12nH'",
"Cj='2fF' Lj='12.5nH'",
"Cj='2fF' Lj='13nH'",
"Cj='2fF' Lj='13.5nH'",
"Cj='2fF' Lj='14nH'")

release()#
class pyEPR.ansys.HfssDMSetup(design, setup: str)[source]#

Bases: HfssSetup

Driven modal setup

add_fields_convergence_expr(expr, pct_delta, phase=0)#

note: because of hfss idiocy, you must call “commit_convergence_exprs” after adding all exprs

analyze(name=None)#

Solve a single solution setup and all its frequency sweeps.

Wraps Analyze(<SetupName>) in the HFSS scripting API. Blocks until analysis is complete; raises a COM error if aborted in HFSS.

property basis_order#
commit_convergence_exprs()#

note: this will eliminate any convergence expressions not added through this interface

delete_sweep(name)#
property delta_f#
property delta_s#
get_convergence(variation='', pre_fn_args=[], overwrite=True)#
Returns converge as a dataframe

Variation should be in the form variation = “scale_factor=’1.2001’” …

get_fields()#
get_mesh_stats(variation='')#

variation should be in the form variation = “scale_factor=’1.2001’” …

get_profile(variation='')#
get_solutions()[source]#
get_sweep(name=None)#
get_sweep_names()#
insert_sweep(start_ghz, stop_ghz, count=None, step_ghz=None, name='Sweep', type='Fast', save_fields=False)#
property min_freq#
property n_modes#
property passes#
property pct_refinement#
prop_holder = None#
prop_server = None#
prop_tab = 'HfssTab'#
release()#

type: linked_setup <HfssSetup>

property solution_freq#
solve(name=None)#

Perform a blocking simulation via Solve(<SetupNameArray>).

Returns 0 on normal completion, -1 on simulation error. User abort also returns 0.

property solver_type#
class pyEPR.ansys.HfssDTDesignSolutions(setup, solutions)[source]#

Bases: HfssDesignSolutions

get_valid_solution_list()#

Get all available solution names that exist in a design.

Returns a tuple of strings such as ('Setup1 : AdaptivePass', 'Setup1 : LastAdaptive').

list_variations(setup_name: str = None)#

Get a list of solved variations.

Parameters:

setup_name (str) – Example name (“Setup1 : LastAdaptive”) Defaults to None.

Returns:

An array of strings corresponding to solved variations.

("Cj='2fF' Lj='12nH'",
"Cj='2fF' Lj='12.5nH'",
"Cj='2fF' Lj='13nH'",
"Cj='2fF' Lj='13.5nH'",
"Cj='2fF' Lj='14nH'")

release()#
class pyEPR.ansys.HfssDTSetup(design, setup: str)[source]#

Bases: HfssDMSetup

add_fields_convergence_expr(expr, pct_delta, phase=0)#

note: because of hfss idiocy, you must call “commit_convergence_exprs” after adding all exprs

analyze(name=None)#

Solve a single solution setup and all its frequency sweeps.

Wraps Analyze(<SetupName>) in the HFSS scripting API. Blocks until analysis is complete; raises a COM error if aborted in HFSS.

property basis_order#
commit_convergence_exprs()#

note: this will eliminate any convergence expressions not added through this interface

delete_sweep(name)#
property delta_f#
property delta_s#
get_convergence(variation='', pre_fn_args=[], overwrite=True)#
Returns converge as a dataframe

Variation should be in the form variation = “scale_factor=’1.2001’” …

get_fields()#
get_mesh_stats(variation='')#

variation should be in the form variation = “scale_factor=’1.2001’” …

get_profile(variation='')#
get_solutions()[source]#
get_sweep(name=None)#
get_sweep_names()#
insert_sweep(start_ghz, stop_ghz, count=None, step_ghz=None, name='Sweep', type='Fast', save_fields=False)#
property min_freq#
property n_modes#
property passes#
property pct_refinement#
prop_holder = None#
prop_server = None#
prop_tab = 'HfssTab'#
release()#

type: linked_setup <HfssSetup>

property solution_freq#
solve(name=None)#

Perform a blocking simulation via Solve(<SetupNameArray>).

Returns 0 on normal completion, -1 on simulation error. User abort also returns 0.

property solver_type#
class pyEPR.ansys.HfssDesign(project, design)[source]#

Bases: COMWrapper

Wrapper around an Ansys HFSS (or Q3D) design COM object.

Exposes design-level operations: variable management, geometry (via HfssModeler), solution setup, field calculation, and Optimetrics. Created by HfssProject.get_design(name) or the new_*_design factory methods; not instantiated directly by user code.

solution_type#

Canonical solution type string ("Eigenmode", "DrivenModal", "DrivenTerminal", or "Q3D"). Always the pre-2021.2 form regardless of AEDT version.

Type:

str

modeler#

Geometry editor interface.

Type:

HfssModeler

optimetrics#

Parametric / optimisation sweep interface.

Type:

Optimetrics

Clear_Field_Clac_Stack()[source]#
add_message(message: str, severity: int = 0)[source]#

Add a message to HFSS log with severity and context to message window.

Keyword Arguments:

severity (int) – 0 = Informational, 1 = Warning, 2 = Error, 3 = Fatal..

clean_up_solutions()[source]#
copy_design_variables(source_design)[source]#

does not check that variables are all present

copy_to_project(project)[source]#
create_dm_setup(freq_ghz=1, name='Setup', max_delta_s=0.1, max_passes=10, min_passes=1, min_converged=1, pct_refinement=30, basis_order=-1)[source]#
create_dt_setup(freq_ghz=1, name='Setup', max_delta_s=0.1, max_passes=10, min_passes=1, min_converged=1, pct_refinement=30, basis_order=-1)[source]#
create_em_setup(name='Setup', min_freq_ghz=1, n_modes=1, max_delta_f=0.1, max_passes=10, min_passes=1, min_converged=1, pct_refinement=30, basis_order=-1)[source]#
create_q3d_setup(freq_ghz=5.0, name='Setup', save_fields=False, enabled=True, max_passes=15, min_passes=2, min_converged_passes=2, percent_error=0.5, percent_refinement=30, auto_increase_solution_order=True, solution_order='High', solver_type='Iterative')[source]#
create_variable(name, value, postprocessing=False)[source]#
delete_full_variation(DesignVariationKey='All', del_linked_data=False)[source]#

Delete solution data for one or all design variations.

Wraps DeleteFullVariation in the HFSS scripting API (HFSS → Results → Clean Up Solutions).

Parameters:
  • DesignVariationKey (str) – "All" deletes all variations; otherwise a design-variation string.

  • del_linked_data (bool) – Whether to also delete linked data.

delete_setup(name)[source]#
duplicate(name=None)[source]#
eval_expr(expr, units='mm')[source]#
get_excitations()[source]#
get_nominal_variation()[source]#

Use: Gets the nominal variation string Return Value: Returns a string representing the nominal variation Returns string such as “Height=’0.06mm’ Lj=’13.5nH’”

get_setup(name=None)[source]#

Return the named analysis setup, or the first setup if name is omitted.

Parameters:

name (str, optional) – Name of the setup to retrieve. If None, the first setup in the design is returned.

Returns:

An HfssEMSetup, HfssDMSetup, HfssDTSetup, or AnsysQ3DSetup instance depending on self.solution_type.

Return type:

HfssSetup

Raises:

EnvironmentError – If no setups exist, or if name is not found.

get_setup_names()[source]#
get_variable_names()[source]#

Returns the local design variables. Does not return the project (global) variables, which start with $.

get_variable_value(name)[source]#

Can only access the design variables, i.e., the local ones Cannot access the project (global) variables, which start with $.

get_variables()[source]#

Returns dictionary of local design variables and their values. Does not return the project (global) variables and their values, whose names start with $.

release()#
rename_design(name)[source]#
save_screenshot(path: str = None, show: bool = True)[source]#

Export a PNG screenshot of the 3-D model view.

Parameters:
  • path (str, optional) – Destination file path. Defaults to ansys.png in the current working directory.

  • show (bool) – If True (default), display the image in a Jupyter notebook via IPython.display.

Returns:

Path to the saved PNG file.

Return type:

pathlib.Path

set_variable(name: str, value: str, postprocessing=False)[source]#

Warning: THis is case sensitive,

Parameters:
  • set (name {str} -- Name of variable to) – This is not the same as as ‘LJ_1’. You must use the same casing.

  • 'Lj_1'. (such as) – This is not the same as as ‘LJ_1’. You must use the same casing.

  • Value (value {str} --)

  • '10nH' (such as)

Keyword Arguments:

not. (postprocessing {bool} -- Postprocessing variable only or) – (default: {False})

Returns:

VariableString

set_variables(variation_string: str)[source]#

Set all variables to match a solved variation string.

Parameters:

variation_string (str) – Variation string such as “Cj=’2fF’ Lj=’13.5nH’”

class pyEPR.ansys.HfssDesignSolutions(setup, solutions)[source]#

Bases: COMWrapper

get_valid_solution_list()[source]#

Get all available solution names that exist in a design.

Returns a tuple of strings such as ('Setup1 : AdaptivePass', 'Setup1 : LastAdaptive').

list_variations(setup_name: str = None)[source]#

Get a list of solved variations.

Parameters:

setup_name (str) – Example name (“Setup1 : LastAdaptive”) Defaults to None.

Returns:

An array of strings corresponding to solved variations.

("Cj='2fF' Lj='12nH'",
"Cj='2fF' Lj='12.5nH'",
"Cj='2fF' Lj='13nH'",
"Cj='2fF' Lj='13.5nH'",
"Cj='2fF' Lj='14nH'")

release()#
class pyEPR.ansys.HfssDesktop(app, desktop)[source]#

Bases: COMWrapper

close_all_windows()[source]#
get_active_project()[source]#
get_messages(project_name='', design_name='', level=0)[source]#

Collect messages from a specified project and design.

Parameters:
  • project_name (str) – Empty string returns all messages; wrong name returns no messages.

  • design_name (str) – Empty string returns all messages for the project.

  • level (int) – Severity filter: 0 = info+, 1 = warning+, 2 = error+fatal, 3 = fatal only.

Return type:

list of str

get_project_names()[source]#
get_projects()[source]#
get_version()[source]#
property library_directory#

Path to the user component library directory.

Type:

str

new_project()[source]#
open_project(path)[source]#

returns error if already open

project_count()[source]#
property project_directory#

Default directory where new projects are saved.

Type:

str

release()#
set_active_project(name)[source]#

Make the named project the active project in the desktop.

property temp_directory#

Path to the HFSS temporary files directory.

Type:

str

class pyEPR.ansys.HfssEMDesignSolutions(setup, solutions)[source]#

Bases: HfssDesignSolutions

create_report(plot_name, xcomp, ycomp, params, pass_name='LastAdaptive')[source]#

pass_name: AdaptivePass, LastAdaptive

Example

Example plot for a single variation all pass converge of mode freq

ycomp = [f"re(Mode({i}))" for i in range(1,1+epr_hfss.n_modes)]
params = ["Pass:=", ["All"]]+variation
setup.create_report("Freq. vs. pass", "Pass", ycomp, params, pass_name='AdaptivePass')
eigenmodes(lv='')[source]#

Returns the eigenmode data of freq and kappa/2p

get_valid_solution_list()#

Get all available solution names that exist in a design.

Returns a tuple of strings such as ('Setup1 : AdaptivePass', 'Setup1 : LastAdaptive').

has_fields(variation_string=None)[source]#

Determine if fields exist for a particular solution.

Parameters:

variation_string (str, optional) – HFSS variation string such as "Cj='2fF' Lj='12.75nH'". If None, uses the nominal variation.

list_variations(setup_name: str = None)#

Get a list of solved variations.

Parameters:

setup_name (str) – Example name (“Setup1 : LastAdaptive”) Defaults to None.

Returns:

An array of strings corresponding to solved variations.

("Cj='2fF' Lj='12nH'",
"Cj='2fF' Lj='12.5nH'",
"Cj='2fF' Lj='13nH'",
"Cj='2fF' Lj='13.5nH'",
"Cj='2fF' Lj='14nH'")

release()#
set_mode(n, phase=0, FieldType='EigenStoredEnergy')[source]#

Indicates which source excitations should be used for fields post processing. HFSS>Fields>Edit Sources

Mode count starts at 1

Amplitude is set to 1

No error is thrown if a number exceeding number of modes is set

FieldType – EigenStoredEnergy or EigenPeakElecticField

class pyEPR.ansys.HfssEMSetup(design, setup: str)[source]#

Bases: HfssSetup

Eigenmode setup

add_fields_convergence_expr(expr, pct_delta, phase=0)#

note: because of hfss idiocy, you must call “commit_convergence_exprs” after adding all exprs

analyze(name=None)#

Solve a single solution setup and all its frequency sweeps.

Wraps Analyze(<SetupName>) in the HFSS scripting API. Blocks until analysis is complete; raises a COM error if aborted in HFSS.

property basis_order#
commit_convergence_exprs()#

note: this will eliminate any convergence expressions not added through this interface

delete_sweep(name)#
property delta_f#
get_convergence(variation='', pre_fn_args=[], overwrite=True)#
Returns converge as a dataframe

Variation should be in the form variation = “scale_factor=’1.2001’” …

get_fields()#
get_mesh_stats(variation='')#

variation should be in the form variation = “scale_factor=’1.2001’” …

get_profile(variation='')#
get_solutions()[source]#
get_sweep(name=None)#
get_sweep_names()#
insert_sweep(start_ghz, stop_ghz, count=None, step_ghz=None, name='Sweep', type='Fast', save_fields=False)#
property min_freq#
property n_modes#
property passes#
property pct_refinement#
prop_holder = None#
prop_server = None#
prop_tab = 'HfssTab'#
release()#
solve(name=None)#

Perform a blocking simulation via Solve(<SetupNameArray>).

Returns 0 on normal completion, -1 on simulation error. User abort also returns 0.

class pyEPR.ansys.HfssFieldsCalc(setup)[source]#

Bases: COMWrapper

clear_named_expressions()[source]#
declare_named_expression(name)[source]#

” If a named expression has been created in the fields calculator, this function can be called to initialize the name to work with the fields object

release()#
use_named_expression(name)[source]#

Expression can be used to access dictionary of named expressions, Alternately user can access dictionary directly via named_expression()

class pyEPR.ansys.HfssFrequencySweep(setup, name)[source]#

Bases: COMWrapper

analyze_sweep()[source]#
property count#
create_report(name, expr)[source]#
get_network_data(formats)[source]#
get_report_arrays(expr)[source]#
prop_tab = 'HfssTab'#
release()#
property start_freq#
property step_size#
property stop_freq#
property sweep_type#
class pyEPR.ansys.HfssModeler(design, modeler, boundaries, mesh)[source]#

Bases: COMWrapper

append_PerfE_assignment(boundary_name: str, object_names: list)[source]#

This will create a new boundary if need, and will otherwise append given names to an existing boundary

append_mesh(mesh_name: str, object_names: list, old_objs: list, **kwargs)[source]#

This will create a new boundary if need, and will otherwise append given names to an existing boundary old_obj = circ._mesh_assign

assign_perfect_E(obj: List[str], name: str = 'PerfE')[source]#

Assign a boundary condition to a list of objects.

Arg:

objs (List[str]): Takes a name of an object or a list of object names. name(str): If name is not specified PerfE is appended to object name for the name.

create_relative_coorinate_system_both(cs_name, origin=['0um', '0um', '0um'], XAxisVec=['1um', '0um', '0um'], YAxisVec=['0um', '1um', '0um'])[source]#

Use: Creates a relative coordinate system. Only the Name attribute of the <AttributesArray> parameter is supported. Command: Modeler>Coordinate System>Create>Relative CS->Offset Modeler>Coordinate System>Create>Relative CS->Rotated Modeler>Coordinate System>Create>Relative CS->Both

Current coordinate system is set right after this.

cs_namename of coord. sys

If the name already exists, then a new coordinate system with _1 is created.

origin, XAxisVec, YAxisVec: 3-vectors

You can also pass in params such as origin = [0,1,0] rather than [“0um”,”1um”,”0um”], but these will be interpreted in default units, so it is safer to be explicit. Explicit over implicit.

draw_box_center(pos, size, **kwargs)[source]#

Creates a 3-D box centered at pos [x0, y0, z0], with width size [xwidth, ywidth, zwidth] along each respective direction.

Parameters:
  • pos (list) – Coordinates of center of box, [x0, y0, z0]

  • size (list) – Width of box along each direction, [xwidth, ywidth, zwidth]

draw_box_corner(pos, size, **kwargs)[source]#
draw_cylinder(pos, radius, height, axis, **kwargs)[source]#
draw_cylinder_center(pos, radius, height, axis, **kwargs)[source]#
draw_polyline(points, closed=True, **kwargs)[source]#

Draw a closed or open polyline. If closed=True, converts it to a sheet.

Points must be in the correct units. Optional keyword arguments are forwarded to _attributes_array and include nonmodel, wireframe, color, transparency, material, solve_inside, and coordinate_system.

draw_rect_center(pos, x_size=0, y_size=0, z_size=0, **kwargs)[source]#

Creates a rectangle centered at pos [x0, y0, z0]. It is assumed that the rectangle lies parallel to the xy, yz, or xz plane. User inputs 2 of 3 of the following: x_size, y_size, and z_size depending on how the rectangle is oriented.

Parameters:
  • pos (list) – Coordinates of rectangle center, [x0, y0, z0]

  • x_size (int, optional) – Width along the x direction. Defaults to 0.

  • y_size (int, optional) – Width along the y direction. Defaults to 0.

  • z_size (int, optional) – Width along the z direction]. Defaults to 0.

draw_rect_corner(pos, x_size=0, y_size=0, z_size=0, **kwargs)[source]#
draw_region(Padding, PaddingType='Percentage Offset', name='Region', material='"vacuum"')[source]#

PaddingType : ‘Absolute Offset’, “Percentage Offset”

draw_wirebond(pos, ori, width, height='0.1mm', z=0, wire_diameter='0.02mm', NumSides=6, **kwargs)[source]#
Parameters:
  • pos – 2D position vector (specify center point)

  • ori – should be normed

  • z – z position

# TODO create Wirebond class position is the origin of one point ori is the orientation vector, which gets normalized

eval_expr(expr, units='mm')[source]#
get_all_properties(obj_name, PropTab='Geometry3DAttributeTab')[source]#

Get all properties for modeler PropTab, PropServer

get_boundary_assignment(boundary_name: str)[source]#
get_face_ids(obj)[source]#
get_object_name_by_face_id(ID: str)[source]#

Gets an object name corresponding to the input face id.

get_objects_in_group(group)[source]#

Return the objects in the specified HFSS group.

Parameters:

group (str) – One of a material name, assignment name, "Non Model", "Solids", "Unclassified", "Sheets", or "Lines".

get_units()[source]#

Get the model units. Return Value: A string contains current model units.

get_vertex_ids(obj)[source]#

Get the vertex IDs of given an object name oVertexIDs = oEditor.GetVertexIDsFromObject(“Box1”)

intersect(names, keep_originals=False)[source]#
mesh_get_all_props(mesh_name)[source]#
mesh_get_names(kind='Length Based')[source]#

“Length Based”, “Skin Depth Based”, …

mesh_length(name_mesh, objects: list, MaxLength='0.1mm', **kwargs)[source]#

“RefineInside:=” , False, “Enabled:=” , True, “RestrictElem:=” , False, “NumMaxElem:=” , “1000”, “RestrictLength:=” , True, “MaxLength:=” , “0.1mm”

Example use: modeler.assign_mesh_length(‘mesh2’, [“Q1_mesh”], MaxLength=0.1)

mesh_reassign(name_mesh, objects: list)[source]#
release()#
rename_obj(obj, name)[source]#
set_units(units, rescale=True)[source]#
set_working_coordinate_system(cs_name='Global')[source]#

Use: Sets the working coordinate system. Command: Modeler>Coordinate System>Set Working CS

subtract(blank_name, tool_names, keep_originals=False)[source]#
sweep_along_vector(names, vector)[source]#
translate(name, vector)[source]#
unite(names, keep_originals=False)[source]#
class pyEPR.ansys.HfssProject(desktop, project)[source]#

Bases: COMWrapper

close()[source]#
create_variable(name, value)[source]#
duplicate_design(target, source)[source]#
get_active_design()[source]#
get_design(name)[source]#
get_design_names()[source]#
get_designs()[source]#
get_path()[source]#
get_variable_names()[source]#
get_variable_value(name)[source]#
get_variables()[source]#

Returns the project variables only, which start with $. These are global variables.

import_dataset(path)[source]#
make_active()[source]#
property name#
new_design(design_name, solution_type, design_type='HFSS')[source]#
new_dm_design(name: str)[source]#

Create a new driven-modal (non-hybrid) HFSS design.

On AEDT 2024.1+, InsertDesign with solution type "DrivenModal" silently creates an "HFSS Hybrid Modal Network" design instead of the classic "HFSS Modal Network". pyEPR explicitly calls SetSolutionType after creation to enforce the non-hybrid type, matching the behaviour of all previous HFSS releases.

See Ansys scripting docs:

InsertDesign — cannot specify hybrid vs. non-hybrid at creation time. SetSolutionType — used post-creation to correct the type.

Parameters:

name (str) – Name for the new driven-modal design.

Returns:

Wrapper around the newly created HFSS design.

Return type:

HfssDesign

new_dt_design(name: str)[source]#

Create a new driven-terminal (non-hybrid) HFSS design.

On AEDT 2024.1+, InsertDesign with solution type "DrivenTerminal" silently creates an "HFSS Hybrid Terminal Network" design instead of the classic "HFSS Terminal Network". pyEPR explicitly calls SetSolutionType after creation to enforce the non-hybrid type, matching the behaviour of all previous HFSS releases.

This is the terminal-port counterpart to new_dm_design(). Use it when you need S-parameter or impedance extraction via terminal (lumped-port) excitations rather than wave-port modes.

See Ansys scripting docs:

InsertDesign — cannot specify hybrid vs. non-hybrid at creation time. SetSolutionType — used post-creation to correct the type.

Parameters:

name (str) – Name for the new driven-terminal design.

Returns:

Wrapper around the newly created HFSS design.

Return type:

HfssDesign

new_em_design(name: str)[source]#

Create a new eigenmode HFSS design.

Eigenmode designs compute the resonant frequencies and field distributions of a closed (or nearly closed) cavity without external ports. No SetSolutionType workaround is needed because HFSS has never introduced a hybrid variant for Eigenmode.

Parameters:

name (str) – Name for the new eigenmode design.

Returns:

Wrapper around the newly created HFSS design.

Return type:

HfssDesign

new_q3d_design(name: str)[source]#

Create a new Q3D Extractor design.

Parameters:

name (str) – Name for the new Q3D design.

Returns:

Wrapper around the newly created Q3D design.

Return type:

HfssDesign

release()#
rename_design(design, rename)[source]#
save(path=None)[source]#
set_variable(name, value)[source]#
simulate_all()[source]#
class pyEPR.ansys.HfssPropertyObject[source]#

Bases: COMWrapper

prop_holder = None#
prop_server = None#
prop_tab = None#
release()#
class pyEPR.ansys.HfssQ3DDesignSolutions(setup, solutions)[source]#

Bases: HfssDesignSolutions

get_valid_solution_list()#

Get all available solution names that exist in a design.

Returns a tuple of strings such as ('Setup1 : AdaptivePass', 'Setup1 : LastAdaptive').

list_variations(setup_name: str = None)#

Get a list of solved variations.

Parameters:

setup_name (str) – Example name (“Setup1 : LastAdaptive”) Defaults to None.

Returns:

An array of strings corresponding to solved variations.

("Cj='2fF' Lj='12nH'",
"Cj='2fF' Lj='12.5nH'",
"Cj='2fF' Lj='13nH'",
"Cj='2fF' Lj='13.5nH'",
"Cj='2fF' Lj='14nH'")

release()#
class pyEPR.ansys.HfssReport(design, name)[source]#

Bases: COMWrapper

export_to_file(filename)[source]#
get_arrays()[source]#
release()#
class pyEPR.ansys.HfssSetup(design, setup: str)[source]#

Bases: HfssPropertyObject

add_fields_convergence_expr(expr, pct_delta, phase=0)[source]#

note: because of hfss idiocy, you must call “commit_convergence_exprs” after adding all exprs

analyze(name=None)[source]#

Solve a single solution setup and all its frequency sweeps.

Wraps Analyze(<SetupName>) in the HFSS scripting API. Blocks until analysis is complete; raises a COM error if aborted in HFSS.

property basis_order#
commit_convergence_exprs()[source]#

note: this will eliminate any convergence expressions not added through this interface

delete_sweep(name)[source]#
property delta_f#
get_convergence(variation='', pre_fn_args=[], overwrite=True)[source]#
Returns converge as a dataframe

Variation should be in the form variation = “scale_factor=’1.2001’” …

get_fields()[source]#
get_mesh_stats(variation='')[source]#

variation should be in the form variation = “scale_factor=’1.2001’” …

get_profile(variation='')[source]#
get_sweep(name=None)[source]#
get_sweep_names()[source]#
insert_sweep(start_ghz, stop_ghz, count=None, step_ghz=None, name='Sweep', type='Fast', save_fields=False)[source]#
property min_freq#
property n_modes#
property passes#
property pct_refinement#
prop_holder = None#
prop_server = None#
prop_tab = 'HfssTab'#
release()#
solve(name=None)[source]#

Perform a blocking simulation via Solve(<SetupNameArray>).

Returns 0 on normal completion, -1 on simulation error. User abort also returns 0.

class pyEPR.ansys.ModelEntity(val, *args, **kwargs)[source]#

Bases: str, HfssPropertyObject

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

property coordinate_system#
count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

property material#
model_command = None#
partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

prop_holder = None#
prop_server = None#
prop_tab = 'Geometry3DCmdTab'#
release()#
removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

property transparency#
upper()#

Return a copy of the string converted to uppercase.

property wireframe#
zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class pyEPR.ansys.NamedCalcObject(name, setup)[source]#

Bases: CalcObject

complexmag()#
conj()#
dot(other)#
evaluate(phase=0, lv=None, print_debug=False)#
getQty(name)#
imag()#
integrate_line(name)#
integrate_line_tangent(name)#

integrate line tangent to vector expression

name = of line to integrate over

integrate_surf(name='AllObjects')#
integrate_vol(name='AllObjects')#
line_tangent_coor(name, coordinate)#

integrate line tangent to vector expression

name = of line to integrate over

mag()#
maximum_vol(name='AllObjects')#
norm_2()#
normal2surface(name)#

return the part normal to surface. Complex Vector.

real()#
release()#
save_as(name)#

if the object already exists, try clearing your named expressions first with fields.clear_named_expressions

scalar_x()#
scalar_y()#
scalar_z()#
smooth()#
tangent2surface(name)#

return the part tangent to surface. Complex Vector.

times_eps()#
times_mu()#
write_stack()#
class pyEPR.ansys.OpenPolyline(val, *args, **kwargs)[source]#

Bases: ModelEntity

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

property coordinate_system#
copy(new_name)[source]#
count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

fillet(radius, vertex_index)[source]#
fillets(radius, do_not_fillet=[])[source]#

do_not_fillet : Index list of vertices to not fillete

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

property material#
model_command = 'CreatePolyline'#
partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

prop_holder = None#
prop_server = None#
prop_tab = 'Geometry3DCmdTab'#
release()#
removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

rename(new_name)[source]#

Warning: The increment_name only works if the sheet has not been stracted or used as a tool elsewher. These names are not checked - They require modifying get_objects_in_group

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

property show_direction#
split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

sweep_along_path(to_sweep)[source]#
title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

property transparency#
upper()#

Return a copy of the string converted to uppercase.

vertices()[source]#
property wireframe#
zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class pyEPR.ansys.Optimetrics(design)[source]#

Bases: COMWrapper

Optimetrics script commands executed by the “Optimetrics” module.

Example use:

opti = Optimetrics(pinfo.design)
names = opti.get_setup_names()
print('Names of optimetrics: ', names)
opti.solve_setup(names[0])

Note that running optimetrics requires the license for Optimetrics by Ansys.

create_setup(variable, swp_params, name='ParametricSetup1', swp_type='linear_step', setup_name=None, save_fields=True, copy_mesh=True, solve_with_copied_mesh_only=True, setup_type='parametric')[source]#

Inserts a new parametric setup of one variable. Either with sweep definition or from file.

Synchronized sweeps (more than one variable changing at once) can be implemented by giving a list of variables to variable and corresponding lists to swp_params and swp_type. The lengths of the sweep types should match (excluding single value).

Corresponds to ui access: Right-click the Optimetrics folder in the project tree, and then click Add> Parametric on the shortcut menu.

Ansys provides six sweep definitions types specified using the swp_type variable.

Sweep type definitions:

  • ‘single_value’

    Specify a single value for the sweep definition.

  • ‘linear_step’

    Specify a linear range of values with a constant step size.

  • ‘linear_count’

    Specify a linear range of values and the number, or count of points within this range.

  • ‘decade_count’

    Specify a logarithmic (base 10) series of values, and the number of values to calculate in each decade.

  • ‘octave_count’

    Specify a logarithmic (base 2) series of values, and the number of values to calculate in each octave.

  • ‘exponential_count’

    Specify an exponential (base e) series of values, and the number of values to calculate.

For swp_type=’single_value’ swp_params is the single value.

For swp_type=’linear_step’ swp_params is start, stop, step:

swp_params = (“12.8nH”, “13.6nH”, “0.2nH”)

All other types swp_params is start, stop, count:

swp_params = (“12.8nH”, “13.6nH”, 4) The definition of count varies amongst the available types.

For Decade count and Octave count, the Count value specifies the number of points to calculate in every decade or octave. For Exponential count, the Count value is the total number of points. The total number of points includes the start and stop values.

For parametric from file, set setup_type='parametric_file' and pass a file path (e.g. "C:\\test.csv") to swp_params.

Example CSV format:

*,Lj_qubit
1,12.2nH
2,9.7nH
3,10.2nH

See Ansys documentation for additional formatting instructions.

get_setup_names()[source]#

Return list of Optimetrics setup names

release()#
solve_setup(setup_name: str)[source]#

Solves the specified Optimetrics setup. Corresponds to: Right-click the setup in the project tree, and then click Analyze on the shortcut menu.

setup_name (str) : name of setup, should be in get_setup_names

Blocks execution until ready to use.

Note that this requires the license for Optimetrics by Ansys.

class pyEPR.ansys.Polyline(val, *args, **kwargs)[source]#

Bases: ModelEntity

Assume closed polyline, which creates a polygon.

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

property coordinate_system#
count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

fillet(radius, vertex_index)[source]#
find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

make_center_line(axis)[source]#
make_rlc_boundary(axis, r=0, l=0, c=0, name='LumpRLC')[source]#
static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

property material#
model_command = 'CreatePolyline'#
partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

prop_holder = None#
prop_server = None#
prop_tab = 'Geometry3DCmdTab'#
release()#
removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

rename(new_name)[source]#

Warning: The increment_name only works if the sheet has not been stracted or used as a tool elsewhere. These names are not checked; they require modifying get_objects_in_group.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

property transparency#
unite(list_other)[source]#
upper()#

Return a copy of the string converted to uppercase.

vertices()[source]#
property wireframe#
zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class pyEPR.ansys.Rect(val, *args, **kwargs)[source]#

Bases: ModelEntity

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

property coordinate_system#
count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

make_center_line(axis)[source]#

Returns start and end list of 3 coordinates

make_lumped_port(axis, z0='50ohm', name='LumpPort')[source]#
make_rlc_boundary(axis, r=0, l=0, c=0, name='LumpRLC')[source]#
static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

property material#
model_command = 'CreateRectangle'#
partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

prop_holder = None#
prop_server = None#
prop_tab = 'Geometry3DCmdTab'#
release()#
removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

property transparency#
upper()#

Return a copy of the string converted to uppercase.

property wireframe#
zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class pyEPR.ansys.VariableString[source]#

Bases: str

capitalize()#

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()#

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)#

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int#

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')#

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool#

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)#

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str#

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str#

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int#

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()#

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()#

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()#

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()#

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()#

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()#

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()#

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()#

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()#

Return True if all characters in the string are printable, False otherwise.

A character is printable if repr() may use it in its output.

isspace()#

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()#

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()#

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)#

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()#

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)#

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()#

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)#

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)#

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)#

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int#

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)#

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)#

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)#

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)#

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits. -1 (the default value) means no limit.

Splitting starts at the front of the string and works to the end.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)#

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool#

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)#

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()#

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()#

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)#

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()#

Return a copy of the string converted to uppercase.

zfill(width, /)#

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

pyEPR.ansys.extract_value_dim(expr)[source]#

type expr: str

pyEPR.ansys.extract_value_unit(expr, units)[source]#
Returns:

float

pyEPR.ansys.fix_units(x, unit_assumed=None)[source]#

Convert all numbers to string and append the assumed units if needed. For an iterable, returns a list

pyEPR.ansys.get_active_design()[source]#
pyEPR.ansys.get_active_project()[source]#

If you see the error: “The requested operation requires elevation.” then you need to run your python as an admin.

pyEPR.ansys.get_report_arrays(name: str)[source]#
pyEPR.ansys.increment_name(base, existing)[source]#
pyEPR.ansys.load_ansys_project(proj_name: str, project_path: str = None, extension: str = '.aedt')[source]#

Utility function to load an Ansys project.

Parameters:
  • proj_name – None –> get active. (make sure 2 run as admin)

  • extensionaedt is for 2016 version and newer

pyEPR.ansys.make_float_prop(name, prop_tab=None, prop_server=None)[source]#
pyEPR.ansys.make_int_prop(name, prop_tab=None, prop_server=None)[source]#
pyEPR.ansys.make_prop(name, prop_tab=None, prop_server=None, prop_args=None)[source]#
pyEPR.ansys.make_str_prop(name, prop_tab=None, prop_server=None)[source]#
pyEPR.ansys.parse_entry(entry, convert_to_unit='meter')[source]#

Should take a list of tuple of list… of int, float or str… For iterables, returns lists

pyEPR.ansys.parse_units(x)[source]#

Convert number, string, and lists/arrays/tuples to numbers scaled in HFSS units.

Converts to LENGTH_UNIT = meters [HFSS UNITS] Assumes input units LENGTH_UNIT_ASSUMED = mm [USER UNITS]

[USER UNITS] —-> [HFSS UNITS]

pyEPR.ansys.parse_units_user(x)[source]#

Convert from user assumed units to user assumed units [USER UNITS] —-> [USER UNITS]

pyEPR.ansys.release()[source]#

Release COM connection to Ansys.

pyEPR.ansys.set_property(prop_holder, prop_tab, prop_server, name, value, prop_args=None)[source]#

More general non obj oriented, functional version prop_args = [] by default

pyEPR.ansys.simplify_arith_expr(expr)[source]#
pyEPR.ansys.unparse_units(x)[source]#

Undo effect of parse_unit.

Converts to LENGTH_UNIT_ASSUMED = mm [USER UNITS] Assumes input units LENGTH_UNIT = meters [HFSS UNITS]

[HFSS UNITS] —-> [USER UNITS]

pyEPR.ansys.var(x)[source]#