Beispiel #1
0
 def test_high_in_high(self):
     x = array([2.0, 0.5, 2])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #2
0
 def test_in_low_in(self):
     x = array([0.5, -2.0, 0.5])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, True, True])
Beispiel #3
0
 def test_low_high_in(self):
     x = array([-3.0, 2, 0.5])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #4
0
 def test_low_lower_bound(self):
     x = array([-1.0, 0.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*2)
Beispiel #5
0
 def test_low_low_low(self):
     x = array([-3.0, -2.0, -1.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False]*3)
Beispiel #6
0
 def test_nan_low_low(self):
     x = array([nan, 2, 3])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, False, False])
Beispiel #7
0
 def test_all_inside(self):
     x = linspace(1, 2, 101)
     result = intersect_range(x, 0.0, 3.0)
     assert_array_equal(result, ones(101, dtype=bool))
 def test_low_high_in(self):
     x = array([-3.0, 2, 0.5])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
 def test_high_low_high(self):
     x = array([2.0, -2.0, 2])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, True, True])
Beispiel #10
0
 def test_in_low_in(self):
     x = array([0.5, -2.0, 0.5])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, True, True])
Beispiel #11
0
 def test_in_in_in(self):
     x = array([0.75, 0.5, 0.25])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #12
0
 def test_in_high_low(self):
     x = array([0.5, 2, -1.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #13
0
 def test_low_low_low(self):
     x = array([-3.0, -2.0, -1.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False]*3)
Beispiel #14
0
 def test_high_high(self):
     x = array([3.0, 2.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False]*2)
Beispiel #15
0
 def test_high_high_high(self):
     x = array([2.5, 2, 3])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, False, False])
Beispiel #16
0
 def test_high_in_high(self):
     x = array([2.0, 0.5, 2])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #17
0
 def test_in_mask_in(self):
     x = array([0.5, 0.25, 0.75])
     mask = array([True, False, True])
     result = intersect_range(x, 0.0, 1.0, mask)
     assert_array_equal(result, [True, False, True])
Beispiel #18
0
 def test_low_high_high(self):
     x = array([-3.0, 2, 3])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, True, False])
Beispiel #19
0
 def test_in_nan_in(self):
     x = array([0.5, nan, 0.75])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, False, True])
Beispiel #20
0
 def test_high_high_high(self):
     x = array([2.5, 2, 3])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, False, False])
Beispiel #21
0
 def test_low_lower_bound(self):
     x = array([-1.0, 0.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*2)
Beispiel #22
0
 def test_mask_high_low(self):
     x = array([1, 2, -1.0])
     mask = array([False, True, True])
     result = intersect_range(x, 0.0, 1.0, mask)
     assert_array_equal(result, [False, True, True])
Beispiel #23
0
 def test_high_high(self):
     x = array([3.0, 2.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False]*2)
Beispiel #24
0
 def test_in_mask_in(self):
     x = array([0.5, 0.25, 0.75])
     mask = array([True, False, True])
     result = intersect_range(x, 0.0, 1.0, mask)
     assert_array_equal(result, [True, False, True])
Beispiel #25
0
 def test_in_high_low(self):
     x = array([0.5, 2, -1.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #26
0
 def test_low_low_mask(self):
     x = array([-0.5, -1.0, 0.5])
     mask = array([True, True, False])
     result = intersect_range(x, 0.0, 1.0, mask)
     assert_array_equal(result, [False, False, False])
Beispiel #27
0
 def test_in_in_in(self):
     x = array([0.75, 0.5, 0.25])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True]*3)
Beispiel #28
0
 def test_nan_low_low(self):
     x = array([nan, 2, 3])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, False, False])
Beispiel #29
0
 def test_high_low_high(self):
     x = array([2.0, -2.0, 2])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, True, True])
Beispiel #30
0
 def test_nan_high_low(self):
     x = array([nan, 2, -1.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, True, True])
Beispiel #31
0
 def test_low_high_high(self):
     x = array([-3.0, 2, 3])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, True, False])
Beispiel #32
0
 def test_in_nan_in(self):
     x = array([0.5, nan, 0.75])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [True, False, True])
Beispiel #33
0
 def test_mask_high_low(self):
     x = array([1, 2, -1.0])
     mask = array([False, True, True])
     result = intersect_range(x, 0.0, 1.0, mask)
     assert_array_equal(result, [False, True, True])
Beispiel #34
0
 def test_low_low_nan(self):
     x = array([-0.5, -1.0, nan])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, False, False])
Beispiel #35
0
 def test_low_low_mask(self):
     x = array([-0.5, -1.0, 0.5])
     mask = array([True, True, False])
     result = intersect_range(x, 0.0, 1.0, mask)
     assert_array_equal(result, [False, False, False])
Beispiel #36
0
 def test_all_inside(self):
     x = linspace(1, 2, 101)
     result = intersect_range(x, 0.0, 3.0)
     assert_array_equal(result, ones(101, dtype=bool))
Beispiel #37
0
 def test_nan_high_low(self):
     x = array([nan, 2, -1.0])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, True, True])
Beispiel #38
0
 def test_all_inside_mask(self):
     x = linspace(1, 2, 101)
     mask = (x <= 1.4) | (x >= 1.6)
     result = intersect_range(x, 0.0, 3.0, mask)
     print(mask ^ result)
     assert_array_equal(result, mask)
Beispiel #39
0
 def test_low_low_nan(self):
     x = array([-0.5, -1.0, nan])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [False, False, False])
Beispiel #40
0
 def test_empty(self):
     x = array([])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [])
Beispiel #41
0
 def test_all_inside_mask(self):
     x = linspace(1, 2, 101)
     mask = (x <= 1.4) | (x >= 1.6)
     result = intersect_range(x, 0.0, 3.0, mask)
     assert_array_equal(result, mask)
Beispiel #42
0
 def test_empty(self):
     x = array([])
     result = intersect_range(x, 0.0, 1.0)
     assert_array_equal(result, [])