Skip to content
Snippets Groups Projects
Commit 2a3d9a5f authored by Francois POLACK's avatar Francois POLACK
Browse files

refact: change ugly key search in datx dict

parent b3990e81
No related branches found
No related tags found
No related merge requests found
......@@ -84,7 +84,7 @@ class DatxFile(object):
h5file=h5.File(self.filepath, 'r')
if h5file['Attributes'].attrs.__contains__('File Layout Version'):
if 'File Layout Version' in h5file['Attributes'].attrs :
self.fileversion=h5file['Attributes'].attrs['File Layout Version'][0]
else:
self.fileversion=0
......@@ -134,7 +134,8 @@ class DatxFile(object):
# converters are not formatted the same by MX and MetroPro
# dsSurf=h5file[self.metatree['Measurement']['Surface']['Path'].value]
# return [dsSurf.attrs['X Converter'][0][2][1], dsSurf.attrs['Y Converter'][0][2][1] ]
if self.attributes.__contains__('Data Context.Lateral Resolution:Value'):
if 'Data Context.Lateral Resolution:Value' in self.attributes:
return self.attributes['Data Context.Lateral Resolution:Value'][0]
else:
raise OSError("DATX format Error: cannot find lateral resolution info")
......@@ -152,7 +153,8 @@ class DatxFile(object):
softlist=('Mx','MetroPro', 'MetroBASIC', 'd2bug')
print("Content of file", self.filepath)
self.metatree.dump(1)
if self.attributes.__contains__('Data Context.Data Attributes.Software Info Name'):
if 'Data Context.Data Attributes.Software Info Name' in self.attributes:
print("Acquisition software", self.attributes['Data Context.Data Attributes.Software Info Name'][0], "version",
self.attributes['Data Context.Data Attributes.Software Info Version'][0] )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment