10000 [BUG]: `colour.XYZ_to_Luv` definition raises an exception when passed a [1, 1, 3] array. · Issue #1188 · colour-science/colour · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[BUG]: colour.XYZ_to_Luv definition raises an exception when passed a [1, 1, 3] array. #1188
Closed
@MrLixm

Description

@MrLixm

Description

Hello, I noticed an odd behaviour with the XYZ_to_Luv function.

(see reproduction code)

Now using numpy.full([2,2,3], ... instead will not produce any error.

As I was using this function in the context of plotting with the CIE Diagrams I cannot use the same array for all the diagrams, though this is a minor annoyance.

Cheers.
Liam.

Code for Reproduction

import numpy
import colour

image = numpy.full([1,1,3], [0.33, 0.6, 0.7])
result = colour.XYZ_to_Luv(image)

Exception Message

File "...", line 141, in XYZ_to_Luv
    Luv = tstack([L, u, v])
  File "...", line 2033, in tstack
    a = as_array(a, dtype)
  File "...", line 564, in as_array
    return np.asarray(a, dtype)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimension. The detected shape was (3,) + inhomogeneous part.

Environment Information

===============================================================================
*                                                                             *
*   Interpreter :                                                             *
*       python : 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC    *
*   v.1929 64 bit (AMD64)]                                                    *
*                                                                             *
*   colour-science.org :                                                      *
*       colour : 0.4.2                                                        *
*                                                                             *
*   Runtime :                                                                 *
*       imageio : 2.31.1                                                      *
*       matplotlib : 3.7.2                                                    *
*       numpy : 1.25.1                                                        *
*       pandas : 2.0.3                                                        *
*       scipy : 1.11.1                                                        *
*                                                                             *
===============================================================================
defaultdict(<class 'dict'>, {'Interpreter': {'python': '3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]'}, 'colour-science.org': {'colour': '0.4.2'}, 'Runtime': {'imageio': '2.31.1', 'matplotlib': '3.7.2', 'numpy': '1.25.1', 'pandas': '2.0.3', 'scipy': '1.11.1'}})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0