eb9ddab4ba9d032588fc40e6c4616338d7eb672b,mathics/builtin/image.py,PixelValue,apply,#PixelValue#Any#Any#Any#Any#,1087

Before Change


class PixelValue(_ImageBuiltin):
    def apply(self, image, x, y, evaluation):
        "PixelValue[image_Image, {x_?RealNumberQ, y_?RealNumberQ}]"
        return Real(image.pixels[int(y.to_python() - 1), int(x.to_python() - 1)])


class PixelValuePositions(_ImageBuiltin):
    def apply(self, image, val, evaluation):

After Change


        "PixelValue[image_Image, {x_?RealNumberQ, y_?RealNumberQ}]"
        pixel = image.pixels[int(y.to_python() - 1), int(x.to_python() - 1)]
        if isinstance(pixel, (numpy.ndarray, numpy.generic, list)):
            return Expression("List", *[Real(float(x)) for x in list(pixel)])
        else:
            return Real(float(pixel))

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: mathics/Mathics
Commit Name: eb9ddab4ba9d032588fc40e6c4616338d7eb672b
Time: 2016-08-24
Author: Bernhard.Liebl@gmx.org
File Name: mathics/builtin/image.py
Class Name: PixelValue
Method Name: apply


Project Name: mathics/Mathics
Commit Name: deed936ca0bfa5998af0225fab99c47bd2bc4b6d
Time: 2020-09-06
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply


Project Name: mathics/Mathics
Commit Name: af4b29bd5694e2eec570d67602c4a81b5364b34d
Time: 2020-09-05
Author: pablo-escobar@riseup.net
File Name: mathics/builtin/linalg.py
Class Name: Eigenvalues
Method Name: apply