Skip to content

Commit 109c5ee

Browse files
committed
API: Update noise model in Probe.measure.
@ogurreck proposed a more accurate noise model for data acquisition in #39. This is a temporary patch which replaces the current inaccurate model with a normally distributed noise. A more accurate noise model is proposed for a later time.
1 parent 2789ba1 commit 109c5ee

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

xdesign/acquisition.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,21 @@ def translate(self, dx):
129129
self.p1 += vec
130130
self.p2 += vec
131131

132-
def measure(self, phantom, noise=False):
133-
"""Return the probe measurement given phantom. When noise is > 0,
134-
poisson noise is added to the returned measurement."""
132+
def measure(self, phantom, sigma=0):
133+
"""Return the probe measurement with optional Gaussian noise.
134+
135+
Parameters
136+
----------
137+
sigma : float >= 0
138+
The standard deviation of the normally distributed noise.
139+
"""
135140
newdata = 0
136141
for m in range(phantom.population):
137142
# print("%s Measure feature %i" % (str(self), m))
138143
newdata += (beamintersect(self, phantom.feature[m].geometry) *
139144
phantom.feature[m].mass_atten)
140-
if noise > 0:
141-
newdata += newdata * noise * np.random.poisson(1)
145+
if sigma > 0:
146+
newdata += newdata * np.random.normal(scale=sigma)
142147
self.record()
143148
return newdata
144149

0 commit comments

Comments
 (0)