Ejemplo n.º 1
0
def test_kwargs_size_or_shape():
    a = normal(loc=10.0, scale=0.1, shape=(10, 10), chunks=(5, 5))
    b = normal(loc=10.0, scale=0.1, size=(10, 10), chunks=(5, 5))
    assert isinstance(a, Array)
    assert isinstance(b, Array)
    assert a.chunks == b.chunks

    assert np.array(a).shape == np.array(b).shape
Ejemplo n.º 2
0
def test_kwargs_size_or_shape():
    a = normal(loc=10.0, scale=0.1, shape=(10, 10), blockshape=(5, 5))
    b = normal(loc=10.0, scale=0.1, size=(10, 10), blockshape=(5, 5))
    assert isinstance(a, Array)
    assert isinstance(b, Array)
    assert a.blockdims == b.blockdims

    assert np.array(a).shape == np.array(b).shape
Ejemplo n.º 3
0
 def test_add_gaussian_noise(self):
     s = self.signal
     s.change_dtype("float64")
     kwargs = {}
     if s._lazy:
         data = s.data.compute()
         from dask.array.random import seed, normal
         kwargs["chunks"] = s.data.chunks
     else:
         data = s.data.copy()
         from numpy.random import seed, normal
     seed(1)
     s.add_gaussian_noise(std=1.0)
     seed(1)
     if s._lazy:
         s.compute()
     np.testing.assert_array_almost_equal(
         s.data - data, normal(scale=1.0, size=data.shape, **kwargs))
Ejemplo n.º 4
0
 def test_add_gaussian_noise(self):
     s = self.signal
     s.change_dtype("float64")
     kwargs = {}
     if s._lazy:
         data = s.data.compute()
         from dask.array.random import seed, normal
         kwargs["chunks"] = s.data.chunks
     else:
         data = s.data.copy()
         from numpy.random import seed, normal
     seed(1)
     s.add_gaussian_noise(std=1.0)
     seed(1)
     if s._lazy:
         s.compute()
     np.testing.assert_array_almost_equal(
         s.data - data, normal(scale=1.0, size=data.shape, **kwargs))
Ejemplo n.º 5
0
def test_can_make_really_big_random_array():
    x = normal(10, 1, (1000000, 1000000), chunks=(100000, 100000))
Ejemplo n.º 6
0
def test_kwargs():
    a = normal(loc=10.0, scale=0.1, size=(10, 10), chunks=(5, 5))
    assert isinstance(a, Array)
    x = np.array(a)
    assert 8 < x.mean() < 12
Ejemplo n.º 7
0
def test_kwargs():
    a = normal(loc=10.0, scale=0.1, size=(10, 10), chunks=(5, 5))
    assert isinstance(a, Array)
    x = np.array(a)
    assert 8 < x.mean() < 12
Ejemplo n.º 8
0
def test_can_make_really_big_random_array():
    normal(10, 1, (1000000, 1000000), chunks=(100000, 100000))
Ejemplo n.º 9
0
def test_kwargs():
    a = normal(loc=10.0, scale=0.1, size=(10, 10), blockshape=(5, 5))
    assert isinstance(a, Array)
    x = into(np.ndarray, a)
    assert 8 < x.mean() < 12