danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
642 stars 224 forks source link

asammdf monkey patch breaks own pyqtgraph-scatterplot #667

Closed mw25 closed 2 years ago

mw25 commented 2 years ago

Python version

('python=3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 ' 'bit (AMD64)]') 'os=Windows-10-10.0.19041-SP0' 'numpy=1.21.0' 'asammdf=6.4.0'

Code

MDF version

No file necessary

Code snippet

from asammdf import MDF

Traceback

No Traceback

Description

In my project I use asammdf to read a mf4-File and pyqtgraph to create a scatter plot.

From Version 6.4.0 on you implemented a monkey patch:

https://github.com/danielhrisca/asammdf/blob/1507f100bddc86c5f037db2770ec39e42bdfc306/asammdf/gui/widgets/plot.py#L79

This monkey patch breaks my own scatter plot (the scatter Symbols) created with pyqtgraph.

This try-block https://github.com/danielhrisca/asammdf/blob/1507f100bddc86c5f037db2770ec39e42bdfc306/asammdf/gui/plot.py#L6-L13 would prevent the monkey patch from becoming active if the GUI-Option is not installed, but because I installed pyqtgraph separately it becomes active anyway.

What do you think? Would it be possible to enable the monkey patch only if asammdf[GUI] was actually installed, and not asammdf and pyqtgraph separately?

I could of course undo the monkey patch with my own monkey patch, but that's honestly a bit too much monkey patch for me.

Thank you.

danielhrisca commented 2 years ago

Hello @mw25 please try the development branch code

danielhrisca commented 2 years ago

BTW can you give some details about what plotting your applications does?

mw25 commented 2 years ago

It works like a charm. Thank you for the quick response.

Above I mentioned only a minimal example. In fact I use Orange3 (https://github.com/biolab/orange3) where a Scatter Plot widget is available. In this widget you have the possibility to change the color, shape and size of the scatter symbols based on other attributes. This feature did not work (I don't know right now if all three settings stopped working, or just the color).

image