pyedb 0.55.0__py3-none-any.whl → 0.57.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyedb might be problematic. Click here for more details.

Files changed (107) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/configuration/cfg_data.py +3 -0
  3. pyedb/configuration/cfg_operations.py +2 -2
  4. pyedb/configuration/cfg_ports_sources.py +1 -1
  5. pyedb/configuration/cfg_terminals.py +232 -0
  6. pyedb/configuration/configuration.py +146 -3
  7. pyedb/dotnet/clr_module.py +1 -2
  8. pyedb/dotnet/database/Variables.py +56 -41
  9. pyedb/dotnet/database/cell/layout.py +5 -1
  10. pyedb/dotnet/database/cell/primitive/primitive.py +2 -2
  11. pyedb/dotnet/database/cell/terminal/bundle_terminal.py +12 -0
  12. pyedb/dotnet/database/cell/terminal/pingroup_terminal.py +1 -1
  13. pyedb/dotnet/database/cell/terminal/terminal.py +38 -0
  14. pyedb/dotnet/database/components.py +55 -52
  15. pyedb/dotnet/database/dotnet/database.py +1 -0
  16. pyedb/dotnet/database/edb_data/control_file.py +6 -3
  17. pyedb/dotnet/database/edb_data/nets_data.py +3 -3
  18. pyedb/dotnet/database/edb_data/padstacks_data.py +5 -2
  19. pyedb/dotnet/database/edb_data/ports.py +0 -25
  20. pyedb/dotnet/database/edb_data/primitives_data.py +3 -3
  21. pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py +18 -19
  22. pyedb/dotnet/database/edb_data/simulation_configuration.py +3 -3
  23. pyedb/dotnet/database/hfss.py +9 -8
  24. pyedb/dotnet/database/layout_validation.py +6 -3
  25. pyedb/dotnet/database/materials.py +1 -3
  26. pyedb/dotnet/database/modeler.py +7 -3
  27. pyedb/dotnet/database/nets.py +27 -19
  28. pyedb/dotnet/database/padstack.py +91 -2
  29. pyedb/dotnet/database/sim_setup_data/io/siwave.py +1 -1
  30. pyedb/dotnet/database/siwave.py +4 -3
  31. pyedb/dotnet/database/stackup.py +50 -26
  32. pyedb/dotnet/database/utilities/heatsink.py +0 -1
  33. pyedb/dotnet/database/utilities/simulation_setup.py +7 -5
  34. pyedb/dotnet/database/utilities/siwave_cpa_simulation_setup.py +1 -0
  35. pyedb/dotnet/database/utilities/siwave_simulation_setup.py +5 -2
  36. pyedb/dotnet/edb.py +41 -36
  37. pyedb/exceptions.py +1 -2
  38. pyedb/extensions/create_cell_array.py +408 -0
  39. pyedb/generic/data_handlers.py +17 -28
  40. pyedb/generic/design_types.py +25 -38
  41. pyedb/generic/filesystem.py +9 -4
  42. pyedb/generic/general_methods.py +6 -7
  43. pyedb/generic/plot.py +2 -2
  44. pyedb/generic/settings.py +4 -0
  45. pyedb/grpc/database/_typing.py +0 -0
  46. pyedb/grpc/database/components.py +30 -11
  47. pyedb/grpc/database/control_file.py +14 -35
  48. pyedb/grpc/database/definition/materials.py +1 -1
  49. pyedb/grpc/database/definition/package_def.py +6 -3
  50. pyedb/grpc/database/definition/padstack_def.py +4 -7
  51. pyedb/grpc/database/hfss.py +1 -4
  52. pyedb/grpc/database/hierarchy/component.py +3 -4
  53. pyedb/grpc/database/hierarchy/pingroup.py +16 -3
  54. pyedb/grpc/database/layers/layer.py +1 -2
  55. pyedb/grpc/database/layers/stackup_layer.py +42 -19
  56. pyedb/grpc/database/layout/layout.py +117 -28
  57. pyedb/grpc/database/layout/voltage_regulator.py +6 -1
  58. pyedb/grpc/database/layout_validation.py +7 -4
  59. pyedb/grpc/database/modeler.py +241 -256
  60. pyedb/grpc/database/net/differential_pair.py +9 -2
  61. pyedb/grpc/database/net/extended_net.py +24 -9
  62. pyedb/grpc/database/net/net.py +14 -5
  63. pyedb/grpc/database/net/net_class.py +24 -7
  64. pyedb/grpc/database/nets.py +11 -43
  65. pyedb/grpc/database/padstacks.py +92 -16
  66. pyedb/grpc/database/primitive/bondwire.py +3 -67
  67. pyedb/grpc/database/primitive/circle.py +42 -3
  68. pyedb/grpc/database/primitive/padstack_instance.py +17 -19
  69. pyedb/grpc/database/primitive/path.py +154 -5
  70. pyedb/grpc/database/primitive/polygon.py +75 -9
  71. pyedb/grpc/database/primitive/primitive.py +2 -2
  72. pyedb/grpc/database/primitive/rectangle.py +105 -4
  73. pyedb/grpc/database/simulation_setup/hfss_general_settings.py +0 -2
  74. pyedb/grpc/database/simulation_setup/hfss_settings_options.py +0 -4
  75. pyedb/grpc/database/simulation_setup/siwave_cpa_simulation_setup.py +4 -2
  76. pyedb/grpc/database/simulation_setup/sweep_data.py +1 -3
  77. pyedb/grpc/database/siwave.py +6 -13
  78. pyedb/grpc/database/source_excitations.py +49 -57
  79. pyedb/grpc/database/stackup.py +50 -27
  80. pyedb/grpc/database/terminal/bundle_terminal.py +10 -3
  81. pyedb/grpc/database/terminal/pingroup_terminal.py +8 -1
  82. pyedb/grpc/database/terminal/terminal.py +19 -8
  83. pyedb/grpc/database/utility/heat_sink.py +0 -1
  84. pyedb/grpc/database/utility/hfss_extent_info.py +2 -2
  85. pyedb/grpc/database/utility/value.py +1 -0
  86. pyedb/grpc/database/utility/xml_control_file.py +6 -3
  87. pyedb/grpc/edb.py +33 -24
  88. pyedb/grpc/edb_init.py +1 -0
  89. pyedb/grpc/rpc_session.py +4 -3
  90. pyedb/ipc2581/ecad/cad_data/layer_feature.py +6 -2
  91. pyedb/ipc2581/ecad/cad_data/step.py +1 -1
  92. pyedb/ipc2581/ipc2581.py +8 -7
  93. pyedb/libraries/common.py +3 -4
  94. pyedb/libraries/rf_libraries/base_functions.py +7 -16
  95. pyedb/libraries/rf_libraries/planar_antennas.py +3 -21
  96. pyedb/misc/downloads.py +1 -0
  97. pyedb/misc/misc.py +5 -2
  98. pyedb/misc/siw_feature_config/emc_rule_checker_settings.py +1 -1
  99. pyedb/misc/utilities.py +0 -1
  100. pyedb/modeler/geometry_operators.py +9 -8
  101. pyedb/siwave.py +4 -6
  102. pyedb/siwave_core/__init__.py +0 -0
  103. pyedb/siwave_core/cpa/__init__.py +0 -0
  104. {pyedb-0.55.0.dist-info → pyedb-0.57.0.dist-info}/METADATA +3 -3
  105. {pyedb-0.55.0.dist-info → pyedb-0.57.0.dist-info}/RECORD +107 -102
  106. {pyedb-0.55.0.dist-info → pyedb-0.57.0.dist-info}/WHEEL +0 -0
  107. {pyedb-0.55.0.dist-info → pyedb-0.57.0.dist-info}/licenses/LICENSE +0 -0
