[pilx] Exception when running the diffmap
ERROR:silx.gui.plot.tools.PositionInfo:Error while converting coordinates (81.000000, 57.000000)with converter 'Data'
ERROR:silx.gui.plot.tools.PositionInfo:Traceback (most recent call last):
File "/users/kieffer/.venv/py312/lib/python3.12/site-packages/silx/gui/plot/tools/PositionInfo.py", line 299, in _updateStatusBar
value = func(xData, yData)
^^^^^^^^^^^^^^^^^^
File "/users/kieffer/.venv/py312/lib/python3.12/site-packages/pyFAI/gui/pilx/widgets/MapPlotWidget.py", line 94, in _dataConverter
index = self.getScatterIndex(x, y)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/users/kieffer/.venv/py312/lib/python3.12/site-packages/pyFAI/gui/pilx/widgets/MapPlotWidget.py", line 168, in getScatterIndex
pixel_x, pixel_y = self.dataToPixel(x_data, y_data)
^^^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object
Should at least be silenced out.
How to reproduce this ?
This is when moving the mouse around.
It happens sometimes when the mouse is right at the edge of the map widget. Due to numeric precision, sometimes the position of the cursor goes out of the edges.
I put these debugging lines at datatoPixel method
if check:
isOutside = numpy.logical_or(
numpy.logical_or(x > xmax, x < xmin),
numpy.logical_or(y > ymax, y < ymin),
)
print(f"{isOutside=}")
print(f"{x=}, {y=}")
print(f"{xmin=}, {xmax=}")
print(f"{ymin=}, {ymax=}")
isOutside=False
x=-0.41312354735751144, y=1.201234995383195
xmin=-0.42311233885819544, xmax=0.7227849396357682
ymin=1.128654970760234, ymax=1.6915204678362574
isOutside=False
x=-0.41593729144221114, y=1.201234995383195
xmin=-0.42311233885819544, xmax=0.7227849396357682
ymin=1.128654970760234, ymax=1.6915204678362574
isOutside=False
x=-0.41875103552691084, y=1.201234995383195
xmin=-0.42311233885819544, xmax=0.7227849396357682
ymin=1.128654970760234, ymax=1.6915204678362574
isOutside=False
x=-0.4215647796116106, y=1.201234995383195
xmin=-0.42311233885819544, xmax=0.7227849396357682
ymin=1.128654970760234, ymax=1.6915204678362574
isOutside=True
x=-0.42437852369631035, y=1.2061724120242125
xmin=-0.42311233885819544, xmax=0.7227849396357682
ymin=1.128654970760234, ymax=1.6915204678362574
ERROR:silx.gui.plot.tools.PositionInfo:Error while converting coordinates (81.000000, 227.000000)with converter 'Data'
ERROR:silx.gui.plot.tools.PositionInfo:Traceback (most recent call last):
File "/users/edgar1993a/anaconda3/envs/ewoks/lib/python3.9/site-packages/silx/gui/plot/tools/PositionInfo.py", line 299, in _updateStatusBar
value = func(xData, yData)
File "/home/edgar1993a/work/pyFAI/build/lib/python3.9/site-packages/pyFAI/gui/pilx/widgets/MapPlotWidget.py", line 104, in _dataConverter
index = self.getScatterIndex(x, y)
File "/home/edgar1993a/work/pyFAI/build/lib/python3.9/site-packages/pyFAI/gui/pilx/widgets/MapPlotWidget.py", line 181, in getScatterIndex
pixel_x, pixel_y = self.dataToPixel(x_data, y_data)
TypeError: cannot unpack non-iterable NoneType object
In the last interaction, the mouse x is at -0.42437852369631035 while the minus limit is at -0.42311233885819544
fixed in #2235
It happens only when the cursor is moving around the left and top axis (x-minimum and y-maximum). In this patch, I catch the error and continue.