Package: asammdf
asammdfis a fast parser and editor for ASAM (Association for Standardization of Automation and Measuring Systems) MDF (Measurement Data Format) files.asammdfsupports MDF versions 2 (.dat), 3 (.mdf) and 4 (.mf4).asammdfworks on Python >= 3.8StatusContinuous IntegrationCoverallsCodacyReadTheDocsPyPIconda-forgeProject goalsThe main goals for this library are:to be faster than the other Python based mdf librariesto have clean and easy to understand code baseto have minimal 3-rd party dependenciesFeaturescreate new mdf files from scratchappend new channelsread unsorted MDF v3 and v4 filesread CAN and LIN bus logging filesextract CAN and LIN signals from anonymous bus logging measurementsfilter a subset of channels from original mdf filecut measurement to specified time intervalconvert to different mdf versionexport to HDF5, Matlab (v7.3), CSV and parquetmerge multiple files sharing the same internal structureread and save mdf version 4.10 files containing zipped data blocksspace optimizations for saved files (no duplicated blocks)split large data blocks (configurable size) for mdf version 4full support (read, append, save) for the following map types (multidimensional array channels):mdf version 3 channels with CDBLOCKmdf version 4 structure channel compositionmdf version 4 channel arrays with CNTemplate storage and one of the array types:0 - array1 - scaling axis2 - look-upadd and extract attachments for mdf version 4handle large files (for example merging two fileas, each with 14000 channels and 5GB size, on a RaspberryPi)extract channel data, master channel and extra channel information asSignalobjects for unified operations with v3 and v4 filestime domain operation using theSignalclassPandas data frames are good if all the channels have the same time baseda measurement will usually have channels from different sources at different ratestheSignalclass facilitates operations with such channelsgraphical interface to visualize channels and perform operations with the filesMajor features not implemented (yet)for version 3functionality related to sample reduction block: the samples reduction blocks are simply ignoredfor version 4experimental support for MDF v4.20 column oriented storagefunctionality related to sample reduction block: the samples reduction blocks are simply ignoredhandling of channel hierarchy: channel hierarchy is ignoredfull handling of bus logging measurements: currently only CAN and LIN bus logging are implemented with the
ability togetsignals defined in the attached CAN/LIN database (.arxml or .dbc). Signals can also
be extracted from an anonymous bus logging measurement by providing a CAN or LIN database (.dbc or .arxml)handling of unfinished measurements (mdf 4): finalization is attempted when the file is loaded, however the
not all the finalization steps are supportedfull support for remaining mdf 4 channel arrays typesxml schema for MDBLOCK: most metadata stored in the comment blocks will not be availablefull handling of event blocks: events are transferred to the new files (in case of calling methods
that return newMDFobjects) but no new events can be createdchannels with default X axis: the default X axis is ignored and the channel group's master channel
is usedattachment encryption/decryption using user provided encryption/decryption functions; this is not
part of the MDF v4 spec and is only supported by this libraryUsagefromasammdfimportMDFmdf=MDF('sample.mdf')speed=mdf.get('WheelSpeed')speed.plot()important_signals=['WheelSpeed','VehicleSpeed','VehicleAcceleration']# get short measurement with a subset of channels from 10s to 12sshort=mdf.filter(important_signals).cut(start=10,stop=12)# convert to version 4.10 and save to diskshort.convert('4.10').save('important signals.mf4')# plot some channels from a huge fileefficient=MDF('huge.mf4')forsignalinefficient.select(['Sensor1','Voltage3']):signal.plot()Check theexamplesfolder for extended usage demo, or the documentationhttp://asammdf.readthedocs.io/en/master/examples.htmlhttps://canlogger.csselectronics.com/canedge-getting-started/log-file-tools/asammdf-api/Documentationhttp://asammdf.readthedocs.io/en/masterAnd a nicely written tutorial on theCSS Electronics siteContributing & SupportPlease have a look over thecontributing guidelinesIf you enjoy this library please consider making a donation to thenumpy projector todanielhrisca using liberapay<a href="https://liberapay.com/danielhrisca/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>ContributorsThanks to all who contributed with commits toasammdf:Installationasammdfis available ongithub:https://github.com/danielhrisca/asammdf/PyPI:https://pypi.org/project/asammdf/conda-forge:https://anaconda.org/conda-forge/asammdfpipinstallasammdf# for the GUIpipinstallasammdf[gui]# or for anacondacondainstall-cconda-forgeasammdfIn case a wheel is not present for you OS/Python versions and you
lack the proper compiler setup to compile the c-extension code, then
you can simply copy-paste the package code to your site-packages. In this
way the python fallback code will be used instead of the compiled c-extension code.Dependenciesasammdf uses the following librariesnumpy : the heart that makes all ticknumexpr : for algebraic and rational channel conversionswheel : for installation in virtual environmentspandas : for DataFrame exportcanmatrix : to handle CAN/LIN bus logging measurementsnatsortlxml : for canmatrix arxml supportlz4 : to speed up the disk IO performancepython-dateutil : measurement start time handlingoptional dependencies needed for exportsh5py : for HDF5 exporthdf5storage : for Matlab v7.3 .mat exportfastparquet : for parquet exportscipy: for Matlab v4 and v5 .mat exportother optional dependenciesPySide6 : for GUI toolpyqtgraph : for GUI tool and Signal plottingmatplotlib : as fallback for Signal plottingfaust-cchardet : to detect non-standard Unicode encodingschardet : to detect non-standard Unicode encodingspyqtlet2 : for the GPS windowisal : for faster zlib compression/decompressionfsspec : access files stored in the cloudBenchmarkshttp://asammdf.readthedocs.io/en/master/benchmarks.html