예제 #1
0
    def test_detector_azimuthal(self):
        """Test that setting an azimuthal angle of a detector results in
        different patterns.
        """
        det1 = self.detector

        # Looking from the detector toward the sample, the left part of
        # the detector is closer to the sample than the right part
        det2 = det1.deepcopy()
        det2.azimuthal = 10

        # Looking from the detector toward the sample, the right part of
        # the detector is closer to the sample than the left part
        det3 = det1.deepcopy()
        det3.azimuthal = -10

        mp = nickel_ebsd_master_pattern_small(projection="lambert")
        r = Rotation.identity()

        kwargs = dict(rotations=r, energy=20, compute=True, dtype_out=np.uint8)
        sim1 = mp.get_patterns(detector=det1, **kwargs)
        sim2 = mp.get_patterns(detector=det2, **kwargs)
        sim3 = mp.get_patterns(detector=det3, **kwargs)

        assert not np.allclose(sim1.data, sim2.data)
        assert np.allclose(sim2.data.mean(), 43.56, atol=1e-2)
        assert np.allclose(sim3.data.mean(), 43.39, atol=1e-2)
예제 #2
0
 def test_get_patterns_dtype(self):
     r = Rotation.identity()
     mp = nickel_ebsd_master_pattern_small(projection="lambert")
     dtype_out = np.dtype("float64")
     pattern = mp.get_patterns(rotations=r,
                               detector=self.detector,
                               energy=20,
                               dtype_out=dtype_out)
     assert pattern.data.dtype == dtype_out