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 https://github.com/PhilReinhold/pyHFSS
class pyEPR.ansys.AnsysQ3DSetup(design, setup: str)[source]

Bases: pyEPR.ansys.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)

Use: Solves a single solution setup and all of its frequency sweeps. Command: Right-click a solution setup in the project tree, and then click Analyze

on the shortcut menu.

Syntax: Analyze(<SetupName>) Parameters: <setupName> Return Value: None —————————————————–

Will block the until the analysis is completely done. Will raise a com_error if analysis is aborted in HFSS.

basis_order
commit_convergence_exprs()

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

delete_sweep(name)
delta_f
frequency
get_convergence(variation='')[source]
Returns df
# Triangle Delta %

Pass 1 164 NaN

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]
variation: an empty string returns nominal variation.
Otherwise need the list

frequency: in Hz soln_type = “C”, “AC RL” and “DC RL” solution_kind = ‘LastAdaptive’ # AdaptivePass

Uses self.solution_name = Setup1 : LastAdaptive
df_cmat, user_units, (df_cond, units_cond), design_variation
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:{[str or Path]} -- [path to file text with matrix] (path) –
Returns:df_cmat, user_units, (df_cond, units_cond), design_variation

dataframes: df_cmat, df_cond

max_pass
min_freq
min_pass
n_modes = 0
passes
pct_error
pct_refinement
prop_holder = None
prop_server = None
prop_tab = 'CG'
release()
solve(name=None)
Use: Performs a blocking simulation.
The next script command will not be executed until the simulation is complete.

Command: HFSS>Analyze Syntax: Solve <SetupNameArray> Return Value: Type: <int>

-1: simulation error 0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, …)
<SetupName>

Type: <string> Name of the solution setup to solve. .. rubric:: Example

return_status = oDesign.Solve Array(“Setup1”, “Setup2”)

HFSS abort: still returns 0 , since termination by user.

class pyEPR.ansys.Box(name, modeler, corner, size)[source]

Bases: pyEPR.ansys.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()

Return a centered string of length width.

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

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()

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()

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.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “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 the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

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()

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()

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()

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.

material
model_command = 'CreateBox'
partition()

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.

position
prop_holder = None
prop_server = None
prop_tab = 'Geometry3DCmdTab'
release()
replace()

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()

Return a right-justified string of length width.

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

rpartition()

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()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip()

Return a copy of the string with trailing whitespace removed.

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

split()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.
splitlines()

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()

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()

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.

transparency
upper()

Return a copy of the string converted to uppercase.

wireframe
x_size
y_size
z_size
zfill()

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: pyEPR.ansys.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: pyEPR.ansys.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: pyEPR.ansys.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: pyEPR.ansys.COMWrapper

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

Bases: pyEPR.ansys.HfssDesignSolutions

get_valid_solution_list()

Gets all available solution names that exist in a design. Return example:

(‘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: pyEPR.ansys.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)

Use: Solves a single solution setup and all of its frequency sweeps. Command: Right-click a solution setup in the project tree, and then click Analyze

on the shortcut menu.

Syntax: Analyze(<SetupName>) Parameters: <setupName> Return Value: None —————————————————–

Will block the until the analysis is completely done. Will raise a com_error if analysis is aborted in HFSS.

basis_order
commit_convergence_exprs()

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

delete_sweep(name)
delta_f
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)
min_freq
n_modes
passes
pct_refinement
prop_holder = None
prop_server = None
prop_tab = 'HfssTab'
release()

type: linked_setup <HfssSetup>

solution_freq
solve(name=None)
Use: Performs a blocking simulation.
The next script command will not be executed until the simulation is complete.

Command: HFSS>Analyze Syntax: Solve <SetupNameArray> Return Value: Type: <int>

-1: simulation error 0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, …)
<SetupName>

Type: <string> Name of the solution setup to solve. .. rubric:: Example

return_status = oDesign.Solve Array(“Setup1”, “Setup2”)

HFSS abort: still returns 0 , since termination by user.

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

Bases: pyEPR.ansys.HfssDesignSolutions

get_valid_solution_list()

Gets all available solution names that exist in a design. Return example:

(‘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: pyEPR.ansys.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)

Use: Solves a single solution setup and all of its frequency sweeps. Command: Right-click a solution setup in the project tree, and then click Analyze

on the shortcut menu.

Syntax: Analyze(<SetupName>) Parameters: <setupName> Return Value: None —————————————————–

Will block the until the analysis is completely done. Will raise a com_error if analysis is aborted in HFSS.

basis_order
commit_convergence_exprs()

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

delete_sweep(name)
delta_f
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)
min_freq
n_modes
passes
pct_refinement
prop_holder = None
prop_server = None
prop_tab = 'HfssTab'
release()

type: linked_setup <HfssSetup>

