Luka Drmic
2018-10-31 15:15:07 UTC
Hello i have a little problem that i cant find a solution to.
I have an ImageItem to which i add some data i plot it.
central_item = pg.GraphicsLayout()
main_subplot = central_item.addPlot()
img = pg.ImageItem()
img.setImage(self.plt_data)
main_subplot.addItem(img)
After that i change that data, and some parts of data become NaN. (I have
tried np.nan and float("NaN"), neither works)
This breaks my imageitem and the whole image is displayed as black. Any
ideas how ti fix this
Additional info:
* - example data before correction:*
[[ 1.26721e-09 1.19301e-09 1.11133e-09 ... -7.82147e-10 -8.43276e-10
-8.80460e-10]
[ 1.21326e-09 1.14925e-09 1.05997e-09 ... -8.08065e-10 -8.45355e-10
-9.01877e-10]
[ 1.15840e-09 1.06533e-09 9.91163e-10 ... -8.41492e-10 -8.84370e-10
-9.44690e-10]
...
[ 3.08664e-09 2.73720e-09 2.46942e-09 ... -4.24728e-10 -4.37422e-10
-4.55941e-10]
[ 3.15188e-09 2.82395e-09 2.54162e-09 ... -4.35917e-10 -4.45014e-10
-4.64306e-10]
[ 3.30943e-09 2.97556e-09 2.65902e-09 ... -4.49749e-10 -4.56709e-10
-4.71022e-10]]
* - example data after correction*
[[ nan 1.19301021e-09 1.11133022e-09 ... -7.82147116e-10
-8.43276076e-10 nan]
[ nan 1.14925018e-09 1.05997023e-09 ... -8.08065073e-10
-8.45355116e-10 nan]
[ nan 1.06533024e-09 9.91163178e-10 ... -8.41492088e-10
-8.84370129e-10 nan]
...
[ nan 2.73720232e-09 2.46942160e-09 ... -4.24728013e-10
-4.37422020e-10 nan]
[ nan 2.82395225e-09 2.54162174e-09 ... -4.35917010e-10
-4.45014021e-10 nan]
[ nan 2.97556241e-09 2.65902204e-09 ... -4.49749008e-10
-4.56709016e-10 nan]]
* - image before correction*
[image: data_before.PNG]
* - image after correction*
[image: data_after.PNG]
Desired result would be like in the image below which is produced by
setting values to 0 instead of NaN, which is something i dont want to do
because data at those points is not actually 0, its unknown.
[image: desired.PNG]
I have an ImageItem to which i add some data i plot it.
central_item = pg.GraphicsLayout()
main_subplot = central_item.addPlot()
img = pg.ImageItem()
img.setImage(self.plt_data)
main_subplot.addItem(img)
After that i change that data, and some parts of data become NaN. (I have
tried np.nan and float("NaN"), neither works)
This breaks my imageitem and the whole image is displayed as black. Any
ideas how ti fix this
Additional info:
* - example data before correction:*
[[ 1.26721e-09 1.19301e-09 1.11133e-09 ... -7.82147e-10 -8.43276e-10
-8.80460e-10]
[ 1.21326e-09 1.14925e-09 1.05997e-09 ... -8.08065e-10 -8.45355e-10
-9.01877e-10]
[ 1.15840e-09 1.06533e-09 9.91163e-10 ... -8.41492e-10 -8.84370e-10
-9.44690e-10]
...
[ 3.08664e-09 2.73720e-09 2.46942e-09 ... -4.24728e-10 -4.37422e-10
-4.55941e-10]
[ 3.15188e-09 2.82395e-09 2.54162e-09 ... -4.35917e-10 -4.45014e-10
-4.64306e-10]
[ 3.30943e-09 2.97556e-09 2.65902e-09 ... -4.49749e-10 -4.56709e-10
-4.71022e-10]]
* - example data after correction*
[[ nan 1.19301021e-09 1.11133022e-09 ... -7.82147116e-10
-8.43276076e-10 nan]
[ nan 1.14925018e-09 1.05997023e-09 ... -8.08065073e-10
-8.45355116e-10 nan]
[ nan 1.06533024e-09 9.91163178e-10 ... -8.41492088e-10
-8.84370129e-10 nan]
...
[ nan 2.73720232e-09 2.46942160e-09 ... -4.24728013e-10
-4.37422020e-10 nan]
[ nan 2.82395225e-09 2.54162174e-09 ... -4.35917010e-10
-4.45014021e-10 nan]
[ nan 2.97556241e-09 2.65902204e-09 ... -4.49749008e-10
-4.56709016e-10 nan]]
* - image before correction*
[image: data_before.PNG]
* - image after correction*
[image: data_after.PNG]
Desired result would be like in the image below which is produced by
setting values to 0 instead of NaN, which is something i dont want to do
because data at those points is not actually 0, its unknown.
[image: desired.PNG]
--
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 pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/2d8320e6-72f7-4b5e-8a41-3de69b8f23b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 pyqtgraph+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/2d8320e6-72f7-4b5e-8a41-3de69b8f23b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.