MCPcopy Create free account
hub / github.com/NanoComp/meep / test_source_slice

Method test_source_slice

python/tests/test_simulation.py:762–776  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

760 )
761
762 def test_source_slice(self):
763 sim = self.init_simple_simulation()
764 sim.run(until=1)
765
766 vol1d = mp.Volume(center=mp.Vector3(0.1234, 0), size=mp.Vector3(0, 5.07))
767 source_slice = sim.get_source(mp.Ez, vol=vol1d)
768 x, y, z, w = sim.get_array_metadata(vol=vol1d)
769 self.assertEqual(source_slice.shape, w.shape)
770 self.assertEqual(np.sum(source_slice), 0)
771
772 vol2d = mp.Volume(center=mp.Vector3(-0.541, 0.791), size=mp.Vector3(3.5, 2.8))
773 source_slice = sim.get_source(mp.Ez, vol=vol2d)
774 x, y, z, w = sim.get_array_metadata(vol=vol2d)
775 self.assertEqual(source_slice.shape, w.shape)
776 self.assertNotEqual(np.sum(source_slice), 0)
777
778 def test_has_mu(self):
779 def _check(med, expected, default=mp.Medium()):

Callers

nothing calls this directly

Calls 4

get_sourceMethod · 0.80
runMethod · 0.45
get_array_metadataMethod · 0.45

Tested by

no test coverage detected