Exemplo n.º 1
0
def test_crop_02(scan2d_from_nxs_01: Scan2D, region_01: Region):
    """
    Make sure that our cropped region has the correct size.
    """
    scan2d_from_nxs_01.crop(crop_to_region, region=region_01)
    assert (scan2d_from_nxs_01.images[0].shape[0] *
            scan2d_from_nxs_01.images[0].shape[1]) == region_01.num_pixels
Exemplo n.º 2
0
def test_crop_03(scan2d_from_nxs_01: Scan2D, region_01: Region):
    """
    Make sure that the region we've cropped to has the specified shape.
    """
    scan2d_from_nxs_01.crop(crop_to_region, region=region_01)
    assert scan2d_from_nxs_01.images[0].shape[0] == region_01.x_length
    assert scan2d_from_nxs_01.images[0].shape[1] == region_01.y_length
Exemplo n.º 3
0
def test_crop_01(scan2d_from_nxs_01: Scan2D, region_01):
    """
    Check that crop is decreasing the size of the image.
    """
    initial_shape = scan2d_from_nxs_01.images[0].shape
    scan2d_from_nxs_01.crop(crop_to_region, region=region_01)

    assert scan2d_from_nxs_01.images[0].shape[0] < initial_shape[0]
    assert scan2d_from_nxs_01.images[0].shape[1] < initial_shape[1]