Hi everyone,
I am using a HistogramLutWidget for an image that is displayed in a
pg.GraphicsLayoutWidget. The image is a dark and gain corrected image from
a CCD camera that updates in real time as it is received from the camera.
The problem I am having is that the ImageItem in the histogram display will
crash periodically in the method getHistogram(). This occurs if the min and
max of the image are the same. Here is the code snippet from getHistogram:
if bins == 'auto':
if stepData.dtype.kind in "ui":
mn = stepData.min()
mx = stepData.max()
step = np.ceil((mx-mn) / 500.)
bins = np.arange(mn, mx+1.01*step, step, dtype=np.int)
if len(bins) == 0:
bins = [mn, mx]
else:
bins = 500
If mn and mx are equal, then np.arange() fails with an error. I suggest the
following code change to fix the problem:
if bins == 'auto':
if stepData.dtype.kind in "ui":
mn = stepData.min()
mx = stepData.max()
step = np.ceil((mx-mn) / 500.)
bins = np.arange(mn, mx+1.01*step, step, dtype=np.int)
if len(bins) == 0:
bins = [mn, mx]
else:
bins = 500
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/88e2b756-c26c-4525-a973-6706f79cc481%40googlegroups.com.