MDF

This class acts as a proxy for the MDF3 and MDF4 classes. All attribute access is delegated to the underling file attribute (MDF3 or MDF4 object). See MDF3 and MDF4 for available extra methods.

class asammdf.mdf.MDF(name=None, load_measured_data=True, compression=False, version='3.20')

Unified access to MDF v3 and v4 files.

Parameters:

name : string

mdf file name

load_measured_data : bool

load data option; default True

  • if True the data group binary data block will be loaded in RAM
  • if False the channel data is read from disk on request

compression : bool

compression option for data group binary data block; default False

version : string

mdf file version (‘3.00’, ‘3.10’, ‘3.20’, ‘3.30’, ‘4.00’, ‘4.10’, ‘4.11’); default ‘3.20’

Methods

convert
convert(to, compression=False)

convert MDF to other versions

Parameters:

to : str

new mdf version from (‘3.00’, ‘3.10’, ‘3.20’, ‘3.30’, ‘4.00’, ‘4.10’, ‘4.11’)

compression : bool

enable raw channel data compression for out MDF; default False

Returns:

out : MDF

new MDF object

MDF3 and MDF4 classes

Notes about compression and load_measured_data arguments

By default MDF object use no compression and the raw channel data is loaded into RAM. This will give you the best performance from asammdf.

However if you reach the physical memmory limit asammdf gives you two options

  1. use the compression flag: raw channel data is loaded into RAM but it is compressed. The default compression library is blosc and as a fallback zlib is used (slower). The advange is that you save RAM, but in return you will pay the compression/decompression time penalty in all operations (file open, getting channel data, saving to disk, converting).
  2. use the load_measured_data flag: raw channel data is not read.

MDF defaults

Advantages

  • best performance

Disadvantages

  • highest RAM usage

Use case

  • when data fits inside the system RAM

MDF with compression

Advantages

  • lower RAM usage than default
  • alows saving to disk and appending new data

Disadvantages

  • slowest

Use case

  • when default data exceeds RAM and you need to append and save

MDF with load_measured_data

Advantages

  • lowest RAM usage
  • faster than compression

Disadvantages

  • ReadOnly mode: appending and saving is not possible

Use case

  • when default data exceeds RAM and you only want to extract information from the file

Note

See benchmarks for the effects of using the flags.