@@ -492,23 +492,30 @@ def test_eme_simulation():
492
492
assert sim_tmp ._monitor_num_freqs (monitor = sim_tmp .monitors [0 ]) == 1
493
493
494
494
# test sweep
495
- sweep_sim = sim .updated_copy (
495
+ with pytest .raises (SetupError ):
496
+ _ = sim .updated_copy (
497
+ sweep_spec = td .EMELengthSweep (scale_factors = list (np .linspace (1 , 2 , 10 )))
498
+ )
499
+ sim_no_field = sim .updated_copy (
500
+ monitors = [mnt for mnt in sim .monitors if not isinstance (mnt , td .EMEFieldMonitor )]
501
+ )
502
+ sweep_sim = sim_no_field .updated_copy (
496
503
sweep_spec = td .EMELengthSweep (scale_factors = list (np .linspace (1 , 2 , 10 )))
497
504
)
498
505
assert sweep_sim ._sweep_cells
499
506
assert not sweep_sim ._sweep_interfaces
500
507
assert sweep_sim ._num_sweep_cells == 10
501
508
assert sweep_sim ._num_sweep_interfaces == 1
502
509
assert sweep_sim ._num_sweep_modes == 1
503
- _ = sim .updated_copy (
510
+ _ = sim_no_field .updated_copy (
504
511
sweep_spec = td .EMELengthSweep (
505
512
scale_factors = np .stack ((np .linspace (1 , 2 , 7 ), np .linspace (1 , 2 , 7 )))
506
- )
513
+ ),
507
514
)
508
515
with pytest .raises (SetupError ):
509
- _ = sim .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = []))
516
+ _ = sim_no_field .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = []))
510
517
with pytest .raises (SetupError ):
511
- _ = sim .updated_copy (
518
+ _ = sim_no_field .updated_copy (
512
519
sweep_spec = td .EMELengthSweep (
513
520
scale_factors = np .stack (
514
521
(
@@ -520,12 +527,14 @@ def test_eme_simulation():
520
527
)
521
528
# second shape of length sweep must equal number of cells
522
529
with pytest .raises (SetupError ):
523
- _ = sim .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = np .array ([[1 , 2 ], [3 , 4 ]])))
530
+ _ = sim_no_field .updated_copy (
531
+ sweep_spec = td .EMELengthSweep (scale_factors = np .array ([[1 , 2 ], [3 , 4 ]]))
532
+ )
524
533
_ = sim .updated_copy (sweep_spec = td .EMEModeSweep (num_modes = list (np .arange (1 , 5 ))))
525
534
# test sweep size limit
526
535
with pytest .raises (SetupError ):
527
- _ = sim .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = []))
528
- sim_bad = sim .updated_copy (
536
+ _ = sim_no_field .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = []))
537
+ sim_bad = sim_no_field .updated_copy (
529
538
sweep_spec = td .EMELengthSweep (scale_factors = list (np .linspace (1 , 2 , 200 )))
530
539
)
531
540
with pytest .raises (SetupError ):
@@ -562,7 +571,7 @@ def test_eme_simulation():
562
571
sim = sim .updated_copy (sweep_spec = None )
563
572
assert sim ._num_sweep == 1
564
573
assert not sim ._sweep_modes
565
- sim = sim .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = [1 , 2 ]))
574
+ sim = sim_no_field .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = [1 , 2 ]))
566
575
assert not sim ._sweep_modes
567
576
assert sim ._num_sweep == 2
568
577
sim = sim .updated_copy (sweep_spec = td .EMEFreqSweep (freq_scale_factors = [1 , 2 ]))
@@ -1090,9 +1099,11 @@ def test_eme_sim_data():
1090
1099
1091
1100
# test smatrix in basis with sweep
1092
1101
smatrix = _get_eme_smatrix_dataset (num_modes_1 = 5 , num_modes_2 = 5 , num_sweep = 10 )
1093
- sim = sim .updated_copy (sweep_spec = td .EMELengthSweep (scale_factors = np .linspace (1 , 2 , 10 )))
1102
+ sim_sweep = sim .updated_copy (
1103
+ sweep_spec = td .EMELengthSweep (scale_factors = np .linspace (1 , 2 , 10 )), monitors = []
1104
+ )
1094
1105
sim_data = td .EMESimulationData (
1095
- simulation = sim , data = data , smatrix = smatrix , port_modes_raw = port_modes
1106
+ simulation = sim_sweep , data = [] , smatrix = smatrix , port_modes_raw = port_modes
1096
1107
)
1097
1108
1098
1109
# test smatrix_in_basis
0 commit comments