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
982a1e6f
Unverified
Commit
982a1e6f
authored
6 years ago
by
Mathieu Doucet
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
MR: correct dQ
parent
0a325d59
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/PythonInterface/plugins/algorithms/MagnetismReflectometryReduction.py
+25
-11
25 additions, 11 deletions
...ace/plugins/algorithms/MagnetismReflectometryReduction.py
with
25 additions
and
11 deletions
Framework/PythonInterface/plugins/algorithms/MagnetismReflectometryReduction.py
+
25
−
11
View file @
982a1e6f
...
...
@@ -477,29 +477,43 @@ class MagnetismReflectometryReduction(PythonAlgorithm):
"""
sample_length
=
self
.
getProperty
(
"
SampleLength
"
).
value
#TODO: Read the slit distances relative to the sample from the logs once
# they are available with the new DAS.
slits
=
[[
ws
.
getRun
().
getProperty
(
"
S1HWidth
"
).
getStatistics
().
mean
,
2600.
],
[
ws
.
getRun
().
getProperty
(
"
S2HWidth
"
).
getStatistics
().
mean
,
2019.
],
[
ws
.
getRun
().
getProperty
(
"
S3HWidth
"
).
getStatistics
().
mean
,
714.
]]
theta
=
ws
.
getRun
().
getProperty
(
"
two_theta
"
).
value
/
2.0
# In newer data files, the slit distances are part of the logs
if
ws
.
getRun
().
hasProperty
(
"
S1Distance
"
):
s1_dist
=
ws
.
getRun
().
getProperty
(
"
S1Distance
"
).
value
s2_dist
=
ws
.
getRun
().
getProperty
(
"
S2Distance
"
).
value
s3_dist
=
ws
.
getRun
().
getProperty
(
"
S3Distance
"
).
value
else
:
logging
.
info
(
"
Slit distances were not found in the logs: using defaults
"
)
s1_dist
=
-
2600.
s2_dist
=
-
2019.
s3_dist
=
-
714.
slits
=
[[
ws
.
getRun
().
getProperty
(
"
S1HWidth
"
).
getStatistics
().
mean
,
s1_dist
],
[
ws
.
getRun
().
getProperty
(
"
S2HWidth
"
).
getStatistics
().
mean
,
s2_dist
],
[
ws
.
getRun
().
getProperty
(
"
S3HWidth
"
).
getStatistics
().
mean
,
s3_dist
]]
theta
=
ws
.
getRun
().
getProperty
(
"
two_theta
"
).
value
/
2.0
*
np
.
pi
/
180.0
res
=
[]
s_width
=
sample_length
*
math
.
sin
(
theta
)
s_width
=
sample_length
*
np
.
sin
(
theta
)
for
width
,
dist
in
slits
:
# Calculate the maximum opening angle dTheta
if
s_width
>
0.
:
d_theta
=
math
.
a
tan
((
s_width
/
2.
*
(
1.
+
width
/
s_width
))
/
dist
)
*
2.
d_theta
=
np
.
arc
tan
((
s_width
/
2.
*
(
1.
+
width
/
s_width
))
/
dist
)
*
2.
else
:
d_theta
=
math
.
a
tan
(
width
/
2.
/
dist
)
*
2.
d_theta
=
np
.
arc
tan
(
width
/
2.
/
dist
)
*
2.
# The standard deviation for a uniform angle distribution is delta/sqrt(12)
res
.
append
(
d_theta
*
0.28867513
)
dq_over_q
=
min
(
res
)
/
math
.
tan
(
theta
)
# Wavelength uncertainty
lambda_min
=
ws
.
getRun
().
getProperty
(
"
lambda_min
"
).
value
lambda_max
=
ws
.
getRun
().
getProperty
(
"
lambda_max
"
).
value
dq_over_q
=
min
(
res
)
/
np
.
tan
(
theta
)
data_x
=
ws
.
dataX
(
0
)
data_dx
=
ws
.
dataDx
(
0
)
dwl
=
(
lambda_max
-
lambda_min
)
/
len
(
data_x
)
/
np
.
sqrt
(
12.0
)
for
i
in
range
(
len
(
data_x
)):
data_dx
[
i
]
=
data_x
[
i
]
*
dq_over_q
dq_theta
=
data_x
[
i
]
*
dq_over_q
dq_wl
=
data_x
[
i
]
**
2
*
dwl
/
(
4.0
*
np
.
pi
*
np
.
sin
(
theta
))
data_dx
[
i
]
=
np
.
sqrt
(
dq_theta
**
2
+
dq_wl
**
2
)
return
ws
...
...
This diff is collapsed.
Click to expand it.
WHITFIELDRE email
@rwp
mentioned in commit
b5d13a70
·
6 years ago
mentioned in commit
b5d13a70
mentioned in commit b5d13a704c7348d50747a5c4ac8bbc0206377bcb
Toggle commit list
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