コード例 #1
0
    def test_get_coverage_01(self):
        from_axis = Axis(lower_bound=np.arange(0, 7) * 24,
                         upper_bound=np.arange(1, 8) * 24,
                         fraction=0.5)

        to_axis = Axis(lower_bound=[0], upper_bound=[168], data_ticks=[84])

        row_idx, col_idx, weights = AxisRemapper._get_coverage(
            from_axis.lower_bound, from_axis.upper_bound, to_axis.lower_bound,
            to_axis.upper_bound)

        self.assertListEqual([0] * 7, row_idx)
        self.assertListEqual(list(range(7)), col_idx)
        self.assertListEqual([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], weights)
コード例 #2
0
    def test_get_coverage_03(self):
        from_axis = DailyTimeAxisBuilder()\
            .set_start_date(date(2019, 1, 1)) \
            .set_end_date(date(2019, 1, 8)) \
            .build()

        to_axis = WeeklyTimeAxisBuilder()\
            .set_start_date(date(2019, 1, 1)) \
            .set_end_date(date(2019, 1, 8)) \
            .build()

        row_idx, col_idx, weights = AxisRemapper._get_coverage(
            from_axis.lower_bound, from_axis.upper_bound, to_axis.lower_bound,
            to_axis.upper_bound)

        self.assertListEqual([0] * 7, row_idx)
        self.assertListEqual(list(range(7)), col_idx)
        self.assertListEqual([1.0] * 7, weights)