Skip to content

Commit

Permalink
mdf4reader: simplified output of unit and description to the minimum,…
Browse files Browse the repository at this point in the history
… no more dict with xml to be more compatible with mdf3 structure and relying mdfreader methods
  • Loading branch information
aymeric.rateau@gmail.com committed Feb 3, 2015
1 parent becff26 commit 668e23e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mdf4reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,13 +980,19 @@ def read4( self, fileName=None, info = None, multiProc = False, channelList=None
# sync_types : 0 data, 1 time (sec), 2 angle (radians), 4 index
self[channelName]['masterType'] = info['CNBlock'][dataGroup][channelGroup][channel]['cn_sync_type']
if 'unit' in list(info['CCBlock'][dataGroup][channelGroup][channel].keys()):
self[channelName]['unit'] = info['CCBlock'][dataGroup][channelGroup][channel]['unit']
unit = info['CCBlock'][dataGroup][channelGroup][channel]['unit']
elif 'unit' in list(info['CNBlock'][dataGroup][channelGroup][channel].keys()):
self[channelName]['unit'] = info['CNBlock'][dataGroup][channelGroup][channel]['unit']
unit = info['CNBlock'][dataGroup][channelGroup][channel]['unit']
else:
self[channelName]['unit'] = ''
unit = ''
if 'Comment' in unit:
unit = unit['Comment']
self[channelName]['unit'] = unit
if 'Comment' in list(info['CNBlock'][dataGroup][channelGroup][channel].keys()):
self[channelName]['description'] = info['CNBlock'][dataGroup][channelGroup][channel]['Comment']
desc = info['CNBlock'][dataGroup][channelGroup][channel]['Comment']
if 'description' in desc:
desc=desc['description']
self[channelName]['description'] = desc
else:
self[channelName]['description'] = ''
self[channelName]['data'] = L[channelName]
Expand Down
1 change: 1 addition & 0 deletions mdfinfo4.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def __init__(self, fid, pointer, MDType=None):
self['xml']=elementTreeToDict(self['xml_tree'])
# specific action per comment block type, extracts specific tags from xml
if MDType=='CN': # channel comment
self['description']=self.extractXmlField(self['xml_tree'], 'TX')
self['names']=self.extractXmlField(self['xml_tree'], 'names')
self['linker_name']=self.extractXmlField(self['xml_tree'], 'linker_name')
self['linker_address']=self.extractXmlField(self['xml_tree'], 'linker_address')
Expand Down

0 comments on commit 668e23e

Please sign in to comment.