10.2.2. Reading data
[]$_ Example ALBULA
### read the compressed (or uncompressed) container through the master file ###
h5cont = albula.DImageSeries("series_16_master.h5")
### loop over the frames and read out optional data ###
for i in range(h5cont.first(), h5cont.last() + 1):
img = h5cont[i]
### read header items using convenience functions ###
optData = img.optionalData()
## e.g. wavelength ##
wavelength = optData.wavelength()
## threshold energy ##
threshold_energy = optData.threshold_energy()
### Read the header item directly without convenience functions ###
neXusHeader = h5cont.neXus()
### print all header item names with path ###
neXusRoot = neXusHeader.root()
def iterateChildren(parent):
if not hasattr(parent, 'children'):
return set([parent.path()])
else:
paths = set()
for child in parent.children():
paths.update(iterateChildren(child))
return paths
for kid in iterateChildren(neXusRoot):
print kid.neXusPath()
## extract wavelength ##
wavelength = neXusRoot.childElement('/entry/instrument/monochromator/wavelength')
## print value ##
print "wavelength value: ",wavelength.value()
## extract threshold ##
threshold_energy = neXusRoot.childElement('/entry/instrument/detector/threshold_energy')
## print value ##
print "threshold_energy value: ",threshold_energy.value()
DECTRIS EIGER
®
2 User Manual v1.8.2 31 | 36