@@ -824,14 +824,14 @@ def test_bad_eps_arg(self, eps_comp):
824
824
self .make_sim (self .medium_diag ).plot_eps (x = 0 , eps_component = eps_comp )
825
825
826
826
@pytest .mark .parametrize (
827
- "eps_comp" ,
828
- [None , * diag_comps ],
827
+ "eps_comp, swap_axes " ,
828
+ zip ( [None , * diag_comps ], [ True , False ]) ,
829
829
)
830
- def test_plot_anisotropic_medium (self , eps_comp ):
830
+ def test_plot_anisotropic_medium (self , eps_comp , swap_axes ):
831
831
"""Test plotting diagonal components of a diagonally anisotropic medium succeeds or not.
832
832
diagonal components and ``None`` should succeed.
833
833
"""
834
- self .make_sim (self .medium_diag ).plot_eps (x = 0 , eps_component = eps_comp )
834
+ self .make_sim (self .medium_diag ).plot_eps (x = 0 , eps_component = eps_comp , swap_axes = swap_axes )
835
835
836
836
@pytest .mark .parametrize ("eps_comp" , offdiag_comps )
837
837
def test_plot_anisotropic_medium_offdiagfail (self , eps_comp ):
@@ -855,15 +855,15 @@ def test_plot_anisotropic_medium_diff(self, tmp_path, eps_comp1, eps_comp2, expe
855
855
self .compare_eps_images (tmp_path , eps_comp1 , eps_comp2 , expected , self .medium_diag )
856
856
857
857
@pytest .mark .parametrize (
858
- "eps_comp" ,
859
- [None , * diag_comps , * offdiag_comps ],
858
+ "eps_comp, swap_axes " ,
859
+ zip ( [None , * diag_comps , * offdiag_comps ], [ True , False ]) ,
860
860
)
861
- def test_plot_fully_anisotropic_medium (self , eps_comp ):
861
+ def test_plot_fully_anisotropic_medium (self , eps_comp , swap_axes ):
862
862
"""Test plotting all components of a fully anisotropic medium.
863
863
All plots should succeed.
864
864
"""
865
865
sim = self .make_sim (self .medium_fullyani )
866
- sim .plot_eps (x = 0 , eps_component = eps_comp )
866
+ sim .plot_eps (x = 0 , eps_component = eps_comp , swap_axes = swap_axes )
867
867
868
868
# Test parameters for comparing plots of a FullyAnisotropicMedium
869
869
fullyani_testplot_diff_params = []
@@ -882,14 +882,14 @@ def test_plot_fully_anisotropic_medium_diff(self, tmp_path, eps_comp1, eps_comp2
882
882
self .compare_eps_images (tmp_path , eps_comp1 , eps_comp2 , expected , self .medium_fullyani )
883
883
884
884
@pytest .mark .parametrize (
885
- "eps_comp" ,
886
- [None , * diag_comps ],
885
+ "eps_comp, swap_axes " ,
886
+ zip ( [None , * diag_comps ], [ True , False ]) ,
887
887
)
888
- def test_plot_customanisotropic_medium (self , eps_comp , medium_customani ):
888
+ def test_plot_customanisotropic_medium (self , eps_comp , swap_axes , medium_customani ):
889
889
"""Test plotting diagonal components of a diagonally anisotropic custom medium.
890
890
diagonal components and ``None`` should succeed.
891
891
"""
892
- self .make_sim (medium_customani ).plot_eps (x = 0 , eps_component = eps_comp )
892
+ self .make_sim (medium_customani ).plot_eps (x = 0 , eps_component = eps_comp , swap_axes = swap_axes )
893
893
894
894
@pytest .mark .parametrize ("eps_comp" , offdiag_comps )
895
895
def test_plot_customanisotropic_medium_offdiagfail (self , eps_comp , medium_customani ):
@@ -915,14 +915,16 @@ def test_plot_customanisotropic_medium_diff(
915
915
self .compare_eps_images (tmp_path , eps_comp1 , eps_comp2 , expected , medium_customani )
916
916
917
917
918
- def test_plot ():
919
- SIM_FULL .plot (x = 0 )
918
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
919
+ def test_plot (swap_axes ):
920
+ SIM_FULL .plot (x = 0 , swap_axes = swap_axes )
920
921
plt .close ()
921
922
922
923
923
- def test_plot_with_units ():
924
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
925
+ def test_plot_with_units (swap_axes ):
924
926
sim_with_units = SIM_FULL .updated_copy (plot_length_units = "nm" )
925
- sim_with_units .plot (x = - 0.5 )
927
+ sim_with_units .plot (x = - 0.5 , swap_axes = swap_axes )
926
928
927
929
928
930
def test_plot_1d_sim ():
@@ -938,12 +940,13 @@ def test_plot_1d_sim():
938
940
plt .close ()
939
941
940
942
941
- def test_plot_bounds ():
942
- _ = SIM_FULL .plot (x = 0 , hlim = [- 0.45 , 0.45 ])
943
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
944
+ def test_plot_bounds (swap_axes ):
945
+ _ = SIM_FULL .plot (x = 0 , hlim = [- 0.45 , 0.45 ], swap_axes = swap_axes )
943
946
plt .close ()
944
- _ = SIM_FULL .plot (x = 0 , vlim = [- 0.45 , 0.45 ])
947
+ _ = SIM_FULL .plot (x = 0 , vlim = [- 0.45 , 0.45 ], swap_axes = swap_axes )
945
948
plt .close ()
946
- _ = SIM_FULL .plot (x = 0 , hlim = [- 0.45 , 0.45 ], vlim = [- 0.45 , 0.45 ])
949
+ _ = SIM_FULL .plot (x = 0 , hlim = [- 0.45 , 0.45 ], vlim = [- 0.45 , 0.45 ], swap_axes = swap_axes )
947
950
plt .close ()
948
951
949
952
@@ -1008,22 +1011,25 @@ def test_plot_eps_with_default_frequency():
1008
1011
plt .close ()
1009
1012
1010
1013
1011
- def test_plot_symmetries ():
1014
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
1015
+ def test_plot_symmetries (swap_axes ):
1012
1016
S2 = SIM .copy (update = {"symmetry" : (1 , 0 , - 1 )})
1013
- S2 .plot_symmetries (x = 0 )
1017
+ S2 .plot_symmetries (x = 0 , swap_axes = swap_axes )
1014
1018
plt .close ()
1015
1019
1016
1020
1017
- def test_plot_grid ():
1021
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
1022
+ def test_plot_grid (swap_axes ):
1018
1023
override = td .Structure (geometry = td .Box (size = (1 , 1 , 1 )), medium = td .Medium ())
1019
1024
S2 = SIM_FULL .copy (
1020
1025
update = {"grid_spec" : td .GridSpec (wavelength = 1.0 , override_structures = [override ])}
1021
1026
)
1022
- S2 .plot_grid (x = 0 )
1027
+ S2 .plot_grid (x = 0 , swap_axes = swap_axes )
1023
1028
plt .close ()
1024
1029
1025
1030
1026
- def test_plot_boundaries ():
1031
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
1032
+ def test_plot_boundaries (swap_axes ):
1027
1033
bound_spec = td .BoundarySpec (
1028
1034
x = td .Boundary (plus = td .PECBoundary (), minus = td .PMCBoundary ()),
1029
1035
y = td .Boundary (
@@ -1033,16 +1039,17 @@ def test_plot_boundaries():
1033
1039
z = td .Boundary (plus = td .Periodic (), minus = td .Periodic ()),
1034
1040
)
1035
1041
S2 = SIM_FULL .copy (update = {"boundary_spec" : bound_spec })
1036
- S2 .plot_boundaries (z = 0 )
1042
+ S2 .plot_boundaries (z = 0 , swap_axes = swap_axes )
1037
1043
plt .close ()
1038
1044
1039
1045
1040
- def test_plot_with_lumped_elements ():
1046
+ @pytest .mark .parametrize ("swap_axes" , [True , False ])
1047
+ def test_plot_with_lumped_elements (swap_axes ):
1041
1048
load = td .LumpedResistor (
1042
1049
center = (0 , 0 , 0 ), size = (1 , 2 , 0 ), name = "resistor" , voltage_axis = 0 , resistance = 50
1043
1050
)
1044
1051
sim_test = SIM_FULL .updated_copy (lumped_elements = [load ])
1045
- sim_test .plot (z = 0 )
1052
+ sim_test .plot (z = 0 , swap_axes = swap_axes )
1046
1053
plt .close ()
1047
1054
1048
1055
0 commit comments