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, 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

version : string

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

Methods

convert
filter
iter_to_pandas
convert(to)

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’)

Returns:

out : MDF

new MDF object

filter(channels)

return new MDF object that contains only the channels listed in channels argument

Parameters:

channels : list

list of channel names to be filtered

Returns:

mdf : MDF

new MDF file

iter_to_pandas()

generator that yields channel groups as pandas DataFrames

MDF3 and MDF4 classes

Notes about load_measured_data argument

By default when the MDF object is created 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 the option use the load_measured_data flag. In this case the raw channel data is not read.

MDF defaults

Advantages

  • best performance

Disadvantages

  • higher RAM usage, there is the chance the file will exceed available RAM

Use case

  • when data fits inside the system RAM

MDF with load_measured_data

Advantages

  • lowest RAM usage
  • faster than compression

Disadvantages

  • slow performance for getting channel data

Use case

  • when default data exceeds available RAM

Note

See benchmarks for the effects of using the flag