da735616b83af99dc3a16edee3055527e379d93d,mathics/builtin/image.py,RandomImage,apply,#RandomImage#Any#Any#Any#Any#Any#,234

Before Change


        try:
            x0 = max(minval.to_python(), 0)
            x1 = min(maxval.to_python(), 1)
            return Image((numpy.random.rand(h.to_python(), w.to_python()) * (x1 - x0) + x0), "Grayscale")
        except:
            import sys
            return String(repr(sys.exc_info()))

After Change


    def apply(self, minval, maxval, w, h, evaluation):
        "RandomImage[{minval_?RealNumberQ, maxval_?RealNumberQ}, {w_Integer, h_Integer}]"
        size = [w.get_int_value(), h.get_int_value()]
        if size[0] <= 0 or size[1] <= 0:
            return evaluation.message("RandomImage", "bddim", from_python(size))
        minrange, maxrange = minval.get_real_value(), maxval.get_real_value()
        data = numpy.random.rand(size[1], size[0]) * (maxrange - minrange) + minrange
        return Image(data, "Grayscale")

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: mathics/Mathics
Commit Name: da735616b83af99dc3a16edee3055527e379d93d
Time: 2016-08-16
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/image.py
Class Name: RandomImage
Method Name: apply


Project Name: mathics/Mathics
Commit Name: 51b2e962f4891e7563543db5560e2bdc9a20bd6d
Time: 2016-08-05
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/exptrig.py
Class Name: Pi
Method Name: apply_N


Project Name: mathics/Mathics
Commit Name: 51b2e962f4891e7563543db5560e2bdc9a20bd6d
Time: 2016-08-05
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/exptrig.py
Class Name: E
Method Name: apply_N