Discussion:
bug in XYImageItem for big values in x
Carlos Pascual
2011-06-16 15:22:41 UTC
Permalink
I am using guiqwt 2.1.3 and I found a strange bug in XYImageItem:
If the x values are very large, the image disapears/appears depending on the
panning and the zoom.

For demonstration see the following function:

++++++++++++++++++++++++++++++
def xyimagebug(offset):
from guiqwt.plot import ImageDialog
from taurus.qt.extra_guiqwt.builder import make
import numpy
import guidata
app = guidata.qapplication()

data = numpy.random.rand(100,100)
x = numpy.arange(100)+offset
y = numpy.arange(100)
image = make.xyimage(x,y,data=data)

win = ImageDialog()

plot = win.get_plot()
plot.add_item(image)
plot.select_item(image) #this helps in seeing where the image should be

win.exec_()
++++++++++++++++++++++++++++++++++

If called as "xyimagebug(1e4)", everything works as expected (see ok.png
attached). You can pan and zoom in/out without problems...

...but if launched as "xyimagebug(1e9)", you will see that either:
a) the image does not appear at all (see bad2.png)
b) a wrong image appears (see bad1.png)
c) the image appears/disapears when panning or zooming in/out

Unfortunately this is a big problem for me because I want to represent
timestamps in the x scale

Do you know of any fix/workaround?

ps: I tried using ints instead of doubles for "data" and "x", but the problem
still occurs
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Carlos Pascual
2011-06-16 16:40:52 UTC
Permalink
ps: the bug also occurs with guiqwt 2.1.4beta2
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Carlos Pascual
2011-06-20 09:32:50 UTC
Permalink
Just one correction to the bug demo code thqat I posted.
Where I wrote: "from taurus.qt.extra_guiqwt.builder import make"
it should say: "from guiqwt.builder import make"

"taurus" is a specialised library of our lab that probably no one in the list
has installed.

So the code for reproducing the error is:

+++++++++++++++++++++++++++++++++++++
def xyimagebug(offset):
from guiqwt.plot import ImageDialog
from guiqwt.builder import make
import numpy
import guidata
app = guidata.qapplication()
data = numpy.random.rand(100,100)
x = numpy.arange(100)+offset
y = numpy.arange(100)
image = make.xyimage(x,y,data=data)
win = ImageDialog()
plot = win.get_plot()
plot.add_item(image)
plot.select_item(image) #this helps in seeing where the image should be
win.exec_()

xyimagebug(1e9) #offset=1e9 makes it fail, but offset=1e4 is ok
+++++++++++++++++++++++++++++++++++
Post by Carlos Pascual
If the x values are very large, the image disapears/appears depending on
the panning and the zoom.
++++++++++++++++++++++++++++++
from guiqwt.plot import ImageDialog
from taurus.qt.extra_guiqwt.builder import make
import numpy
import guidata
app = guidata.qapplication()
data = numpy.random.rand(100,100)
x = numpy.arange(100)+offset
y = numpy.arange(100)
image = make.xyimage(x,y,data=data)
win = ImageDialog()
plot = win.get_plot()
plot.add_item(image)
plot.select_item(image) #this helps in seeing where the image should be
win.exec_()
++++++++++++++++++++++++++++++++++
If called as "xyimagebug(1e4)", everything works as expected (see ok.png
attached). You can pan and zoom in/out without problems...
a) the image does not appear at all (see bad2.png)
b) a wrong image appears (see bad1.png)
c) the image appears/disapears when panning or zooming in/out
Unfortunately this is a big problem for me because I want to represent
timestamps in the x scale
Do you know of any fix/workaround?
ps: I tried using ints instead of doubles for "data" and "x", but the
problem still occurs
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Carlos Pascual
2011-06-20 09:38:39 UTC
Permalink
Also, just in case it helps:
I did a test using PyQwt directly, and I could render an image in a plot with
the x scale being offset by 1e9 using QwtPlotSpectrogram, so it does not seem
to be a problem in PyQwt (although I may have done something totally different
to what guiqwt does)
Post by Carlos Pascual
If the x values are very large, the image disapears/appears depending on
the panning and the zoom.
++++++++++++++++++++++++++++++
from guiqwt.plot import ImageDialog
from taurus.qt.extra_guiqwt.builder import make
import numpy
import guidata
app = guidata.qapplication()
data = numpy.random.rand(100,100)
x = numpy.arange(100)+offset
y = numpy.arange(100)
image = make.xyimage(x,y,data=data)
win = ImageDialog()
plot = win.get_plot()
plot.add_item(image)
plot.select_item(image) #this helps in seeing where the image should be
win.exec_()
++++++++++++++++++++++++++++++++++
If called as "xyimagebug(1e4)", everything works as expected (see ok.png
attached). You can pan and zoom in/out without problems...
a) the image does not appear at all (see bad2.png)
b) a wrong image appears (see bad1.png)
c) the image appears/disapears when panning or zooming in/out
Unfortunately this is a big problem for me because I want to represent
timestamps in the x scale
Do you know of any fix/workaround?
ps: I tried using ints instead of doubles for "data" and "x", but the
problem still occurs
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Loading...