pyedb/grpc/edb.py CHANGED
@@ -371,6 +371,10 @@ class Edb(EdbInit):
371
371
  """Ansys Edb Core module."""
372
372
  return ansys.edb.core
373
373
 
374
+ @property
375
+ def ansys_em_path(self):
376
+ return self.base_path
377
+
374
378
  def _check_remove_project_files(self, edbpath: str, remove_existing_aedt: bool) -> None:
375
379
  aedt_file = os.path.splitext(edbpath)[0] + ".aedt"
376
380
  files = [aedt_file, aedt_file + ".lock"]
@@ -654,8 +658,7 @@ class Edb(EdbInit):
654
658
  bool
655
659
  True if successful, False otherwise.
656
660
  """
657
- from ansys.edb.core.layout.cell import Cell as GrpcCell
658
- from ansys.edb.core.layout.cell import CellType as GrpcCellType
661
+ from ansys.edb.core.layout.cell import Cell as GrpcCell, CellType as GrpcCellType
659
662
 
660
663
  self.standalone = self.standalone
661
664
  n_try = 10
@@ -1187,7 +1190,7 @@ class Edb(EdbInit):
1187
1190
  continue
1188
1191
  except:
1189
1192
  self.logger.warning(
1190
- f"Failed to find connected objects on layout_obj " f"{layout_object_instance.layout_obj.id}, skipping."
1193
+ f"Failed to find connected objects on layout_obj {layout_object_instance.layout_obj.id}, skipping."
1191
1194
  )
1192
1195
  pass
1193
1196
  return temp
@@ -1395,7 +1398,7 @@ class Edb(EdbInit):
1395
1398
  command = [
1396
1399
  anstranslator_full_path,
1397
1400
  inputGDS,
1398
- f'-o="{control_file_temp}"' f'-t="{tech_file}"',
1401
+ f'-o="{control_file_temp}"-t="{tech_file}"',
1399
1402
  f'-g="{map_file}"',
1400
1403
  f'-f="{layer_filter}"',
1401
1404
  ]
@@ -1564,8 +1567,11 @@ class Edb(EdbInit):
1564
1567
  voids_poly.append(void_polydata)
1565
1568
  if voids_poly:
1566
1569
  obj_data = obj_data[0].subtract(list(obj_data), voids_poly)
1567
- except:
1568
- pass
1570
+ except Exception as e:
1571
+ self.logger.error(
1572
+ f"A(n) {type(e).__name__} error occurred in method _create_conformal of "
1573
+ f"class Edb at iteration {k} for data {i}: {str(e)}"
1574
+ )
1569
1575
  finally:
1570
1576
  unite_polys.extend(list(obj_data))
1571
1577
  _poly_unite = GrpcPolygonData.unite(unite_polys)
@@ -1730,7 +1736,7 @@ class Edb(EdbInit):
1730
1736
  >>> # Create a basic cutout:
1731
1737
  >>> edb.cutout(signal_list=["Net1"], reference_list=["GND"])
1732
1738
  >>> # Create cutout with custom polygon:
1733
- >>> custom_poly = [[0,0], [10e-3,0], [10e-3,10e-3], [0,10e-3]]
1739
+ >>> custom_poly = [[0, 0], [10e-3, 0], [10e-3, 10e-3], [0, 10e-3]]
1734
1740
  >>> edb.cutout(custom_extent=custom_poly)
1735
1741
  """
