mdf module documentation — mdfreader 2.8 documentation

# mdf module documentation

mdf_skeleton module describing basic mdf structure and methods

Created on Thu Sept 24 2015

## Platform and python version

With Unix and Windows for python 2.6+ and 3.2+

Author: | Aymeric Rateau

## Dependencies

- Python >2.6, >3.2 <http://www.python.org>
- Numpy >1.6 <http://numpy.scipy.org>

## mdf module

class `mdfreader.mdf.` `compressed_data`

  Bases: `object`

  Methods

  `compression`(a) | data compression method
  `decompression`() | data decompression

  `compression`(a)

    data compression method

    Parameters: | a : numpy array data to be compresses

  `data`
  `decompression`()

    data decompression

  `dtype`

class `mdfreader.mdf.` `mdf_skeleton`() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

  Bases: `dict`

  Methods

  `add_channel`(dataGroup, channel_name, data, …) | adds channel to mdf dict.
  `add_metadata`([author, organisation, …]) | adds basic metadata to mdf class
  `clear`() |
  `copy`() | copy a mdf class
  `fromkeys`($type, iterable[, value]) | Returns a new dict with keys from iterable and values equal to value.
  `get`(k[,d]) |
  `getChannel`(channelName) | Extract channel dict from mdf structure
  `getChannelConversion`(channelName) | Extract channel conversion dict from mdf structure
  `getChannelDesc`(channelName) | Extract channel description information from mdf structure
  `getChannelMaster`(channelName) | Extract channel master name from mdf structure
  `getChannelMasterType`(channelName) | Extract channel master type information from mdf structure
  `getChannelUnit`(channelName) | Returns channel unit string Implemented for a future integration of pint
  `getInvalidBit`(channelName) |
  `getInvalidChannel`(channelName) |
  `items`() |
  `keys`() |
  `pop`(k[,d]) | If key is not found, d is returned if given, otherwise KeyError is raised
  `popitem`() | 2-tuple; but raise KeyError if D is empty.
  `remove_channel`(channel_name) | removes channel from mdf dict.
  `remove_channel_conversion`(channelName) | removes conversion key from mdf channel dict.
  `rename_channel`(channelName, newname) | Modifies name of channel
  `setChannelAttachment`(channelName, attachment) | Modifies channel attachment
  `setChannelConversion`(channelName, conversion) | Modifies conversion dict of channel
  `setChannelData`(channelName, data[, compression]) | Modifies data of channel
  `setChannelDesc`(channelName, desc) | Modifies description of channel
  `setChannelMaster`(channelName, master) | Modifies channel master name
  `setChannelMasterType`(channelName, masterType) | Modifies master channel type
  `setChannelUnit`(channelName, unit) | Modifies unit of channel
  `setInvalidBit`(channelName, bit_position) |
  `setInvalidChannel`(channelName, invalid_channel) |
  `setdefault`(k[,d]) |
  `update`([E, ]**F) | If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
  `values`() |

  `MDFVersionNumber`
  `add_channel`(dataGroup, channel_name, data, master_channel, master_type=1, unit='', description='', conversion=None, info=None, compression=False, id=None)

    adds channel to mdf dict.

    Parameters: | dataGroup : int dataGroup number. Is appended to master name for non unique channel names channel_name : str channel name data : numpy array numpy array of channel’s data master_channel : str master channel name master_type : int, optional master channel type : 0=None, 1=Time, 2=Angle, 3=Distance, 4=index unit : str, optional unit description description : str, optional channel description conversion : info class, optional conversion description from info class info : info class for CNBlock, optional used for CABlock axis creation and channel conversion compression : bool flag to ask for channel data compression id : tuple tuple of int and str following below structure: (data group number, channel group number, channel number), (channel name, channel source, channel path), (group name, group source, group path)

  `add_metadata`(author='', organisation='', project='', subject='', comment='', date='', time='')

    adds basic metadata to mdf class

    Parameters: | author : str author of file organisation : str organisation of author project : str subject : str comment : str date : str time : str

  `convertAfterRead`
  `convert_tables`
  `copy`()

    copy a mdf class

  `fid`
  `fileName`
  `file_metadata`
  `filterChannelNames`
  `getChannel`(channelName)

    Extract channel dict from mdf structure

    Parameters: | channelName : str channel name
    Returns: | channel dictionnary containing data, description, unit, etc.

  `getChannelConversion`(channelName)

    Extract channel conversion dict from mdf structure

    Parameters: | channelName : str channel name
    Returns: | channel conversion dict

  `getChannelDesc`(channelName)

    Extract channel description information from mdf structure

    Parameters: | channelName : str channel name
    Returns: | channel description string

  `getChannelMaster`(channelName)

    Extract channel master name from mdf structure

    Parameters: | channelName : str channel name
    Returns: | channel master name string

  `getChannelMasterType`(channelName)

    Extract channel master type information from mdf structure

    Parameters: | channelName : str channel name
    Returns: | channel mater type integer : 0=None, 1=Time, 2=Angle, 3=Distance, 4=index

  `getChannelUnit`(channelName)

    Returns channel unit string Implemented for a future integration of pint

    Parameters: | channelName : str channel name
    Returns: | str unit string description

  `getInvalidBit`(channelName)
  `getInvalidChannel`(channelName)
  `info`
  `masterChannelList`
  `multiProc`
  `remove_channel`(channel_name)

    removes channel from mdf dict.

    Parameters: | channel_name : str channel name
    Returns: | value of mdf dict key=channel_name

  `remove_channel_conversion`(channelName)

    removes conversion key from mdf channel dict.

    Parameters: | channelName : str channel name
    Returns: | removed value from dict

  `rename_channel`(channelName, newname)

    Modifies name of channel

    Parameters: | channelName : str channel name newname : str new channel name

  `setChannelAttachment`(channelName, attachment)

    Modifies channel attachment

    Parameters: | channelName : str channel name attachment channel attachment

  `setChannelConversion`(channelName, conversion)

    Modifies conversion dict of channel

    Parameters: | channelName : str channel name conversion : dict conversion dictionnary

  `setChannelData`(channelName, data, compression=False)

    Modifies data of channel

    Parameters: | channelName : str channel name data : numpy array channel data compression : bool or str trigger for data compression

  `setChannelDesc`(channelName, desc)

    Modifies description of channel

    Parameters: | channelName : str channel name desc : str channel description

  `setChannelMaster`(channelName, master)

    Modifies channel master name

    Parameters: | channelName : str channel name master : str master channel name

  `setChannelMasterType`(channelName, masterType)

    Modifies master channel type

    Parameters: | channelName : str channel name masterType : int master channel type

  `setChannelUnit`(channelName, unit)

    Modifies unit of channel

    Parameters: | channelName : str channel name unit : str channel unit

  `setInvalidBit`(channelName, bit_position)
  `setInvalidChannel`(channelName, invalid_channel)
  `zipfile`