enthought / chaco

Chaco is a Python package for building interactive and custom 2-D plots.
http://docs.enthought.com/chaco/
Other
292 stars 99 forks source link

ValueError: object of too small depth for desired array when running chaco/chaco/examples/demo/advanced/scalar_image_function_inspector.py #890

Open homosapien-lcy opened 1 year ago

homosapien-lcy commented 1 year ago

Problem Description When running chaco/chaco/examples/demo/advanced/scalar_image_function_inspector.py, a ValueError: object of too small depth for desired array will be raised

Reproduction Steps:

python chaco/chaco/examples/demo/advanced/scalar_image_function_inspector.py

Link: https://github.com/enthought/chaco/blob/main/chaco/examples/demo/advanced/scalar_image_function_inspector.py

Full Stacktrace:

(py311) (base) cyliu@aus552cyliu chaco % python3.11 chaco/examples/demo/advanced/scalar_image_function_inspector.py
The function name tanh(x**2+y)*cos(y)*jn(0,x+y*2) is invalid
2023-05-08 11:20:17.147 Python[2607:50100] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/2z/kylzj9s92y71cxscmljmpqrh0000gt/T/org.python.python.savedState
Exception occurred in traits notification handler for object: <__main__.DemoModelView object at 0x12a12f7e0>, trait: edit_model, old value: <undefined>, new value: 0
Traceback (most recent call last):
  File "/Users/cyliu/.venvs/py311/lib/python3.11/site-packages/traits/trait_notifiers.py", line 342, in __call__
    self.handler(*args)
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/examples/demo/advanced/scalar_image_function_inspector.py", line 601, in _edit_model_fired
    self.model.configure_traits()
  File "/Users/cyliu/.venvs/py311/lib/python3.11/site-packages/traits/has_traits.py", line 2164, in configure_traits
    rc = toolkit().view_application(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 237, in view_application
    return view_application.view_application(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/view_application.py", line 90, in view_application
    app = QtGui.QApplication.instance()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  [Previous line repeated 3 more times]
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 268, in leaveEvent
    self.handler.leaveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 146, in leaveEvent
    self._enable_window._handle_mouse_event("mouse_leave", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 470, in _create_mouse_event
    pos = self.control.mapFromGlobal(QtGui.QCursor.pos())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 280, in mouseReleaseEvent
    self.handler.mouseReleaseEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 164, in mouseReleaseEvent
    name = BUTTON_NAME_MAP[event.button()]
                           ^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 277, in mousePressEvent
    self.handler.mousePressEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 159, in mousePressEvent
    name = BUTTON_NAME_MAP[event.button()]
                           ^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 274, in mouseMoveEvent
    self.handler.mouseMoveEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 155, in mouseMoveEvent
    self._enable_window._handle_mouse_event("mouse_move", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 265, in enterEvent
    self.handler.enterEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 142, in enterEvent
    self._enable_window._handle_mouse_event("mouse_enter", event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 349, in _handle_mouse_event
    mouse_event = self._create_mouse_event(event)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 460, in _create_mouse_event
    x = event.position().x()
        ^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 253, in paintEvent
    self.handler.paintEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 88, in paintEvent
    self._enable_window._paint(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 524, in _paint
    size = self._get_control_size()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 592, in _get_control_size
    return (int(self.control.width() * self.base_pixel_scale),
                ^^^^^^^^^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  File "/Users/cyliu/Documents/3.11_test/traitsui/traitsui/qt/toolkit.py", line 129, in eventFilter
    if event.type() == QtCore.QEvent.Type.KeyPress:
       ^^^^^^^^^^^^
  [Previous line repeated 4 more times]
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 253, in paintEvent
    self.handler.paintEvent(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/qt/base_window.py", line 88, in paintEvent
    self._enable_window._paint(event)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/abstract_window.py", line 536, in _paint
    self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
  File "/Users/cyliu/Documents/3.11_test/enable/enable/component.py", line 410, in draw
    self._draw(gc, view_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/component.py", line 787, in _draw
    self._dispatch_draw(layer, gc, view_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/container.py", line 270, in _dispatch_draw
    component._dispatch_draw(layer, gc, new_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/container.py", line 268, in _dispatch_draw
    component._draw(gc, new_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/component.py", line 777, in _draw
    self._dispatch_draw(layer, bb, view_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/container.py", line 270, in _dispatch_draw
    component._dispatch_draw(layer, gc, new_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/enable/enable/component.py", line 805, in _dispatch_draw
    handler(gc, view_bounds, mode)
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/base_2d_plot.py", line 221, in _draw_image
    self._render(gc)
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/plots/contour/contour_poly_plot.py", line 55, in _render
    self._update_polys()
  File "/Users/cyliu/Documents/3.11_test/chaco/chaco/plots/contour/contour_poly_plot.py", line 95, in _update_polys
    c = Cntr(xg, yg, data, ~mask)
        ^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: object of too small depth for desired array

OS, Python version: [MacOS, python3.11]

Package            Version     Editable project location
------------------ ----------- -----------------------------------------
apptools           5.2.0
attrdict           2.0.1
attrdict3          2.0.2
blosc2             2.0.0
celiagg            2.1.3
certifi            2022.12.7
chaco              5.1.0       /Users/cyliu/Documents/3.11_test/chaco
charset-normalizer 3.1.0
configobj          5.0.8
cPython            0.0.6
Cython             0.29.34
dnspython          2.3.0
enable             5.4.0.dev31 /Users/cyliu/Documents/3.11_test/enable
fonttools          4.39.2
h5py               3.8.0
idna               3.4
joblib             1.2.0
kiwisolver         1.4.4
msgpack            1.0.5
numexpr            2.8.4
numpy              1.24.2
packaging          23.1
pandas             1.5.3
Pillow             9.4.0
pip                23.1
py-cpuinfo         9.0.0
PyAudio            0.2.13
pyface             8.0.0       /Users/cyliu/Documents/3.11_test/pyface
pygarrayimage      1.0
pyglet             2.0.5       /Users/cyliu/Documents/3.11_test/pyglet
Pygments           2.14.0
pymongo            4.3.3
pyparsing          3.0.9
PySide6            6.4.3
PySide6-Addons     6.4.3
PySide6-Essentials 6.4.3
python-dateutil    2.8.2
pythonw            3.0.3
pytz               2023.2
reportlab          3.6.12
requests           2.28.2
scikit-learn       1.2.2
scipy              1.10.1
setuptools         65.6.3
shiboken6          6.4.3
six                1.16.0
tables             3.8.0
threadpoolctl      3.1.0
traits             6.4.1
traitsui           8.0.0.dev0  /Users/cyliu/Documents/3.11_test/traitsui
urllib3            1.26.15
wxPython           4.2.0
homosapien-lcy commented 1 year ago

After some investigation, I found the the problem is likely due to the eval function at https://github.com/enthought/chaco/blob/main/chaco/examples/demo/advanced/scalar_image_function_inspector.py#L135. It's possible that in the current python, eval cannot handle the test function "tanh(x*2+y)cos(y)jn(0,x+y2)" at line 90.