1736
1742
  if expansion_factor > 0:
@@ -1936,8 +1942,8 @@ class Edb(EdbInit):
1936
1942
  if os.path.exists(source) and not os.path.exists(target):
1937
1943
  try:
1938
1944
  shutil.copy(source, target)
1939
- except:
1940
- pass
1945
+ except Exception as e:
1946
+ self.logger.error(f"Failed to copy {source} to {target} - {type(e).__name__}: {str(e)}")
1941
1947
  elif open_cutout_at_end:
1942
1948
  self._active_cell = _cutout
1943
1949
  self._init_objects()
@@ -2415,8 +2421,8 @@ class Edb(EdbInit):
2415
2421
  try:
2416
2422
  shutil.copy(source, target)
2417
2423
  self.logger.warning("aedb def file manually created.")
2418
- except:
2419
- pass
2424
+ except Exception as e:
2425
+ self.logger.error(f"Failed to copy {source} to {target} - {type(e).__name__}: {str(e)}")
2420
2426
  return [[Value(pt.x), Value(pt.y)] for pt in polygon_data.without_arcs().points]
2421
2427
 
2422
2428
  @staticmethod
@@ -2490,7 +2496,7 @@ class Edb(EdbInit):
2490
2496
  >>> # Export to HFSS project:
2491
2497
  >>> edb.export_hfss(r"C:/output", net_list=["SignalNet"])
2492
2498
  """
2493
- siwave_s = SiwaveSolve(self.edbpath)
2499
+ siwave_s = SiwaveSolve(self)
2494
2500
  return siwave_s.export_3d_cad("HFSS", path_to_output, net_list, num_cores, aedt_file_name, hidden=hidden)
2495
2501
 
2496
2502
  def export_q3d(
@@ -2526,7 +2532,7 @@ class Edb(EdbInit):
2526
2532
  >>> # Export to Q3D project:
2527
2533
  >>> edb.export_q3d(r"C:/output")
2528
2534
  """
