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
3478969d
Commit
3478969d
authored
6 years ago
by
Brandon Hewer
Browse files
Options
Downloads
Patches
Plain Diff
Remove invalid file from branch
Refs #21508
parent
618aa602
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/test/python/plugins/algorithms/WorkflowAlgorithms/test.py
+0
-24
0 additions, 24 deletions
...test/python/plugins/algorithms/WorkflowAlgorithms/test.py
with
0 additions
and
24 deletions
Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/test.py
deleted
100644 → 0
+
0
−
24
View file @
618aa602
import
numpy
as
np
def
_normalize_by_index
(
workspace
,
index
):
"""
Normalize each spectra of the specified workspace by the y-value at the
specified index in that spectra, while accounting for errors on those values.
@param workspace The workspace to normalize.
@param index The index of the y-value to normalize by.
"""
y_vals
=
workspace
.
extractY
()
y_vals_e
=
workspace
.
extractE
()
scale
=
y_vals
[:,
index
]
scale_e
=
y_vals_e
[:,
index
]
np
.
reciprocal
(
scale
,
out
=
scale
)
np
.
einsum
(
'
ij,i->ij
'
,
y_vals
,
scale
,
out
=
y_vals
)
# error propagation: C = A / B ; dC = sqrt( (dA/B)^2 + (A*dB/B^2)^2 ) ||
# !! wrong for A=B (index by which is scaled = index) !!
a
=
np
.
einsum
(
'
ij,i->ij
'
,
y_vals_e
,
scale
)
b
=
np
.
einsum
(
'
ij,i->ij
'
,
y_vals
,
scale_e
*
scale
)
np
.
sqrt
(
a
**
2
+
b
**
2
,
out
=
y_vals_e
)
y_vals_e
[
index
]
=
a
[
index
]
workspace
.
setY
(
y_vals
)
workspace
.
setE
(
y_vals_e
)
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