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

Before Change


        "RandomImage[{minval_?RealNumberQ, maxval_?RealNumberQ}, {w_Integer, h_Integer}]"
        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

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: 4

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: 25cef78bbd3cf3b2ba10067087831f4fd3cc03a5
Time: 2016-08-16
Author: 16sn6uv@gmail.com
File Name: mathics/builtin/image.py
Class Name: ImageResize
Method Name: apply_resize_width


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