Commits

Georg Brandl committed e0e57ad

browse window: improve display of scans; nicos data: include remark in title

Comments (0)

Files changed (2)

ufit/data/nicos.py

         dtline[len('### NICOS data file, created at '):].strip(),
         '%Y-%m-%d %H:%M:%S'))
     meta['created'] = ctime
+    remark = ''
     for line in iter(fp.readline, ''):
         if line.startswith('### Scan data'):
             break
                 meta['experiment'] = oval.lower()
             elif key.endswith('_samplename'):
                 meta['title'] = oval
+            elif key.endswith('_remark'):
+                remark = oval
             elif key == 'number':
                 meta['filenumber'] = int(oval)
             # 'info' key already has the right name
             meta[key] = val
+    if remark and 'title' in meta:
+        meta['title'] += ', ' + remark
     meta['filedesc'] = '%s:%s:%s' % (meta.get('instrument', ''),
                                      meta.get('experiment', ''),
                                      meta.get('filenumber'))
     colunits = [unit for unit in colunits if unit != ';']
     usecols = cvdict.keys()
     coldata = loadtxt(fp, converters=cvdict, usecols=usecols, ndmin=2)
+    if not coldata.size:
+        raise UFitError('empty data file')
     cols = dict((name, coldata[:,i]) for (i, name) in enumerate(colnames))
     meta['environment'] = []
     for col in cols:
         meta['environment'].append('T = %.3f K' % meta['sT'])
     if 'B' in cols:
         meta['environment'].append('B = %.3f K' % meta['B'])
-    if colnames[3] == 'E':
+    if len(colnames) >= 4 and colnames[3] == 'E':
         meta['hkle'] = coldata[:,:4]
     return colnames, coldata, meta

ufit/gui/browse.py

                 self.loader.template = t
                 res = self.loader.load(n, 'auto', 'auto', 'auto', 'auto', -1)
             except Exception, e:
-                print e
+                print 'Could not load', fn, 'because:', e
             else:
                 self._data[n] = res
-                QListWidgetItem('%s (%s) - %s' % (n, res.xcol,
-                                                  res.meta.get('title', '?')),
+                QListWidgetItem('%s (%s) - %s - %s' %
+                                (n, res.xcol, res.meta.get('title', '?'),
+                                 ', '.join(res.meta.get('environment', '?'))),
                                 self.dataList, n)
 
     def on_dataList_itemSelectionChanged(self):