2529
- siwave_s = SiwaveSolve(self.edbpath, aedt_installer_path=self.base_path)
2535
+ siwave_s = SiwaveSolve(self)
2530
2536
  return siwave_s.export_3d_cad(
2531
2537
  "Q3D",
2532
2538
  path_to_output,
@@ -2569,7 +2575,7 @@ class Edb(EdbInit):
2569
2575
  >>> # Export to Maxwell project:
2570
2576
  >>> edb.export_maxwell(r"C:/output")
2571
2577
  """
2572
- siwave_s = SiwaveSolve(self.edbpath, aedt_installer_path=self.base_path)
2578
+ siwave_s = SiwaveSolve(self)
2573
2579
  return siwave_s.export_3d_cad(
2574
2580
  "Maxwell",
2575
2581
  path_to_output,
@@ -2592,11 +2598,13 @@ class Edb(EdbInit):
2592
2598
  >>> # Solve with SIwave:
2593
2599
  >>> edb.solve_siwave()
2594
2600
  """
2595
- process = SiwaveSolve(self.edbpath)
2601
+ process = SiwaveSolve(self)
2596
2602
  try:
2597
2603
  self.close()
2598
- except:
2599
- pass
2604
+ except Exception as e:
2605
+ self.logger.warning(
2606
+ f"A(n) {type(e).__name__} error occurred while attempting to close the database {self}: {str(e)}"
2607
+ )
2600
2608
  process.solve()
2601
2609
  return self.edbpath[:-5] + ".siw"
2602
2610
 
@@ -2643,11 +2651,13 @@ class Edb(EdbInit):
2643
2651
  list[str]
2644
2652
  Generated report files.
2645
2653
  """
2646
- process = SiwaveSolve(self.edbpath, aedt_version=self.edbversion)
2654
+ process = SiwaveSolve(self)
2647
2655
  try:
2648
2656
  self.close()
2649
- except:
2650
- pass
2657
+ except Exception as e:
2658
+ self.logger.warning(
2659
+ f"A(n) {type(e).__name__} error occurred while attempting to close the database {self}: {str(e)}"
2660
+ )
2651
2661
  return process.export_dc_report(
2652
2662
  siwave_project,
2653
2663
  solution_name,
@@ -3005,7 +3015,7 @@ class Edb(EdbInit):
3005
3015
  Use :func:`pyedb.grpc.core.hfss.add_setup` instead.
3006
3016
  """
3007
3017
  warnings.warn(
3008
- "`create_hfss_setup` is deprecated and is now located here " "`pyedb.grpc.core.hfss.add_setup` instead.",
3018
+ "`create_hfss_setup` is deprecated and is now located here `pyedb.grpc.core.hfss.add_setup` instead.",
3009
3019
  DeprecationWarning,
3010
3020
  )
3011
3021
  return self._hfss.add_setup(
@@ -3753,8 +3763,7 @@ class Edb(EdbInit):
3753
3763
  ]
3754
3764
  if not polys:
3755
3765
  self.logger.error(
3756
- f"No polygon found with voids on layer {reference_layer} during model creation for "
3757
- f"arbitrary wave ports"
3766
+ f"No polygon found with voids on layer {reference_layer} during model creation for arbitrary wave ports"
3758
3767
  )
3759
3768
  return False
3760
3769
  void_padstacks = []
@@ -3767,7 +3776,7 @@ class Edb(EdbInit):
3767
3776
 
3768
3777
  if not void_padstacks:
3769
3778
  self.logger.error(
3770
- "No padstack instances found inside evaluated voids during model creation for arbitrary" "waveports"
3779
+ "No padstack instances found inside evaluated voids during model creation for arbitrary waveports"
3771
3780
  )
3772
3781
  return False
3773
3782
  cloned_edb = Edb(edbpath=output_edb, edbversion=self.edbversion, restart_rpc_server=True)
pyedb/grpc/edb_init.py CHANGED
@@ -22,6 +22,7 @@
22
22
 
23
23
 
24
24
  """Database."""
25
+
25
26
  import atexit
26
27
  import os
27
28
  import signal
pyedb/grpc/rpc_session.py CHANGED
@@ -21,7 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  import os
24
- from random import randint
24
+ import secrets
25
25
  import sys
26
26
  import time
27
27
 
@@ -170,11 +170,12 @@ class RpcSession:
170
170
  @staticmethod
171
171
  def __get_random_free_port():
172
172
  """"""
173
- port = randint(49152, 65535)
173
+ secure_random = secrets.SystemRandom()
174
+ port = secure_random.randint(49152, 65535)
174
175
  while True:
175
176
  used_ports = [conn.laddr[1] for conn in psutil.net_connections()]
176
177
  if port in used_ports:
177
- port = randint(49152, 65535)
178
+ port = secure_random.randint(49152, 65535)
178
179
  else:
179
180
  break
180
181
  return port
@@ -23,6 +23,7 @@
23
23
  import math
24
24
 
25
25
  from pyedb.generic.general_methods import ET
26
+ from pyedb.generic.settings import settings
26
27
  from pyedb.ipc2581.ecad.cad_data.feature import Feature, FeatureType
27
28
 
28
29
 
@@ -99,8 +100,11 @@ class LayerFeature(object):
99
100
  )
