@@ -720,30 +720,24 @@ def test_nonlinear_medium():
720720 monitors = [monitor ],
721721 structures = [structure ],
722722 )
723- assert n0 == nonlinear_spec .models [0 ]._get_n0 (n0 = None , medium = medium , freqs = [freq0 ])
724- assert freq0 == nonlinear_spec .models [0 ]._get_freq0 (freq0 = None , freqs = [freq0 ])
725723
726- # subsection with nonlinear materials needs to hardcode source info
724+ # subsection with nonlinear materials preserves sources
727725 sim2 = sim .updated_copy (center = (- 4 , - 4 , - 4 ), path = "sources/0" )
728726 sim2 = sim2 .updated_copy (
729727 models = [td .TwoPhotonAbsorption (beta = 1 )], path = "structures/0/medium/nonlinear_spec"
730728 )
731729 sim2 = sim2 .subsection (region = td .Box (center = (0 , 0 , 0 ), size = (1 , 1 , 0 )))
732- assert sim2 .structures [0 ].medium .nonlinear_spec .models [0 ].n0 == n0
733- assert sim2 .structures [0 ].medium .nonlinear_spec .models [0 ].freq0 == freq0
734730
735731 nonlinear_spec = td .NonlinearSpec (models = [td .KerrNonlinearity (n2 = 1 , n0 = 1 )])
736732 structure = structure .updated_copy (medium = medium .updated_copy (nonlinear_spec = nonlinear_spec ))
737733 sim = sim .updated_copy (structures = [structure ])
738- assert 1 == nonlinear_spec .models [0 ]._get_n0 (n0 = 1 , medium = medium , freqs = [1 , 2 ])
739734
740735 nonlinear_spec = td .NonlinearSpec (models = [td .TwoPhotonAbsorption (beta = 1 , n0 = 1 )])
741736 structure = structure .updated_copy (medium = medium .updated_copy (nonlinear_spec = nonlinear_spec ))
742737 sim = sim .updated_copy (structures = [structure ])
743738 nonlinear_spec = td .NonlinearSpec (models = [td .TwoPhotonAbsorption (beta = 1 , n0 = 1 , freq0 = 1 )])
744739 structure = structure .updated_copy (medium = medium .updated_copy (nonlinear_spec = nonlinear_spec ))
745740 sim = sim .updated_copy (structures = [structure ])
746- assert 1 == nonlinear_spec .models [0 ]._get_freq0 (freq0 = 1 , freqs = [1 , 2 ])
747741
748742 # active materials with automatic detection of n0
749743 nonlinear_spec_active = td .NonlinearSpec (models = [td .TwoPhotonAbsorption (beta = - 1 )])
0 commit comments