6441aa3d9929de1fdce6384d997d17900f03ec2f,mathics/builtin/image.py,ImageCreate,apply,#ImageCreate#Any#Any#,945

Before Change


        pixels = numpy.array(array.to_python(), dtype="float64")
        shape = pixels.shape
        is_rgb = (len(shape) == 3 and shape[2] == 3)
        if len(shape) == 2 or (len(shape) == 3 and shape[2] in (1, 3)):
            return Image(pixels.clip(0, 1), "RGB" if is_rgb else "Grayscale")
        else:
            return Expression("Image", array)


class ImageBox(BoxConstruct):
    def boxes_to_text(self, leaves, **options):
        return "-Image-"

After Change


    def apply(self, array, evaluation):
        """ImageCreate[array_]"""
        pixels = _image_pixels(array.to_python())
        if pixels is not None:
            shape = pixels.shape
            is_rgb = (len(shape) == 3 and shape[2] == 3)
            return Image(pixels.clip(0, 1), "RGB" if is_rgb else "Grayscale")
        else:
            return Symbol("$Aborted")


class ImageBox(BoxConstruct):
    def boxes_to_text(self, leaves, **options):
        return "-Image-"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: mathics/Mathics
Commit Name: 6441aa3d9929de1fdce6384d997d17900f03ec2f
Time: 2016-08-16
Author: Bernhard.Liebl@gmx.org
File Name: mathics/builtin/image.py
Class Name: ImageCreate
Method Name: apply


Project Name: mathics/Mathics
Commit Name: a74a4a6c1f2b574ab039fd0d3797eaa65697b03d
Time: 2016-08-23
Author: Bernhard.Liebl@gmx.org
File Name: mathics/builtin/manipulate.py
Class Name: Manipulate
Method Name: apply


Project Name: brian-team/brian2
Commit Name: 96d693619f48a2f0ee2a5781e387d900976a01cd
Time: 2015-09-29
Author: marcel.stimberg@inserm.fr
File Name: brian2/stateupdaters/exact.py
Class Name: LinearStateUpdater
Method Name: __call__