100
101
  )
101
102
  self.features.append(feature)
102
- except:
103
- pass
103
+ except Exception as e:
104
+ settings.logger.warning(
105
+ f"A(n) {type(e).__name__} error occurred while attempting to append IPC2581 "
106
+ f"feature {feature} to features of object {self}: {str(e)}"
107
+ )
104
108
 
105
109
  def add_drill_feature(self, via, diameter=0.0): # pragma no cover
106
110
  feature = Feature(self._ipc, self._pedb)
@@ -262,7 +262,7 @@ class Step(object):
262
262
  start_layer, stop_layer = padstack_instance.get_layer_range()
263
263
  for layer_name in self.layer_ranges(start_layer, stop_layer):
264
264
  if layer_name not in layers:
265
- layer_feature = LayerFeature(self._ipc)
265
+ layer_feature = LayerFeature(self._ipc, self._pedb)
266
266
  layer_feature.layer_name = layer_name
267
267
  # layer_feature.color = self._ipc._pedb.stackup[layer_name].color
268
268
  layer_feature.color = layer_colors[layer_name]
pyedb/ipc2581/ipc2581.py CHANGED
@@ -89,9 +89,9 @@ class Ipc2581(object):
89
89
  self.from_meter_to_units(pad.parameters_values[0], self.units)
90
90
  )
91
91
  if not primitive_ref in self.content.standard_geometries_dict.standard_circ_dict:
92
- self.content.standard_geometries_dict.standard_circ_dict[
93
- primitive_ref
94
- ] = self.from_meter_to_units(pad.parameters_values[0], self.units)
92
+ self.content.standard_geometries_dict.standard_circ_dict[primitive_ref] = (
93
+ self.from_meter_to_units(pad.parameters_values[0], self.units)
94
+ )
95
95
  elif pad.geometry_type == 2:
96
96
  primitive_ref = "RECT_{}_{}".format(
97
97
  self.from_meter_to_units(pad.parameters_values[0], self.units),
@@ -135,9 +135,9 @@ class Ipc2581(object):
135
135
  self.from_meter_to_units(antipad.parameters_values[0], self.units)
136
136
  )
137
137
  if not primitive_ref in self.content.standard_geometries_dict.standard_circ_dict:
138
- self.content.standard_geometries_dict.standard_circ_dict[
139
- primitive_ref
140
- ] = self.from_meter_to_units(antipad.parameters_values[0], self.units)
138
+ self.content.standard_geometries_dict.standard_circ_dict[primitive_ref] = (
139
+ self.from_meter_to_units(antipad.parameters_values[0], self.units)
140
+ )
141
141
  elif antipad.geometry_type == 2:
142
142
  primitive_ref = "RECT_{}_{}".format(
143
143
  self.from_meter_to_units(antipad.parameters_values[0], self.units),
@@ -336,7 +336,8 @@ class Ipc2581(object):
336
336
  padstack_defs = {i: k for i, k in self._pedb.padstacks.definitions.items()}
337
337
  polys = {i: j for i, j in self._pedb.modeler.primitives_by_layer.items()}
338
338
  for layer_name, layer in layers.items():
339
- self.ecad.cad_data.cad_data_step.add_layer_feature(layer, polys[layer_name])
339
+ if layer_name in polys:
340
+ self.ecad.cad_data.cad_data_step.add_layer_feature(layer, polys[layer_name])
340
341
  self.ecad.cad_data.cad_data_step.add_padstack_instances(padstack_instances, padstack_defs)
341
342
 
342
343
  def add_drills(self):
pyedb/libraries/common.py CHANGED
@@ -45,8 +45,7 @@ class Substrate:
45
45
 
46
46
  Examples
47
47
  --------
48
- >>> sub = Substrate(h=1.6e-3, er=4.4, tan_d=0.02,
49
- ... name="FR4", size=(10e-3, 15e-3))
48
+ >>> sub = Substrate(h=1.6e-3, er=4.4, tan_d=0.02, name="FR4", size=(10e-3, 15e-3))
50
49
  >>> sub.h
51
50
  0.0016
52
51
  """
@@ -84,7 +83,7 @@ class Material:
84
83
  >>> m = Material(edb, "MyMaterial")
85
84
  >>> m.name
86
85
  'MyMaterial'
87
- >>> edb.materials["MyMaterial"] # now exists in the database
86
+ >>> edb.materials["MyMaterial"] # now exists in the database
88
87
  <Material object at ...>
89
88
  """
90
89
 
@@ -125,7 +124,7 @@ class Conductor(Material):
125
124
  >>> cu = Conductor(edb, "Copper", conductivity=5.8e7)
126
125
  >>> cu.conductivity
127
126
  58000000.0
128
- >>> cu.conductivity = 3.5e7 # update on-the-fly
127
+ >>> cu.conductivity = 3.5e7 # update on-the-fly
129
128
  >>> edb.materials["Copper"].conductivity
130
129
  35000000.0
131
130
  """
@@ -50,8 +50,7 @@ class HatchGround:
50
50
 
51
51
  Examples
52
52
  --------
53
- >>> hatch = HatchGround(pitch=0.5e-3, width=0.2e-3,
54
- ... fill_target=70, board_size=5e-3)
53
+ >>> hatch = HatchGround(pitch=0.5e-3, width=0.2e-3, fill_target=70, board_size=5e-3)
55
54
  >>> edb = Edb("demo.aedb")
56
55
  >>> hatch._edb = edb
57
56
  >>> hatch.create()
@@ -164,8 +163,7 @@ class Meander:
164
163
 
165
164
  Examples
166
165
  --------
167
- >>> m = Meander(pitch=0.2e-3, trace_width=0.15e-3,
168
- ... amplitude=2e-3, num_turns=4)
166
+ >>> m = Meander(pitch=0.2e-3, trace_width=0.15e-3, amplitude=2e-3, num_turns=4)
169
167
  >>> edb = Edb("meander.aedb")
170
168
  >>> m._pedb = edb
171
169
  >>> m.create()
@@ -293,7 +291,7 @@ class MIMCapacitor:
293
291
  >>> edb = Edb("mim.aedb")
294
292
  >>> cap._pedb = edb
295
293
  >>> cap.create()
296
- >>> f"{cap.capacitance_f*1e12:.2f} pF"
294
+ >>> f"{cap.capacitance_f * 1e12:.2f} pF"
297
295
  '1.45 pF'
298
296
  """
299
297
 
@@ -383,8 +381,7 @@ class SpiralInductor:
383
381
 
384
382
  Examples
385
383
  --------
386
- >>> sp = SpiralInductor(turns=3.5, trace_width=25e-6,
387
- ... inner_diameter=80e-6)
384
+ >>> sp = SpiralInductor(turns=3.5, trace_width=25e-6, inner_diameter=80e-6)
388
385
  >>> edb = Edb("spiral.aedb")
389
386
  >>> sp._pedb = edb
390
387
  >>> sp.create()
@@ -769,7 +766,7 @@ class RatRace:
769
766
  >>> edb = Edb("ratrace.aedb")
770
767
  >>> rr._pedb = edb
771
768
  >>> rr.create()
772
- >>> f"{rr.circumference*1e3:.2f} mm"
769
+ >>> f"{rr.circumference * 1e3:.2f} mm"
773
770
  '45.00 mm'
774
771
  """
775
772
 
@@ -958,9 +955,7 @@ class InterdigitalCapacitor:
958
955
 
959
956
  Examples
960
957
  --------
961
- >>> idc = InterdigitalCapacitor(fingers=10,
962
- ... finger_length="0.5mm",
963
- ... gap="0.03mm")
958
+ >>> idc = InterdigitalCapacitor(fingers=10, finger_length="0.5mm", gap="0.03mm")
964
959
  >>> edb = Edb("idc.aedb")
965
960
  >>> idc._pedb = edb
966
961
  >>> idc.create()
@@ -1104,11 +1099,7 @@ class DifferentialTLine:
1104
1099
 
1105
1100
  Examples
1106
1101
  --------
1107
- >>> diff = DifferentialTLine(Edb("diff.aedb"),
1108
- ... length=5e-3,
1109
- ... width=0.15e-3,
1110
- ... spacing=0.1e-3,
1111
- ... angle=math.pi/4)
1102
+ >>> diff = DifferentialTLine(Edb("diff.aedb"), length=5e-3, width=0.15e-3, spacing=0.1e-3, angle=math.pi / 4)
1112
1103
  >>> traces = diff.create()
1113
1104
  >>> f"{diff.diff_impedance:.1f} Ω"
1114
1105
  '95.6 Ω'
@@ -66,13 +66,7 @@ class RectangularPatch:
66
66
  Build a 5.8 GHz patch on a 0.787 mm Rogers RO4350B substrate:
67
67
 
68
68
  >>> edb = pyedb.Edb()
69
- >>> patch = RectangularPatch(
70
- ... edb_cell=edb,
71
- ... freq="5.8GHz",
72
- ... inset="4.2mm",
73
- ... layer="TOP",
74
- ... bottom_layer="GND"
75
- ... )
69
+ >>> patch = RectangularPatch(edb_cell=edb, freq="5.8GHz", inset="4.2mm", layer="TOP", bottom_layer="GND")
76
70
  >>> patch.substrate.er = 3.66
77
71
  >>> patch.substrate.tand = 0.0037
78
72
  >>> patch.substrate.h = 0.000787
@@ -248,13 +242,7 @@ class CircularPatch:
248
242
  Build a 5.8 GHz circular patch on a 0.787 mm Rogers RO4350B substrate:
249
243
 
250
244
  >>> edb = pyedb.Edb()
251
- >>> patch = CircularPatch(
252
- ... edb_cell=edb,
253
- ... freq="5.8GHz",
254
- ... probe_offset="6.4mm",
255
- ... layer="TOP",
256
- ... bottom_layer="GND"
257
- ... )
245
+ >>> patch = CircularPatch(edb_cell=edb, freq="5.8GHz", probe_offset="6.4mm", layer="TOP", bottom_layer="GND")
258
246
  >>> patch.substrate.er = 3.66
259
247
  >>> patch.substrate.tand = 0.0037
260
248
  >>> patch.substrate.h = 0.000787
@@ -425,13 +413,7 @@ class TriangularPatch:
425
413
  Build a 5.8 GHz triangular patch on a 0.787 mm Rogers RO4350B substrate:
426
414
 
427
415
  >>> edb = pyedb.Edb()
428
- >>> patch = TriangularPatch(
429
- ... edb_cell=edb,
430
- ... freq="5.8GHz",
431
- ... probe_offset="5.6mm",
432
- ... layer="TOP",
433
- ... bottom_layer="GND"
434
- ... )
416
+ >>> patch = TriangularPatch(edb_cell=edb, freq="5.8GHz", probe_offset="5.6mm", layer="TOP", bottom_layer="GND")
435
417
  >>> patch.substrate.er = 3.66
436
418
  >>> patch.substrate.tand = 0.0037
437
419
  >>> patch.substrate.h = 0.000787
pyedb/misc/downloads.py CHANGED
@@ -21,6 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  """Download example datasets from https://github.com/pyansys/example-data"""
24
+
24
25
  import os
25
26
  import shutil
26
27
  import tempfile
pyedb/misc/misc.py CHANGED
@@ -21,9 +21,12 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  """Miscellaneous Methods for PyEDB."""
24
+
24
25
  import os
25
26
  import warnings
26
27
 
28
+ from pyedb.generic.settings import settings
29
+
27
30
 
28
31
  def list_installed_ansysem():
29
32
  """Return a list of installed AEDT versions on ``ANSYSEM_ROOT``."""
@@ -68,8 +71,8 @@ def installed_versions():
68
71
  else:
69
72
  v_key = "20{0}.{1}".format(version, release)
70
73
  return_dict[v_key] = os.environ[version_env_var]
71
- except: # pragma: no cover
72
- pass
74
+ except Exception: # pragma: no cover
75
+ settings.logger.debug(f"Failed to parse version and release from {current_version_id}")
73
76
  return return_dict
74
77
 
75
78
 
@@ -66,7 +66,7 @@ class EMCRuleCheckerSettings:
66
66
  tree = ET.ElementTree(root)
67
67
  try:
68
68
  ET.indent(tree, space="\t", level=0)
69
- except: # pragma no cover
69
+ except AttributeError: # pragma no cover
70
70
  pass
71
71
  return tree
72
72
 
pyedb/misc/utilities.py CHANGED
@@ -22,7 +22,6 @@
22
22
 
23
23
  """Module gathering utility functions for PyEDB modules."""
24
24
 
25
-
26
25
  import math
27
26
 
28
27
 
@@ -62,12 +62,12 @@ class GeometryOperators(object):
62
62
  Parse `'"2mm"'`.
63
63
 
64
64
  >>> from pyedb.modeler.geometry_operators import GeometryOperators as go
65
- >>> go.parse_dim_arg('2mm')
65
+ >>> go.parse_dim_arg("2mm")
66
66
  >>> 0.002
67
67
 
68
68
  Use the optional argument ``scale_to_unit`` to specify the destination unit.
69
69
 
70
- >>> go.parse_dim_arg('2mm', scale_to_unit='mm')
70
+ >>> go.parse_dim_arg("2mm", scale_to_unit="mm")
71
71
  >>> 2.0
72
72
 
73
73
  """
@@ -1456,9 +1456,8 @@ class GeometryOperators(object):
1456
1456
  cross = GeometryOperators.v_cross(va, vb)
1457
1457
  if GeometryOperators.v_norm(cross) < tol:
1458
1458
  return math.pi
1459
- assert GeometryOperators.is_collinear(cross, vn), (
1460
- "vn must be the normal to the " "plane containing va and vb."
1461
- ) # pragma: no cover
1459
+ if not GeometryOperators.is_collinear(cross, vn):
1460
+ raise ValueError("vn must be the normal to the plane containing va and vb") # pragma: no cover
1462
1461
 
1463
1462
  vnn = GeometryOperators.normalize_vector(vn)
1464
1463
  if right_handed:
@@ -1589,6 +1588,7 @@ class GeometryOperators(object):
1589
1588
  ``True`` if the segments are intersecting.
1590
1589
  ``False`` otherwise.
1591
1590
  """
1591
+
1592
1592
  # fmt: off
1593
1593
  def on_segment(p, q, r):
1594
1594
  # Given three collinear points p, q, r, the function checks if point q lies on line-segment 'pr'
@@ -1672,10 +1672,11 @@ class GeometryOperators(object):
1672
1672
  float
1673
1673
  ``True`` if the segment intersect the polygon. ``False`` otherwise.
1674
1674
  """
1675
- assert len(a) == 2, "point must be a list in the form [x, y]"
1676
- assert len(b) == 2, "point must be a list in the form [x, y]"
1675
+ if len(a) != 2 or len(b) != 2:
1676
+ raise ValueError("Point must be a list in the form [x, y]")
1677
1677
  pl = len(polygon[0])
1678
- assert len(polygon[1]) == pl, "Polygon x and y lists must be the same length"
1678
+ if len(polygon[1]) != pl:
1679
+ raise ValueError("The two sublists in polygon must have the same length")
1679
1680
 
1680
1681
  a_in = GeometryOperators.is_point_in_polygon(a, polygon)
1681
1682
  b_in = GeometryOperators.is_point_in_polygon(b, polygon)
pyedb/siwave.py CHANGED
@@ -129,17 +129,15 @@ class Siwave(object): # pragma no cover
129
129
  self._main.AEDTVersion = self._main.oSiwave.GetVersion()[0:6]
130
130
  self._main.oSiwave.RestoreWindow()
131
131
  specified_version = self.current_version
132
- assert specified_version in self.version_keys, "Specified version {} is not known.".format(
133
- specified_version
134
- )
132
+ if specified_version not in self.version_keys:
133
+ raise ValueError("Specified version {} is not known.".format(specified_version))
135
134
  version_key = specified_version
136
135
  base_path = os.getenv(self._version_ids[specified_version])
137
136
  self._main.sDesktopinstallDirectory = base_path
138
137
  else:
139
138
  if specified_version:
140
- assert specified_version in self.version_keys, "Specified version {} is not known.".format(
141
- specified_version
142
- )
139
+ if specified_version not in self.version_keys:
140
+ raise ValueError("Specified version {} is not known.".format(specified_version))
143
141
  version_key = specified_version
144
142
  else:
145
143
  version_key = self.current_version
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyedb
3
- Version: 0.55.0
3
+ Version: 0.57.0
4
4
  Summary: Higher-Level Pythonic Ansys Electronics Data Base
5
5
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
6
  Maintainer-email: PyEDB developers <simon.vandenbrouck@ansys.com>
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  License-File: LICENSE
19
- Requires-Dist: cffi>=1.16.0,<1.18; platform_system=='Linux'
19
+ Requires-Dist: cffi>=1.16.0,<2.1; platform_system=='Linux'
20
20
  Requires-Dist: pywin32 >= 303;platform_system=='Windows'
21
21
  Requires-Dist: ansys-pythonnet >= 3.1.0rc4
22
22
  Requires-Dist: dotnetcore2 ==3.1.23;platform_system=='Linux'
@@ -52,7 +52,7 @@ Requires-Dist: shapely ; extra == "full"
52
52
  Requires-Dist: matplotlib>=3.5.0,<3.11 ; extra == "tests"
53
53
  Requires-Dist: mock>=5.1.0,<5.3 ; extra == "tests"
54
54
  Requires-Dist: pytest>=7.4.0,<8.5 ; extra == "tests"
55
- Requires-Dist: pytest-cov>=4.0.0,<6.3 ; extra == "tests"
55
+ Requires-Dist: pytest-cov>=4.0.0,<7.1 ; extra == "tests"
56
56
  Requires-Dist: pytest-xdist>=3.5.0,<3.7 ; extra == "tests"
57
57
  Requires-Dist: scikit-rf ; extra == "tests"
58
58
  Requires-Dist: shapely ; extra == "tests"