solution_freq
solve(name=None)
Use: Performs a blocking simulation.
The next script command will not be executed until the simulation is complete.

Command: HFSS>Analyze Syntax: Solve <SetupNameArray> Return Value: Type: <int>

-1: simulation error 0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, …)
<SetupName>

Type: <string> Name of the solution setup to solve. .. rubric:: Example

return_status = oDesign.Solve Array(“Setup1”, “Setup2”)

HFSS abort: still returns 0 , since termination by user.

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

Bases: pyEPR.ansys.COMWrapper

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]

DeleteFullVariation Use: Use to selectively make deletions or delete all solution data. Command: HFSS>Results>Clean Up Solutions… Syntax: DeleteFullVariation Array(<parameters>), boolean Parameters: All | <DataSpecifierArray>

If, All, all data of existing variations is deleted. Array(<DesignVariationKey>, ) <DesignVariationKey>

Type: <string> Design variation string.

<Boolean> Type: boolean 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 type:HfssSetup
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]
set_variable(name: str, value: str, postprocessing=False)[source]

Warning: THis is case sensitive,

Parameters:
  • {str} -- Name of variable to set, such as 'Lj_1'. (name) – This is not the same as as ‘LJ_1’. You must use the same casing.
  • {str} -- Value, such as '10nH' (value) –
Keyword Arguments:
 

{bool} -- Postprocessing variable only or not. (postprocessing) – (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: pyEPR.ansys.COMWrapper

get_valid_solution_list()[source]

Gets all available solution names that exist in a design. Return example:

(‘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: pyEPR.ansys.COMWrapper

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

Use: Collects the messages from a specified project and design. Syntax: GetMessages <ProjectName>, <DesignName>, <SeverityName> Return Value: A simple array of strings.

Parameters: <ProjectName>

Type:<string> Name of the project for which to collect messages. An incorrect project name results in no messages (design is ignored) An empty project name results in all messages (design is ignored)
<DesignName>
Type: <string> Name of the design in the named project for which to collect messages An incorrect design name results in no messages for the named project An empty design name results in all messages for the named project
<SeverityName>

Type: <integer> Severity is 0-3, and is tied in to info/warning/error/fatal types as follows:

0 is info and above 1 is warning and above 2 is error and fatal 3 is fatal only (rarely used)
get_project_names()[source]
get_projects()[source]
get_version()[source]
library_directory
new_project()[source]
open_project(path)[source]

returns error if already open

project_count()[source]
project_directory
release()
set_active_project(name)[source]
temp_directory
class pyEPR.ansys.HfssEMDesignSolutions(setup, solutions)[source]

Bases: pyEPR.ansys.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()

Gets all available solution names that exist in a design. Return example:

(‘Setup1 : AdaptivePass’, ‘Setup1 : LastAdaptive’)
has_fields(variation_string=None)[source]

Determine if fields exist for a particular solution.

variation_string : str | None

This must the string that describes the variation in hFSS, not 0 or 1, but the string of variables, such as

“Cj=’2fF’ Lj=’12.75nH’”

If None, gets 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: pyEPR.ansys.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)

Use: Solves a single solution setup and all of its frequency sweeps. Command: Right-click a solution setup in the project tree, and then click Analyze

on the shortcut menu.

Syntax: Analyze(<SetupName>) Parameters: <setupName> Return Value: None —————————————————–

Will block the until the analysis is completely done. Will raise a com_error if analysis is aborted in HFSS.

basis_order
commit_convergence_exprs()

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

delete_sweep(name)
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)
min_freq
n_modes
passes
pct_refinement
prop_holder = None
prop_server = None
prop_tab = 'HfssTab'
release()
solve(name=None)
Use: Performs a blocking simulation.
The next script command will not be executed until the simulation is complete.

Command: HFSS>Analyze Syntax: Solve <SetupNameArray> Return Value: Type: <int>

-1: simulation error 0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, …)
<SetupName>

Type: <string> Name of the solution setup to solve. .. rubric:: Example

return_status = oDesign.Solve Array(“Setup1”, “Setup2”)

HFSS abort: still returns 0 , since termination by user.

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

Bases: pyEPR.ansys.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: pyEPR.ansys.COMWrapper

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

Bases: pyEPR.ansys.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_name : name 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]

Draws a closed or open polyline. If closed = True, then will make into a sheet. points : need to be in the correct units

For optional arguments, see _attributes_array; these include: ```

nonmodel=False, wireframe=False, color=None, transparency=0.9, material=None, # str solve_inside=None, # bool coordinate_system=”Global”

```

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]

Use: Returns the objects for the specified group. Return Value: The objects in the group. Parameters: <groupName> Type: <string> One of <materialName>, <assignmentName>, “Non Model”,

