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
d6f2c2cb
Commit
d6f2c2cb
authored
5 years ago
by
Harriet Brown
Browse files
Options
Downloads
Patches
Plain Diff
fix FitIncidentSpectrum not correcting for different binning sizes
parent
5a23acad
No related branches found
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/FitIncidentSpectrum.py
+6
-4
6 additions, 4 deletions
...PythonInterface/plugins/algorithms/FitIncidentSpectrum.py
with
6 additions
and
4 deletions
Framework/PythonInterface/plugins/algorithms/FitIncidentSpectrum.py
+
6
−
4
View file @
d6f2c2cb
...
@@ -89,16 +89,17 @@ class FitIncidentSpectrum(PythonAlgorithm):
...
@@ -89,16 +89,17 @@ class FitIncidentSpectrum(PythonAlgorithm):
y_fit
=
np
.
array
(
self
.
_input_ws
.
readY
(
self
.
_incident_index
))
y_fit
=
np
.
array
(
self
.
_input_ws
.
readY
(
self
.
_incident_index
))
else
:
else
:
rebinned
=
Rebin
(
rebinned
=
Rebin
(
self
.
_input_ws
,
InputWorkspace
=
self
.
_input_ws
,
Params
=
self
.
_binning_for_fit
,
Params
=
self
.
_binning_for_fit
,
PreserveEvents
=
True
,
PreserveEvents
=
True
)
StoreInADS
=
False
)
x_fit
=
np
.
array
(
rebinned
.
readX
(
self
.
_incident_index
))
x_fit
=
np
.
array
(
rebinned
.
readX
(
self
.
_incident_index
))
y_fit
=
np
.
array
(
rebinned
.
readY
(
self
.
_incident_index
))
y_fit
=
np
.
array
(
rebinned
.
readY
(
self
.
_incident_index
))
rebin_norm
=
x
.
size
/
x_fit
.
size
x_bin_centers
=
0.5
*
(
x
[:
-
1
]
+
x
[
1
:])
x_bin_centers
=
0.5
*
(
x
[:
-
1
]
+
x
[
1
:])
if
len
(
x_fit
)
!=
len
(
y_fit
):
if
len
(
x_fit
)
!=
len
(
y_fit
):
x_fit
=
0.5
*
(
x_fit
[:
-
1
]
+
x_fit
[
1
:])
x_fit
=
0.5
*
(
x_fit
[:
-
1
]
+
x_fit
[
1
:])
if
self
.
_fit_spectrum_with
==
'
CubicSpline
'
:
if
self
.
_fit_spectrum_with
==
'
CubicSpline
'
:
# Fit using cubic spline
# Fit using cubic spline
fit
,
fit_prime
=
self
.
fit_cubic_spline
(
x_fit
,
y_fit
,
x_bin_centers
,
s
=
1e7
)
fit
,
fit_prime
=
self
.
fit_cubic_spline
(
x_fit
,
y_fit
,
x_bin_centers
,
s
=
1e7
)
...
@@ -113,11 +114,12 @@ class FitIncidentSpectrum(PythonAlgorithm):
...
@@ -113,11 +114,12 @@ class FitIncidentSpectrum(PythonAlgorithm):
elif
self
.
_fit_spectrum_with
==
'
GaussConvCubicSpline
'
:
elif
self
.
_fit_spectrum_with
==
'
GaussConvCubicSpline
'
:
# Fit using Gauss conv cubic spline
# Fit using Gauss conv cubic spline
fit
,
fit_prime
=
self
.
fit_cubic_spline_with_gauss_conv
(
x_fit
,
y_fit
,
x_bin_centers
,
sigma
=
0.5
)
fit
,
fit_prime
=
self
.
fit_cubic_spline_with_gauss_conv
(
x_fit
,
y_fit
,
x_bin_centers
,
sigma
=
0.5
)
# Create output workspace
# Create output workspace
unit
=
self
.
_input_ws
.
getAxis
(
0
).
getUnit
().
unitID
()
unit
=
self
.
_input_ws
.
getAxis
(
0
).
getUnit
().
unitID
()
output_workspace
=
CreateWorkspace
(
output_workspace
=
CreateWorkspace
(
DataX
=
x
,
DataX
=
x
,
DataY
=
np
.
append
(
fit
,
fit_prime
),
DataY
=
np
.
append
(
fit
,
fit_prime
)
/
rebin_norm
,
UnitX
=
unit
,
UnitX
=
unit
,
NSpec
=
2
,
NSpec
=
2
,
Distribution
=
False
,
Distribution
=
False
,
...
...
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