Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mlz
BornAgain
Commits
3af54351
Commit
3af54351
authored
Mar 16, 2021
by
Wuttke, Joachim
Browse files
Repaired fit55
parent
b59d542d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Examples/fit55_SpecularIntro/PolarizedSpinAsymmetryFit.py
View file @
3af54351
...
...
@@ -93,7 +93,7 @@ def get_simulation(q_axis, parameters, polarization, analyzer):
scan
.
setAbsoluteQResolution
(
distr
,
parameters
[
"q_res"
])
simulation
.
beam
().
setPolarization
(
polarization
)
simulation
.
setAnalyzerProperties
(
analyzer
,
1
,
0.5
)
simulation
.
detector
().
setAnalyzerProperties
(
analyzer
,
1
,
0.5
)
simulation
.
setScan
(
scan
)
return
simulation
...
...
Examples/fit55_SpecularIntro/RealLifeReflectometryFitting.py
View file @
3af54351
...
...
@@ -34,6 +34,7 @@ from matplotlib import pyplot as plt
import
numpy
as
np
from
os
import
path
import
bornagain
as
ba
import
ba_plot
from
scipy.optimize
import
differential_evolution
...
...
@@ -151,7 +152,7 @@ def chi_2(real_data, sim_data, weights):
Computes chi_2 metrics and returns its value
"""
sim_data_upsc
=
np
.
multiply
(
weights
,
sim_data
)
sim_data_upsc
[
sim_data_upsc
is
0
]
=
1e-30
sim_data_upsc
[
sim_data_upsc
==
0
]
=
1e-30
real_data_upsc
=
np
.
multiply
(
weights
,
real_data
)
diff
=
real_data_upsc
-
sim_data_upsc
return
np
.
sum
(
np
.
divide
(
np
.
multiply
(
diff
,
diff
),
sim_data_upsc
))
...
...
@@ -270,7 +271,7 @@ def plot_result(sim_result, ref_result, bin_start=0, bin_end=-1):
get_real_data_values
(
bin_start
,
bin_end
),
sim_result
.
axis
(),
sim_data
,
ref_result
.
axis
(),
ref_data
)
xlabel
=
ba
.
get_axes_labels
(
sim_result
,
ba
.
Axes
.
DEFAULT
)[
0
]
xlabel
=
ba
_plot
.
get_axes_labels
(
sim_result
,
ba
.
Axes
.
DEFAULT
)[
0
]
ylabel
=
"Intensity"
plt
.
xlabel
(
xlabel
,
fontsize
=
16
)
plt
.
ylabel
(
ylabel
,
fontsize
=
16
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment