Commit b703ab22 authored by Reimar Leike's avatar Reimar Leike
Browse files

better test for PoissonianEnergy

parent f0dfc570
Pipeline #76644 passed with stages
in 22 minutes and 12 seconds
......@@ -59,7 +59,7 @@ def test_GaussianEnergy(field):
dtype = field.dtype
icov = ift.from_random(field.domain, 'normal')**2
icov = ift.makeOp(icov)
get_noisy_data = lambda mean : mean+icov.draw_sample_with_dtype(
get_noisy_data = lambda mean : mean + icov.draw_sample_with_dtype(
from_inverse=True, dtype=dtype)
E_init = lambda mean : ift.GaussianEnergy(mean=mean,
inverse_covariance=icov)
......@@ -72,7 +72,7 @@ def test_PoissonEnergy(field):
return
def get_noisy_data(mean):
return ift.makeField(mean.domain, np.random.poisson(mean.val))
lam = 5*field**2 # make rate positive
lam = 10*(field**2).clip(0.1,None) # make rate positive and high enough to avoid bad statistic
E_init = lambda mean : ift.PoissonianEnergy(mean)
energy_tester(lam, get_noisy_data, E_init)
Markdown is supported
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