Beispiel #1
0
 def normalize(cls, input_list, **kwargs):
     """
     Normalize list elements
     """
     list_min = numpypy.min(input_list, **kwargs)
     list_norm = 1.0 / (numpypy.max(input_list, **kwargs) - list_min)
     if kwargs.pop("round", True):
         output_list = map(lambda x: round((x - list_min) * list_norm, cls.default_round), input_list)
     else:
         output_list = map(lambda x: (x - list_min) * list_norm, input_list)
     return output_list
Beispiel #2
0
    def test_min_max_after_import(self):
        import __builtin__
        from __builtin__ import *

        from numpypy import *
        assert min is __builtin__.min
        assert max is __builtin__.max

        assert min(1, 100) == 1
        assert min(100, 1) == 1

        assert max(1, 100) == 100
        assert max(100, 1) == 100

        assert min(4, 3, 2, 1) == 1
        assert max(1, 2, 3, 4) == 4

        from numpypy import min, max, amin, amax
        assert min is not __builtin__.min
        assert max is not __builtin__.max
        assert min is amin
        assert max is amax
Beispiel #3
0
    def test_min_max_after_import(self):
        import __builtin__
        from __builtin__ import *

        from numpypy import *
        assert min is __builtin__.min
        assert max is __builtin__.max

        assert min(1, 100) == 1
        assert min(100, 1) == 1

        assert max(1, 100) == 100
        assert max(100, 1) == 100

        assert min(4, 3, 2, 1) == 1
        assert max(1, 2, 3, 4) == 4

        from numpypy import min, max, amin, amax
        assert min is not __builtin__.min
        assert max is not __builtin__.max
        assert min is amin
        assert max is amax
Beispiel #4
0
 def max(cls, input_list, **kwargs):
     """
     Calculate ceiling
     """
     return round(numpypy.max(input_list, **kwargs), cls.default_round)