ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 74 forks source link

multiple mdfreader versions on same python installation #91

Closed danielhrisca closed 6 years ago

danielhrisca commented 7 years ago

Hello Aymeric,

currently it is impossible to have multiple mdfreader version on the same python installation since you append to sys,path

I was able to get this to work by removing all sys.path appends and using relative imports; for example in init.py

__author__ = 'Aymeric Rateau (aymeric.rateau@gmail.com)'
__copyright__ = 'Copyright (c) 2015 Aymeric Rateau'
__license__ = 'GPLV3'
__version__ = "0.2.6"

from .mdfreader import mdf, mdfinfo
from .mdf import mdf_skeleton
from .mdf3reader import mdf3
from .mdf4reader import mdf4
from .mdfinfo3 import info3
from .mdfinfo4 import info4, ATBlock  # ,MDFBlock

Anyway, it looks like a little competition can lead to improvements:

Benchmark environment

Files used for benchmark:

Open file Time [ms] RAM [MB]
mdfreader 0.2.5 mdfv3 4010 534
mdfreader 0.2.6 mdfv3 3659 532
mdfreader 0.2.5 mdfv4 45017 745
mdfreader 0.2.6 mdfv4 9589 746
Save file Time [ms] RAM [MB]
mdfreader 0.2.5 mdfv3 28196 1994
mdfreader 0.2.6 mdfv3 7453 564
mdfreader 0.2.5 mdfv4 25488 2792
mdfreader 0.2.6 mdfv4 6736 768
Get all channels (36424 calls) Time [ms] RAM [MB]
mdfreader 0.2.5 mdfv3 45 534
mdfreader 0.2.6 mdfv3 93 533
mdfreader 0.2.5 mdfv4 60 746
mdfreader 0.2.6 mdfv4 100 747
ratal commented 6 years ago

Hi Daniel, I was using originally using relative imports but I implemented absolute path import to support issue #41 . Seems more robust for various platforms and configurations but yes can probably cause issue if you want to have several versions compared. Maybe using python environments should be more handy ?

danielhrisca commented 6 years ago

If you use it as a package then there are no problems with relative imports.

If you run a module from the package then you might have errors with relative imports.

danielhrisca commented 6 years ago

Is there any case in which a mdfreader module is executed?

ratal commented 6 years ago

yes if you mean: python filename.mf4 --export HDF5

danielhrisca commented 6 years ago

The system.path is getting cluttered with all the appends down in various mdfreader modules.

But if no one else is complaining the this can be closed.