コード例 #1
0
    def test_default_center(self):
        """ Test that the placement of the center 
        by default is in the center of the detector. """
        qx, qy, qz = detector_scattvectors(
            keV=200, camera_length=1, shape=(512, 512), pixel_size=1e-6, center=None
        )

        q_parallel = np.sqrt(qx ** 2 + qy ** 2)
        self.assertEqual(np.unravel_index(np.argmin(q_parallel), qx.shape), (256, 256))
コード例 #2
0
    def test_ewald_radius(self):
        """ Test that the norm of total scattering vector norm is constant and equal to the
        Ewald sphere radius """
        qx, qy, qz = detector_scattvectors(
            keV=200, camera_length=1, shape=(128, 128), pixel_size=1e-6, center=None
        )

        q_norm = np.sqrt(qx ** 2 + qy ** 2 + qz ** 2)
        ewald_sphere_radius = 2 * np.pi / electron_wavelength(keV=200)

        self.assertTrue(np.allclose(q_norm, ewald_sphere_radius))
コード例 #3
0
    def test_center(self):
        """ Test that the placement of the center is working as intended. """
        qx, qy, qz = detector_scattvectors(
            keV=200,
            camera_length=1,
            shape=(512, 512),
            pixel_size=1e-6,
            center=(128, 128),
        )

        q_parallel = np.sqrt(qx ** 2 + qy ** 2)
        self.assertEqual(np.unravel_index(np.argmin(q_parallel), qx.shape), (128, 128))