@@ -291,3 +291,70 @@ def test_cartesian_wrappers_match_spherical_transform(m_sphere, n_env):
291291 np .testing .assert_allclose (h_xyz , h_ref , rtol = 1e-12 , atol = 1e-12 )
292292 np .testing .assert_allclose (e_xyz2 , e_ref , rtol = 1e-12 , atol = 1e-12 )
293293 np .testing .assert_allclose (h_xyz2 , h_ref , rtol = 1e-12 , atol = 1e-12 )
294+
295+
296+ def test_no_contrast_cartesian_fields_match_incident_plane_wave ():
297+ """No-contrast sphere should reduce to the incident plane wave everywhere."""
298+ lambda0 = 1.0
299+ n_env = 1.0
300+ d_sphere = 0.002
301+ m_sphere = 1.0 + 0.0j
302+
303+ x = np .array ([3.0 , 0.0 , 0.0 , 2.0 , 2.0 ])
304+ y = np .array ([0.0 , 0.0 , 3.0 , 2.0 , 2.0 ])
305+ z = np .array ([0.0 , 3.0 , 0.0 , 0.0 , 0.5 ])
306+
307+ k = 2 * np .pi * n_env / lambda0
308+ phase = np .exp (1j * k * z )
309+ zeros = np .zeros_like (phase )
310+ e_expected = np .array ([phase , zeros , zeros ])
311+ h_expected = np .array ([zeros , phase , zeros ])
312+
313+ e_xyz = e_near_cartesian (lambda0 , d_sphere , m_sphere , n_env , x , y , z , include_incident = True )
314+ h_xyz = h_near_cartesian (lambda0 , d_sphere , m_sphere , n_env , x , y , z , include_incident = True )
315+ e_xyz2 , h_xyz2 = eh_near_cartesian (lambda0 , d_sphere , m_sphere , n_env , x , y , z , include_incident = True )
316+
317+ np .testing .assert_allclose (e_xyz , e_expected , rtol = 1e-12 , atol = 1e-12 )
318+ np .testing .assert_allclose (h_xyz , h_expected , rtol = 1e-12 , atol = 1e-12 )
319+ np .testing .assert_allclose (e_xyz2 , e_expected , rtol = 1e-12 , atol = 1e-12 )
320+ np .testing .assert_allclose (h_xyz2 , h_expected , rtol = 1e-12 , atol = 1e-12 )
321+
322+
323+ def test_no_contrast_spherical_fields_match_incident_components ():
324+ """No-contrast spherical fields should follow standard spherical components."""
325+ lambda0 = 1.0
326+ n_env = 1.0
327+ d_sphere = 0.002
328+ m_sphere = 1.0 + 0.0j
329+ x , y , z = 2.0 , 2.0 , 0.5
330+
331+ r = np .sqrt (x ** 2 + y ** 2 + z ** 2 )
332+ theta = np .arccos (z / r )
333+ phi = np .arctan2 (y , x )
334+
335+ k = 2 * np .pi * n_env / lambda0
336+ phase = np .exp (1j * k * z )
337+
338+ e_expected = np .array (
339+ [
340+ phase * np .sin (theta ) * np .cos (phi ),
341+ phase * np .cos (theta ) * np .cos (phi ),
342+ - phase * np .sin (phi ),
343+ ]
344+ )
345+ h_expected = np .array (
346+ [
347+ phase * np .sin (theta ) * np .sin (phi ),
348+ phase * np .cos (theta ) * np .sin (phi ),
349+ phase * np .cos (phi ),
350+ ]
351+ )
352+
353+ e_sph = e_near (lambda0 , d_sphere , m_sphere , n_env , r , theta , phi , include_incident = True )
354+ h_sph = h_near (lambda0 , d_sphere , m_sphere , n_env , r , theta , phi , include_incident = True )
355+ e_sph2 , h_sph2 = eh_near (lambda0 , d_sphere , m_sphere , n_env , r , theta , phi , include_incident = True )
356+
357+ np .testing .assert_allclose (e_sph , e_expected , rtol = 1e-12 , atol = 1e-12 )
358+ np .testing .assert_allclose (h_sph , h_expected , rtol = 1e-12 , atol = 1e-12 )
359+ np .testing .assert_allclose (e_sph2 , e_expected , rtol = 1e-12 , atol = 1e-12 )
360+ np .testing .assert_allclose (h_sph2 , h_expected , rtol = 1e-12 , atol = 1e-12 )
0 commit comments