Skip to content
Snippets Groups Projects
Commit 00bcc0e6 authored by Daniel Pajerowski's avatar Daniel Pajerowski
Browse files

added a LoadNexusUB function

parent bf8fea3e
No related branches found
No related tags found
No related merge requests found
......@@ -3,13 +3,13 @@ from __future__ import (absolute_import, division, print_function)
import numpy as np
from mantid.simpleapi import *
def LoadNexusUB(fname):
raw=LoadEventNexus(Filename=fname)
run = raw.getRun()
run_keys = run.keys()
for test_key in run_keys:
if test_key[-8:] == 'UBMatrix':
UBMatrix_key = test_key
UB=np.array( eval(raw.run()[UBMatrix_key].value[0].strip(')').split('(')[1]))
return UB
def LoadNexusUB(fname):
raw=LoadEventNexus(Filename=fname)
run = raw.getRun()
run_keys = run.keys()
for test_key in run_keys:
if test_key[-8:] == 'UBMatrix':
UBMatrix_key = test_key
UB=np.array( eval(raw.run()[UBMatrix_key].value[0].strip(')').split('(')[1]))
return UB
......@@ -115,11 +115,12 @@ class MatrixUBInputWidget(QtGui.QWidget):
except:
mantid.logger.error("Could not open the file, or not a valid UB matrix")
def loadNexusUBDialog(self):
# pylint: disable=bare-except
try:
fname = QtGui.QFileDialog.getOpenFileName(self, 'Open Nexus file to extract UB matrix',filter=QString('Nexus file (*.nxs.h5);;All Files (*)'))
fname = QtGui.QFileDialog.getOpenFileName(\
self, 'Open Nexus file to extract UB matrix',\
filter=QString('Nexus file (*.nxs.h5);;All Files (*)'))
this_here_UB = LoadNexusUB(str(fname))
UB00 = self.UBmodel.createIndex(0,0)
UB01 = self.UBmodel.createIndex(0,1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment