def test_rank_filter_2(self):
        self.expected_result_1[:] = self.reverse_array_1

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_1, 0, 0.5, out=self.result_1)

        assert (self.expected_result_1 == self.result_1).all()
    def test_rank_filter_12(self):
        self.expected_result_2[:] = self.reverse_array_2

        self.result_2[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_2, 0, 0.5, out=self.result_2)

        assert (self.expected_result_2 == self.result_2).all()
    def test_rank_filter_18(self):
        for i in xrange(len(self.array_1)):
            self.expected_result_1[i] = self.array_1[5] if (i < 5) else self.array_1[4]

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.array_1, len(self.array_1) - 1, 0.5, out=self.result_1)

        assert (self.expected_result_1 == self.result_1).all()
    def test_rank_filter_3(self):
        self.expected_result_1[:] = self.array_1
        self.expected_result_1[0] = self.expected_result_1[1]
        self.expected_result_1[-1] = self.expected_result_1[-2]

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.array_1, 1, 0.5, out=self.result_1)

        assert (self.expected_result_1 == self.result_1).all()
    def test_rank_filter_17(self):
        self.expected_result_2[:] = self.reverse_array_2
        self.expected_result_2[..., 0] = self.expected_result_2[..., 1]
        self.expected_result_2[..., -1] = self.expected_result_2[..., -2]

        self.result_2 = self.reverse_array_2

        rank_filter.lineRankOrderFilter(self.result_2, 1, 0.5, -1, out=self.result_2)

        assert (self.expected_result_2 == self.result_2).all()
    def test_rank_filter_10(self):
        self.expected_result_1[:] = self.reverse_array_1
        self.expected_result_1[0] = self.expected_result_1[1] = self.expected_result_1[2]
        self.expected_result_1[-1] = self.expected_result_1[-2] = self.expected_result_1[-3]

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_1, 3, 0.5, 0, out=self.result_1)

        assert (self.expected_result_1 == self.result_1).all()
Beispiel #7
0
    def test_rank_filter_14(self):
        self.expected_result_2[:] = self.reverse_array_2
        self.expected_result_2[0] = self.expected_result_2[1]
        self.expected_result_2[-1] = self.expected_result_2[-2]

        self.result_2[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_2, 1, 0.5, 0, out=self.result_2)

        assert((self.expected_result_2 == self.result_2).all())
    def test_rank_filter_2(self):
        self.expected_result_1[:] = self.reverse_array_1

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_1,
                                        0,
                                        0.5,
                                        out=self.result_1)

        assert ((self.expected_result_1 == self.result_1).all())
    def test_rank_filter_12(self):
        self.expected_result_2[:] = self.reverse_array_2

        self.result_2[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_2,
                                        0,
                                        0.5,
                                        out=self.result_2)

        assert ((self.expected_result_2 == self.result_2).all())
    def test_rank_filter_3(self):
        self.expected_result_1[:] = self.array_1
        self.expected_result_1[0] = self.expected_result_1[1]
        self.expected_result_1[-1] = self.expected_result_1[-2]

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.array_1,
                                        1,
                                        0.5,
                                        out=self.result_1)

        assert ((self.expected_result_1 == self.result_1).all())
    def test_rank_filter_18(self):
        for i in xrange(len(self.array_1)):
            self.expected_result_1[i] = self.array_1[5] if (
                i < 5) else self.array_1[4]

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.array_1,
                                        len(self.array_1) - 1,
                                        0.5,
                                        out=self.result_1)

        assert ((self.expected_result_1 == self.result_1).all())
    def test_rank_filter_17(self):
        self.expected_result_2[:] = self.reverse_array_2
        self.expected_result_2[..., 0] = self.expected_result_2[..., 1]
        self.expected_result_2[..., -1] = self.expected_result_2[..., -2]

        self.result_2 = self.reverse_array_2

        rank_filter.lineRankOrderFilter(self.result_2,
                                        1,
                                        0.5,
                                        -1,
                                        out=self.result_2)

        assert ((self.expected_result_2 == self.result_2).all())
    def test_rank_filter_10(self):
        self.expected_result_1[:] = self.reverse_array_1
        self.expected_result_1[0] = self.expected_result_1[
            1] = self.expected_result_1[2]
        self.expected_result_1[-1] = self.expected_result_1[
            -2] = self.expected_result_1[-3]

        self.result_1[:] = 0

        rank_filter.lineRankOrderFilter(self.reverse_array_1,
                                        3,
                                        0.5,
                                        0,
                                        out=self.result_1)

        assert ((self.expected_result_1 == self.result_1).all())
def benchmark():
    input_array = numpy.random.normal(size=(100, 101, 102))
    output_array = numpy.empty_like(input_array)

    lineRankOrderFilter(input_array, 25, 0.5, 0, output_array)
def benchmark():
    input_array = numpy.random.normal(size=(100, 101, 102))
    output_array = numpy.empty_like(input_array)

    lineRankOrderFilter(input_array, 25, 0.5, 0, output_array)