mdf module documentation¶
mdf_skeleton module describing basic mdf structure and methods
Created on Thu Sept 24 2015
Dependencies¶
- Python >2.6, >3.2 <http://www.python.org>
- Numpy >1.6 <http://numpy.scipy.org>
mdf module¶
-
class
mdf.
mdf_skeleton
(fileName=None, channelList=None, convertAfterRead=True, filterChannelNames=False)¶ Bases:
dict
mdf_skeleton class
Attributes
fileName (str) file name MDFVersionNumber (int) mdf file version number masterChannelList (dict) Represents data structure: a key per master channel with corresponding value containing a list of channels One key or master channel represents then a data group having same sampling interval. multiProc (bool) Flag to request channel conversion multi processed for performance improvement. One thread per data group. convertAfterRead (bool) flag to convert raw data to physical just after read filterChannelNames (bool) flag to filter long channel names from its module names separated by ‘.’ file_metadata (dict) file metadata with minimum keys : author, organisation, project, subject, comment, time, date Methods
add_channel(channel_name, data, master_channel, master_type=1, unit=’‘, description=’‘, conversion=None) adds channel to mdf dict remove_channel(channel_name) removes channel from mdf dict and returns its content copy() copy a mdf class add_metadata(author, organisation, project, subject, comment, date, time) adds basic metadata from file -
add_channel
(dataGroup, channel_name, data, master_channel, master_type=1, unit='', description='', conversion=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
-
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
-
copy
()¶ copy a mdf class
-
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
-
getChannelUnit
(channelName)¶ Returns channel unit string Implemented for a future integration of pint
Parameters: channelName : str
channel name
Returns: str
unit string description
-
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
-
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)¶ Modifies data of channel
Parameters: channelName : str
channel name
data : numpy array
channel data
-
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
-