MCPcopy Create free account
hub / github.com/numpy/numpy / test_2d

Method test_2d

numpy/ma/tests/test_extras.py:386–404  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

384 assert_array_equal(c.mask, mr_[m, 0, 0, m])
385
386 def test_2d(self):
387 # Tests mr_ on 2D arrays.
388 a_1 = np.random.rand(5, 5)
389 a_2 = np.random.rand(5, 5)
390 m_1 = np.round(np.random.rand(5, 5), 0)
391 m_2 = np.round(np.random.rand(5, 5), 0)
392 b_1 = masked_array(a_1, mask=m_1)
393 b_2 = masked_array(a_2, mask=m_2)
394 # append columns
395 d = mr_['1', b_1, b_2]
396 assert_(d.shape == (5, 10))
397 assert_array_equal(d[:, :5], b_1)
398 assert_array_equal(d[:, 5:], b_2)
399 assert_array_equal(d.mask, np.r_['1', m_1, m_2])
400 d = mr_[b_1, b_2]
401 assert_(d.shape == (10, 5))
402 assert_array_equal(d[:5,:], b_1)
403 assert_array_equal(d[5:,:], b_2)
404 assert_array_equal(d.mask, np.r_[m_1, m_2])
405
406 def test_masked_constant(self):
407 actual = mr_[np.ma.masked, 1]

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
roundMethod · 0.80
assert_Function · 0.50

Tested by

no test coverage detected