def test_works_with_quantity_arrays(self):
     a = sp.array([[4, 2], [2, 4]]) * pq.s
     b = sp.array([[3000, 3000], [3000, 3000]]) * pq.ms
     expected = sp.array([[3, 2], [2, 3]]) * pq.s
     actual = spq.minimum(a, b)
     assert_array_almost_equal(expected, actual)
     actual = spq.minimum(b, a)
     assert_array_almost_equal(expected, actual)
 def test_works_with_normal_and_quantity_arrays_mixed(self):
     a = sp.array([[4, 2], [2, 4]])
     b = sp.array([[3, 3], [3, 3]]) * pq.dimensionless
     expected = sp.array([[3, 2], [2, 3]]) * pq.dimensionless
     actual = spq.minimum(a, b)
     assert_array_almost_equal(expected, actual)
     actual = spq.minimum(b, a)
     assert_array_almost_equal(expected, actual)
Beispiel #3
0
 def test_works_with_normal_and_quantity_arrays_mixed(self):
     a = sp.array([[4, 2], [2, 4]])
     b = sp.array([[3, 3], [3, 3]]) * pq.dimensionless
     expected = sp.array([[3, 2], [2, 3]]) * pq.dimensionless
     actual = spq.minimum(a, b)
     assert_array_almost_equal(expected, actual)
     actual = spq.minimum(b, a)
     assert_array_almost_equal(expected, actual)
Beispiel #4
0
 def test_works_with_quantity_arrays(self):
     a = sp.array([[4, 2], [2, 4]]) * pq.s
     b = sp.array([[3000, 3000], [3000, 3000]]) * pq.ms
     expected = sp.array([[3, 2], [2, 3]]) * pq.s
     actual = spq.minimum(a, b)
     assert_array_almost_equal(expected, actual)
     actual = spq.minimum(b, a)
     assert_array_almost_equal(expected, actual)
 def test_uses_out_param(self):
     a = sp.array([[4, 2], [2, 4]]) * pq.s
     b = sp.array([[3000, 3000], [3000, 3000]]) * pq.ms
     expected = sp.array([[3, 2], [2, 3]]) * pq.s
     out = sp.zeros_like(expected)
     assert out.units == pq.s
     spq.minimum(a, b, out)
     assert_array_almost_equal(expected, out)
     spq.minimum(b, a, out)
     assert_array_almost_equal(expected, out)
Beispiel #6
0
 def test_uses_out_param(self):
     a = sp.array([[4, 2], [2, 4]]) * pq.s
     b = sp.array([[3000, 3000], [3000, 3000]]) * pq.ms
     expected = sp.array([[3, 2], [2, 3]]) * pq.s
     out = sp.zeros_like(expected)
     assert out.units == pq.s
     spq.minimum(a, b, out)
     assert_array_almost_equal(expected, out)
     spq.minimum(b, a, out)
     assert_array_almost_equal(expected, out)
 def test_works_with_normal_arrays(self):
     a = sp.array([[4, 2], [2, 4]])
     b = sp.array([[3, 3], [3, 3]])
     expected = sp.array([[3, 2], [2, 3]])
     actual = spq.minimum(a, b)
     assert_array_equal(expected, actual)
Beispiel #8
0
 def test_works_with_normal_arrays(self):
     a = sp.array([[4, 2], [2, 4]])
     b = sp.array([[3, 3], [3, 3]])
     expected = sp.array([[3, 2], [2, 3]])
     actual = spq.minimum(a, b)
     assert_array_equal(expected, actual)