Commit 8efbc0c2 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

synthetic data with bg + sqrt noise

parent bb3335cc
...@@ -24,13 +24,11 @@ def fake_data(): ...@@ -24,13 +24,11 @@ def fake_data():
# Compute model distribution # Compute model distribution
simulation = model.get_simulation(params) simulation = model.get_simulation(params)
simulation.runSimulation() simulation.runSimulation()
data = simulation.result().array() theory = simulation.result().array()
# Draw noisy data # Draw noisy data
np.random.seed(0) np.random.seed(0)
noise_factor = 0.1 data = np.random.normal(theory, np.sqrt(theory)) + np.random.poisson(3.57, theory.shape)
noisy = np.random.normal(data, noise_factor*np.sqrt(data))
noisy[noisy < 0.1] = 0.1
# Save to numpy # Save to numpy
np.savetxt("gisas-model1.txt.gz", data) np.savetxt("gisas-model1.txt.gz", data)
......
...@@ -47,7 +47,7 @@ def get_simulation(params): ...@@ -47,7 +47,7 @@ def get_simulation(params):
""" """
Returns a GISAXS simulation with beam and detector defined Returns a GISAXS simulation with beam and detector defined
""" """
intensity = 1e8 intensity = 1e6
beam = ba.Beam(intensity, 0.1*nm, ba.Direction(0.2*deg, 0)) beam = ba.Beam(intensity, 0.1*nm, ba.Direction(0.2*deg, 0))
det = ba.SphericalDetector(100, -1*deg, 1*deg, 100, 0, 2*deg) det = ba.SphericalDetector(100, -1*deg, 1*deg, 100, 0, 2*deg)
sample = get_sample(params) sample = get_sample(params)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment