Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
00bcc0e6
Commit
00bcc0e6
authored
6 years ago
by
Daniel Pajerowski
Browse files
Options
Downloads
Patches
Plain Diff
added a LoadNexusUB function
parent
bf8fea3e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/DGSPlanner/LoadNexusUB.py
+9
-9
9 additions, 9 deletions
scripts/DGSPlanner/LoadNexusUB.py
scripts/DGSPlanner/MatrixUBInputWidget.py
+3
-2
3 additions, 2 deletions
scripts/DGSPlanner/MatrixUBInputWidget.py
with
12 additions
and
11 deletions
scripts/DGSPlanner/LoadNexusUB.py
+
9
−
9
View file @
00bcc0e6
...
...
@@ -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
This diff is collapsed.
Click to expand it.
scripts/DGSPlanner/MatrixUBInputWidget.py
+
3
−
2
View file @
00bcc0e6
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment