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

Before Change



    def apply(self, minval, maxval, w, h, evaluation):
        "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
            return String(repr(sys.exc_info()))

// simple image manipulation

class ImageResize(Builtin):
    options = {
        "Resampling": ""Bicubic""
    }

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")


// simple image manipulation
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

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: thenetcircle/dino
Commit Name: f6ee86322866ed42040c28a2a8782c21138a2c4a
Time: 2019-01-08
Author: oscar.eriks@gmail.com
File Name: dino/hooks/status.py
Class Name: OnStatusHooks
Method Name: set_status


Project Name: sahana/eden
Commit Name: eb0bd3ee1c1822d7ee5a7a48f284ad22e8a9a9f2
Time: 2020-03-20
Author: fran@aidiq.com
File Name: modules/templates/CCC/controllers.py
Class Name:
Method Name: auth_user_register_onaccept