示例#1
0
def test_get_reciprocal_mesh_orientation():
    """Test get_reciprocal_mesh orientations along x, y, z axes."""
    voxel_num = 9
    mesh, voxel_length = geometry.get_reciprocal_mesh(voxel_num, 1.)
    assert np.all(mesh[0, :, :, 0] < mesh[-1, :, :, 0])
    assert np.all(mesh[:, 0, :, 1] < mesh[:, -1, :, 1])
    assert np.all(mesh[:, :, 0, 2] < mesh[:, :, -1, 2])
示例#2
0
def test_get_reciprocal_mesh_center_odd():
    """Test get_reciprocal_mesh centering for odd number."""
    voxel_num = 9
    mesh, voxel_length = geometry.get_reciprocal_mesh(voxel_num, 1.)
    assert np.isclose(mesh[0, 0, 0, 0] + mesh[-1, -1, -1, 0], 0.)
    assert np.isclose(mesh[0, 0, 0, 1] + mesh[-1, -1, -1, 1], 0.)
    assert np.isclose(mesh[0, 0, 0, 2] + mesh[-1, -1, -1, 2], 0.)
示例#3
0
    def get_reciprocal_mesh(self, voxel_number_1d):
        """
        Get the proper reciprocal mesh.

        :param voxel_number_1d: The voxel number along 1 dimension.
        :return: The reciprocal mesh, voxel length.
        """
        self.ensure_beam()
        dist_max = xp.max(self.pixel_distance_reciprocal)
        return pg.get_reciprocal_mesh(voxel_number_1d, dist_max)
示例#4
0
def test_get_reciprocal_mesh_step_odd():
    """Test get_reciprocal_mesh step for odd number."""
    voxel_num = 9
    i = 4
    mesh, voxel_length = geometry.get_reciprocal_mesh(voxel_num, 1.)
    assert np.isclose(mesh[i, i, i, 0] - mesh[i - 1, i - 1, i - 1, 0],
                      voxel_length)
    assert np.isclose(mesh[i, i, i, 1] - mesh[i - 1, i - 1, i - 1, 1],
                      voxel_length)
    assert np.isclose(mesh[i, i, i, 2] - mesh[i - 1, i - 1, i - 1, 2],
                      voxel_length)
示例#5
0
def test_get_reciprocal_mesh_shape_even():
    """Test get_reciprocal_mesh shape for even number."""
    voxel_num = 8
    mesh, voxel_length = geometry.get_reciprocal_mesh(voxel_num, 1.)
    assert mesh.shape == (voxel_num, ) * 3 + (3, )