Optimize clip and downsample#2719
Conversation
np.searchsorted performs poorly when the array.dtype does not match the type of the value (float) being searched.
|
Thanks @pijyoi I agree that this is a conservative change and I would be more impressed than anything if this change broke things for someone. |
|
Thanks a lot @pijyoi and @j9ac9k . In this version moving and zooming through a huge plot is now fluid once it is created. However, the first plotting still takes several minutes of my computer. Two problems there :
I think the easiest fix (it is what I am using) is to let the user correct the point 1 by correctly initializing large datasets, and then, for the point 2, in case of This is what I'm doing and it seems OK for me ! A better fix would be to remove useless repeated calls to |
|
Hello, @pijyoi, @j9ac9k and @Mriv31: in PyQtGraph version Example code: ...
self.scatter = pg.ScatterPlotItem(
size=5,
pen=pg.mkPen(None),
brush=pg.mkBrush(255, 255, 255, 128), # To be overridden in the next call depending on a setting
hoverable=True,
hoverSymbol="s",
hoverSize=5,
hoverPen=pg.mkPen("w", width=2),
hoverBrush=None,
)
...
self.scatter.addPoints(x=x, y=y, data=tid, brush=brushes,) # Here brushes is equal to tidFor Regarding the comment by @Mriv31, in my case I need to make sure to draw all the points. |
This PR implements two of the ideas pointed out in #2710 that affect viewing of large datasets.
bisect_leftinstead ofnp.searchsortedThe changes done in this PR are conservative and should hopefully not break any existing use-cases.