def test_nan(self): ary = array([1.0, nan, 10.0, nan, 100.0, 1000.0]) ds = ArrayDataSource(ary) r = DataRange1D(ds) mapper = LogMapper(range=r, low_pos=0, high_pos=30) mapper.fill_value = 100.0 result = mapper.map_screen(ary) assert_array_almost_equal(result, [0, 20, 10, 20, 20, 30]) return
def test_fill_value(self): ary = array([1.0, -1.0, -2.0, 10.0, 100.0, 1000.0]) ds = ArrayDataSource(ary) r = DataRange1D(ds) mapper = LogMapper(range=r, low_pos=0, high_pos=30) # This causes out-of-bounds values to be treated as the value 100.0 mapper.fill_value = 100.0 result = mapper.map_screen(ary) assert_array_almost_equal(result, [0, 20, 20, 10, 20, 30]) return