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
51e583d3
Unverified
Commit
51e583d3
authored
6 years ago
by
Doucet, Mathieu
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix Flake8
parent
292fdc1b
Branches
mr_peak_fitting
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/PythonInterface/plugins/algorithms/MRInspectData.py
+8
-0
8 additions, 0 deletions
...ework/PythonInterface/plugins/algorithms/MRInspectData.py
with
8 additions
and
0 deletions
Framework/PythonInterface/plugins/algorithms/MRInspectData.py
+
8
−
0
View file @
51e583d3
...
...
@@ -13,6 +13,7 @@ DEAD_PIXELS = 10
NX_PIXELS
=
304
NY_PIXELS
=
256
class
MRInspectData
(
PythonAlgorithm
):
def
category
(
self
):
...
...
@@ -416,6 +417,7 @@ class DataInfo(object):
# Write to logs
self
.
log
()
def
fit_2d_peak
(
workspace
):
"""
Fit a 2D Gaussian peak
...
...
@@ -498,16 +500,19 @@ def fit_2d_peak(workspace):
return
[
x_min
,
x_max
],
[
y_min
,
y_max
]
def
coord_to_code
(
x
,
y
):
"""
Utility function to encode pixel coordinates so we can unravel our distribution in a 1D array
"""
return
1000
*
x
+
y
def
code_to_coord
(
c
):
"""
Utility function to decode encoded coordinates
"""
i_x
=
c
/
1000
i_y
=
c
%
1000
return
i_x
,
i_y
def
poly_bck
(
value
,
*
p
):
"""
Polynomial function for background fit
...
...
@@ -527,6 +532,7 @@ def poly_bck(value, *p):
values
[
coord
[
1
]
>=
NY_PIXELS
-
DEAD_PIXELS
]
=
0
return
values
def
poly_bck_signal
(
value
,
*
p
):
"""
Function for a polynomial + Gaussian signal
...
...
@@ -551,6 +557,7 @@ def poly_bck_signal(value, *p):
values
[
coord
[
1
]
>=
NY_PIXELS
-
DEAD_PIXELS
]
=
0
return
values
def
gauss_simple
(
value
,
*
p
):
"""
Gaussian function with threshold background
...
...
@@ -572,6 +579,7 @@ def gauss_simple(value, *p):
values
[
coord
[
1
]
>=
NY_PIXELS
-
DEAD_PIXELS
]
=
0
return
values
def
chi2
(
data
,
model
):
"""
Returns the chi^2 for a data set and model pair
"""
err
=
np
.
fabs
(
data
.
ravel
())
...
...
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