Changeset 5359


Ignore:
Timestamp:
Oct 28, 2022 11:35:54 AM (5 months ago)
Author:
vondreele
Message:

fix Bruker brml reader for only one data area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/imports/G2pwd_BrukerRAW.py

    r5358 r5359  
    258258        'Read a Bruker brml file'
    259259        print(filename)
    260         nSteps = int(self.data['RawData']['DataRoutes']['DataRoute'][1]['ScanInformation']['MeasurementPoints'])
     260        datano = 1
     261        try:
     262            nSteps = int(self.data['RawData']['DataRoutes']['DataRoute'][datano]['ScanInformation']['MeasurementPoints'])
     263        except KeyError:
     264            datano = 0
     265            nSteps = int(self.data['RawData']['DataRoutes']['DataRoute']['ScanInformation']['MeasurementPoints'])
    261266       
    262267        x = np.zeros(nSteps, dtype=float)
     
    264269        w = np.zeros(nSteps, dtype=float)
    265270       
    266         effTime = float(self.data['RawData']['DataRoutes']['DataRoute'][1]['ScanInformation']['TimePerStepEffective'])
     271        if datano:
     272            effTime = float(self.data['RawData']['DataRoutes']['DataRoute'][datano]['ScanInformation']['TimePerStepEffective'])
     273        else:
     274            effTime = float(self.data['RawData']['DataRoutes']['DataRoute']['ScanInformation']['TimePerStepEffective'])
    267275       
    268276        # Extract 2-theta angle and counts from the XML document
    269277        i=0
    270278        while i < nSteps :
    271             entry = self.data['RawData']['DataRoutes']['DataRoute'][1]['Datum'][i].split(',')
     279            if datano:
     280                entry = self.data['RawData']['DataRoutes']['DataRoute'][datano]['Datum'][i].split(',')
     281            else:
     282                entry = self.data['RawData']['DataRoutes']['DataRoute']['Datum'][i].split(',')
    272283            x[i] = float(entry[2])
    273284            y[i] = float(entry[4])*float(entry[0])/effTime
Note: See TracChangeset for help on using the changeset viewer.