“Solids”, “Unclassi­fied”, “Sheets”, “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: pyEPR.ansys.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]
name
new_design(design_name, solution_type, design_type='HFSS')[source]
new_dm_design(name: str)[source]

Create a new driven model design

Parameters:name (str) – Name of driven modal design
new_em_design(name: str)[source]

Create a new eigenmode design

Parameters:name (str) – Name of eigenmode design
new_q3d_design(name: str)[source]

Create a new Q3D design. :param name: Name of Q3D design :type name: str

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

Bases: pyEPR.ansys.COMWrapper

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

Bases: pyEPR.ansys.HfssDesignSolutions

get_valid_solution_list()

Gets all available solution names that exist in a design. Return example:

(‘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: pyEPR.ansys.COMWrapper

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

Bases: pyEPR.ansys.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]

Use: Solves a single solution setup and all of its frequency sweeps. Command: Right-click a solution setup in the project tree, and then click Analyze

on the shortcut menu.

Syntax: Analyze(<SetupName>) Parameters: <setupName> Return Value: None —————————————————–

Will block the until the analysis is completely done. Will raise a com_error if analysis is aborted in HFSS.

basis_order
commit_convergence_exprs()[source]

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

delete_sweep(name)[source]
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]
min_freq
n_modes
passes
pct_refinement
prop_holder = None
prop_server = None
prop_tab = 'HfssTab'
release()
solve(name=None)[source]
Use: Performs a blocking simulation.
The next script command will not be executed until the simulation is complete.

Command: HFSS>Analyze Syntax: Solve <SetupNameArray> Return Value: Type: <int>

-1: simulation error 0: normal completion
Parameters: <SetupNameArray>: Array(<SetupName>, <SetupName>, …)
<SetupName>

Type: <string> Name of the solution setup to solve. .. rubric:: Example

return_status = oDesign.Solve Array(“Setup1”, “Setup2”)

HFSS abort: still returns 0 , since termination by user.

class pyEPR.ansys.ModelEntity(val, modeler)[source]

Bases: str, pyEPR.ansys.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()

Return a centered string of length width.

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

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()

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()

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.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “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 the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

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()

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()

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()

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.

material
model_command = None
partition()

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()
replace()

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()

Return a right-justified string of length width.

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

rpartition()

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()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip()

Return a copy of the string with trailing whitespace removed.

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

split()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.
splitlines()

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()

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()

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.

transparency
upper()

Return a copy of the string converted to uppercase.

wireframe
zfill()

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: pyEPR.ansys.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(name, modeler, points=None)[source]

Bases: pyEPR.ansys.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()

Return a centered string of length width.

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

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()

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()

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.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “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 the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

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()

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()

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()

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.

material
model_command = 'CreatePolyline'
partition()

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()
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()

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()

Return a right-justified string of length width.

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

rpartition()

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()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip()

Return a copy of the string with trailing whitespace removed.

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

show_direction
split()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.
splitlines()

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()

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()

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.

transparency
upper()

Return a copy of the string converted to uppercase.

vertices()[source]
wireframe
zfill()

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: pyEPR.ansys.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, setup_type=’parametric_file’, pass in a file name and path to swp_params like “C:test.csv” or “C:test.txt” for example.

Example csv formatting: *,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(name, modeler, points=None)[source]

Bases: pyEPR.ansys.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()

Return a centered string of length width.

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

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()

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()

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.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “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 the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

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()

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()

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()

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.

material
model_command = 'CreatePolyline'
partition()

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()
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()

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()

Return a right-justified string of length width.

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

rpartition()

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()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip()

Return a copy of the string with trailing whitespace removed.

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

split()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.
splitlines()

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()

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()

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.

transparency
unite(list_other)[source]
upper()

Return a copy of the string converted to uppercase.

vertices()[source]
wireframe
zfill()

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(name, modeler, corner, size)[source]

Bases: pyEPR.ansys.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()

Return a centered string of length width.

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

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()

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()

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.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “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 the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

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()

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()

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()

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.

material
model_command = 'CreateRectangle'
partition()

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()
replace()

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()

Return a right-justified string of length width.

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

rpartition()

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()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip()

Return a copy of the string with trailing whitespace removed.

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

split()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.
splitlines()

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()

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()

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.

transparency
upper()

Return a copy of the string converted to uppercase.

wireframe
zfill()

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()

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()

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()

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.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “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 the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

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()

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()

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()

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()

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.

replace()

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()

Return a right-justified string of length width.

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

rpartition()

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()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.

Splits are done starting at the end of the string and working to the front.

rstrip()

Return a copy of the string with trailing whitespace removed.

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

split()

Return a list of the words in the string, using sep as the delimiter string.

sep
The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.
maxsplit
Maximum number of splits to do. -1 (the default value) means no limit.
splitlines()

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()

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()

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()

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]