Esempio n. 1
0
    def test_interval_with_range(self, t, x):

        values = (1, 3)
        s = Temporal((1, 3))._setup(t, IntervalProperty())
        normed = (x - x.min()) / (x.max() - x.min())
        expected = normed * (values[1] - values[0]) + values[0]
        assert_array_equal(s(t), expected)
Esempio n. 2
0
    def test_interval_with_norm(self, t, x):

        norm = t[1], t[2]
        s = Temporal(norm=norm)._setup(t, IntervalProperty())
        n = mpl.dates.date2num(norm)
        normed = (x - n[0]) / (n[1] - n[0])
        assert_array_equal(s(t), normed)
Esempio n. 3
0
    def test_interval_with_range_norm_and_transform(self, x):

        x = pd.Series([1, 10, 100])
        # TODO param order?
        s = Continuous((2, 3), (10, 100), "log")._setup(x, IntervalProperty())
        assert_array_equal(s(x), [1, 2, 3])
Esempio n. 4
0
    def test_interval_with_norm(self, x):

        s = Continuous(norm=(3, 7))._setup(x, IntervalProperty())
        assert_array_equal(s(x), [-.5, 0, 1.5])
Esempio n. 5
0
    def test_interval_with_range(self, x):

        s = Continuous((1, 3))._setup(x, IntervalProperty())
        assert_array_equal(s(x), [1, 1.5, 3])
Esempio n. 6
0
    def test_interval_defaults(self, x):

        s = Continuous()._setup(x, IntervalProperty())
        assert_array_equal(s(x), [0, .25, 1])
Esempio n. 7
0
    def test_interval_defaults(self, t, x):

        s = Temporal()._setup(t, IntervalProperty())
        normed = (x - x.min()) / (x.max() - x.min())
        assert_array_equal(s(t), normed)
Esempio n. 8
0
    def test_interval_dict(self, x):

        vs = {"a": 3, "b": 4, "c": 6}
        s = Nominal(vs)._setup(x, IntervalProperty())
        assert_array_equal(s(x), [3, 6, 4, 6])
Esempio n. 9
0
    def test_interval_list(self, x):

        vs = [2, 5, 4]
        s = Nominal(vs)._setup(x, IntervalProperty())
        assert_array_equal(s(x), [2, 5, 4, 5])
Esempio n. 10
0
    def test_interval_tuple_numeric(self, y):

        s = Nominal((1, 2))._setup(y, IntervalProperty())
        assert_array_equal(s(y), [1.5, 2, 1, 2])
Esempio n. 11
0
    def test_interval_tuple(self, x):

        s = Nominal((1, 2))._setup(x, IntervalProperty())
        assert_array_equal(s(x), [2, 1.5, 1, 1.5])