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
a6c3ff8c
Commit
a6c3ff8c
authored
Mar 14, 2021
by
Wuttke, Joachim
Browse files
corr line length
parent
0af6dc37
Pipeline
#33381
passed with stage
in 28 minutes and 46 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Examples/fit/gisas2d/gisas_fake1.py
View file @
a6c3ff8c
...
...
@@ -21,7 +21,8 @@ def fake_data():
# Draw noisy data
np
.
random
.
seed
(
0
)
data
=
np
.
random
.
normal
(
theory
,
np
.
sqrt
(
theory
))
+
np
.
random
.
poisson
(
bg
,
theory
.
shape
)
data
=
np
.
random
.
normal
(
theory
,
np
.
sqrt
(
theory
))
+
np
.
random
.
poisson
(
bg
,
theory
.
shape
)
# Save to numpy
np
.
savetxt
(
"gisas-model1.txt.gz"
,
data
)
...
...
Examples/fit/gisas2d/gisas_fit2d.py
View file @
a6c3ff8c
...
...
@@ -17,8 +17,9 @@ def run_fitting():
fit_objective
=
ba
.
FitObjective
()
fit_objective
.
addSimulationAndData
(
model
.
get_simulation
,
real_data
)
fit_objective
.
initPrint
(
10
)
# Print on every 10th iteration.
fit_objective
.
initPlot
(
10
)
# Plot on every 10th iteration. Will slow down the fit.
fit_objective
.
initPrint
(
10
)
# Print on every 10th iteration.
fit_objective
.
initPlot
(
10
)
# Plot on every 10th iteration. Will slow down the fit.
minimizer
=
ba
.
Minimizer
()
params
=
model
.
start_parameters_1
()
...
...
Examples/fit/gisas2d/gisas_model1.py
View file @
a6c3ff8c
...
...
@@ -6,7 +6,6 @@ Dilute cylinders on a substrate.
import
bornagain
as
ba
from
bornagain
import
deg
,
nm
mat_vacuum
=
ba
.
HomogeneousMaterial
(
"Vacuum"
,
0
,
0
)
mat_substrate
=
ba
.
HomogeneousMaterial
(
"Substrate"
,
6e-6
,
2e-8
)
mat_particle
=
ba
.
HomogeneousMaterial
(
"Particle"
,
6e-4
,
2e-8
)
...
...
@@ -33,13 +32,15 @@ def get_sample(params):
def
get_simulation
(
params
):
beam
=
ba
.
Beam
(
10
**
params
[
'lg(intensity)'
],
0.1
*
nm
,
ba
.
Direction
(
0.2
*
deg
,
0
))
beam
=
ba
.
Beam
(
10
**
params
[
'lg(intensity)'
],
0.1
*
nm
,
ba
.
Direction
(
0.2
*
deg
,
0
))
det
=
ba
.
SphericalDetector
(
100
,
-
1.5
*
deg
,
1.5
*
deg
,
100
,
0
,
3
*
deg
)
sample
=
get_sample
(
params
)
simulation
=
ba
.
GISASSimulation
(
beam
,
sample
,
det
)
if
'lg(background)'
in
params
:
simulation
.
setBackground
(
ba
.
ConstantBackground
(
10
**
params
[
'lg(background)'
]))
simulation
.
setBackground
(
ba
.
ConstantBackground
(
10
**
params
[
'lg(background)'
]))
return
simulation
...
...
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