12
12
from shapely .geometry import LineString , Polygon
13
13
from shapely .plotting import plot_line , plot_polygon
14
14
from tidy3d .components .data .monitor_data import FreqDataArray
15
- from tidy3d .components .microwave .data . monitor_data import AntennaMetricsData
15
+ from tidy3d .components .microwave .auto_path_spec import AutoPathSpec
16
16
from tidy3d .components .microwave .formulas .circuit_parameters import (
17
17
capacitance_colinear_cylindrical_wire_segments ,
18
18
capacitance_rectangular_sheets ,
@@ -200,8 +200,10 @@ def make_mw_sim(
200
200
return sim
201
201
202
202
203
- def plot_auto_path_spec (path_spec : td .CompositePathSpec , geoms : list [Shapely ], ax : Ax = None ) -> Ax :
204
- """Helper to plot composite path specificiations along with the Shapely geometries used to generate them."""
203
+ def plot_auto_path_spec (
204
+ path_spec : td .CompositeCurrentIntegralSpec , geoms : list [Shapely ], ax : Ax = None
205
+ ) -> Ax :
206
+ """Helper to plot composite path specifications along with the Shapely geometries used to generate them."""
205
207
if ax is None :
206
208
_ , ax = plt .subplots (1 , 1 , tight_layout = True , figsize = (15 , 15 ))
207
209
@@ -260,7 +262,7 @@ def test_antenna_parameters():
260
262
f = directivity_data .coords ["f" ]
261
263
power_inc = FreqDataArray (0.8 * np .ones (len (f )), coords = {"f" : f })
262
264
power_refl = 0.25 * power_inc
263
- antenna_params = AntennaMetricsData .from_directivity_data (
265
+ antenna_params = td . AntennaMetricsData .from_directivity_data (
264
266
directivity_data , power_inc , power_refl
265
267
)
266
268
@@ -318,7 +320,7 @@ def test_auto_path_spec_canonical_shapes(colocate, tline_type):
318
320
sim = make_mw_sim (False , colocate , tline_type )
319
321
mode_monitor = sim .monitors [0 ]
320
322
modal_plane = td .Box (center = mode_monitor .center , size = mode_monitor .size )
321
- comp_path_spec , geos = td . AutoPathSpec .create_current_path_specs (
323
+ comp_path_spec , geos = AutoPathSpec .create_current_path_specs (
322
324
modal_plane ,
323
325
sim .structures ,
324
326
sim .grid ,
@@ -378,7 +380,7 @@ def test_auto_path_spec_advanced(use_2D, symmetry):
378
380
mode_monitor = sim .monitors [0 ]
379
381
380
382
modal_plane = td .Box (center = mode_monitor .center , size = mode_monitor .size )
381
- comp_path_spec , geos = td . AutoPathSpec .create_current_path_specs (
383
+ comp_path_spec , geos = AutoPathSpec .create_current_path_specs (
382
384
modal_plane ,
383
385
sim .structures ,
384
386
sim .grid ,
@@ -408,11 +410,11 @@ def test_auto_path_spec_validation():
408
410
# First some quick sanity checks with the helper
409
411
test_path = td .Box (center = (0 , 0 , 0 ), size = (0 , 0.9 , 0.1 ))
410
412
test_shapely = [LineString ([(- 1 , 0 ), (1 , 0 )])]
411
- assert td . AutoPathSpec ._check_path_intersects_with_conductors (test_shapely , test_path )
413
+ assert AutoPathSpec ._check_path_intersects_with_conductors (test_shapely , test_path )
412
414
413
415
test_path = td .Box (center = (0 , 0 , 0 ), size = (0 , 2.1 , 0.1 ))
414
416
test_shapely = [LineString ([(- 1 , 0 ), (1 , 0 )])]
415
- assert not td . AutoPathSpec ._check_path_intersects_with_conductors (test_shapely , test_path )
417
+ assert not AutoPathSpec ._check_path_intersects_with_conductors (test_shapely , test_path )
416
418
417
419
sim = make_mw_sim (False , False , "microstrip" )
418
420
coax = td .GeometryGroup (
@@ -432,7 +434,7 @@ def test_auto_path_spec_validation():
432
434
mode_monitor = sim .monitors [0 ]
433
435
modal_plane = td .Box (center = mode_monitor .center , size = mode_monitor .size )
434
436
with pytest .raises (ValidationError ):
435
- td . AutoPathSpec .create_current_path_specs (
437
+ AutoPathSpec .create_current_path_specs (
436
438
modal_plane ,
437
439
sim .structures ,
438
440
sim .grid ,
@@ -445,16 +447,16 @@ def test_auto_path_spec_validation():
445
447
def test_path_integral_creation ():
446
448
"""Check that path integrals are correctly constructed from path specifications."""
447
449
448
- path_spec = td .AxisAlignedPathSpec (center = (1 , 2 , 3 ), size = (0 , 0 , 1 ), sign = "-" )
450
+ path_spec = td .VoltageIntegralAxisAlignedSpec (center = (1 , 2 , 3 ), size = (0 , 0 , 1 ), sign = "-" )
449
451
voltage_integral = make_voltage_integral (path_spec )
450
452
451
- path_spec = td .AxisAlignedPathSpec (center = (1 , 2 , 3 ), size = (0 , 1 , 1 ), sign = "-" )
453
+ path_spec = td .CurrentIntegralAxisAlignedSpec (center = (1 , 2 , 3 ), size = (0 , 1 , 1 ), sign = "-" )
452
454
current_integral = make_current_integral (path_spec )
453
455
454
- path_spec = td .PathSpec (vertices = [(0 , 1 ), (0 , 4 )], axis = 1 , position = 2 )
456
+ path_spec = td .CustomVoltageIntegral2DSpec (vertices = [(0 , 1 ), (0 , 4 )], axis = 1 , position = 2 )
455
457
voltage_integral = make_voltage_integral (path_spec )
456
458
457
- path_spec = td .PathSpec (
459
+ path_spec = td .CustomCurrentIntegral2DSpec (
458
460
vertices = [
459
461
(0 , 1 ),
460
462
(0 , 4 ),
@@ -464,10 +466,10 @@ def test_path_integral_creation():
464
466
axis = 1 ,
465
467
position = 2 ,
466
468
)
467
- current_integral = make_current_integral (path_spec )
469
+ _ = make_current_integral (path_spec )
468
470
469
471
with pytest .raises (pd .ValidationError ):
470
- path_spec = td .PathSpec (
472
+ path_spec = td .CustomCurrentIntegral2DSpec (
471
473
vertices = [
472
474
(0 , 1 , 3 ),
473
475
(0 , 4 , 5 ),
0 commit comments