示例#1
0
def test_apply_in_place():
    """
    test that apply correctly applies a simple function across a starfish stack without modifying
    original data
    """
    image = SyntheticData().spots()
    original = copy.deepcopy(image)
    image.apply(divide, value=2, in_place=True)
    assert np.all(image.xarray == original.xarray / 2)
示例#2
0
def test_apply_labeled_dataset():
    """
    test that apply correctly applies a simple function across starfish-generated synthetic data
    """
    original = SyntheticData().spots()
    image = original.apply(divide, value=2)
    assert np.all(image.xarray == original.xarray / 2)
示例#3
0
def test_apply_not_in_place():
    """test that apply correctly applies a simple function across a starfish stack without modifying original data"""
    image = SyntheticData().spots()
    new = image.apply(multiply, value=2, in_place=False)
    assert np.all(new.numpy_array == image.numpy_array * 2)