Skip to content

Commit b9a05a3

Browse files
committed
tests
1 parent d33467f commit b9a05a3

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

tests/test_fields.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ def test_positions(mapper, catalog, vmap):
205205
"lmax": mapper.lmax,
206206
"deconv": mapper.deconvolve,
207207
"bias": pytest.approx(bias / nbar**2),
208-
"var": 1.0,
208+
"ngal": int(4.0 * npix),
209209
"wmean": 1.0,
210-
"ngal": 4.0 * npix,
210+
"var": 1.0,
211211
}
212212
np.testing.assert_array_equal(m, 0)
213213

@@ -227,6 +227,9 @@ def test_positions(mapper, catalog, vmap):
227227
"lmax": mapper.lmax,
228228
"deconv": mapper.deconvolve,
229229
"bias": pytest.approx(bias / nbar**2),
230+
"ngal": int(4.0 * npix),
231+
"wmean": 1.0,
232+
"var": 1.0,
230233
}
231234
np.testing.assert_array_equal(m, 1.0)
232235

@@ -250,6 +253,9 @@ def test_positions(mapper, catalog, vmap):
250253
"lmax": mapper.lmax,
251254
"deconv": mapper.deconvolve,
252255
"bias": pytest.approx(bias / nbar**2),
256+
"ngal": int(4.0 * npix),
257+
"wmean": 1.0,
258+
"var": 1.0,
253259
}
254260

255261
# compute number count map with visibility map
@@ -268,6 +274,9 @@ def test_positions(mapper, catalog, vmap):
268274
"lmax": mapper.lmax,
269275
"deconv": mapper.deconvolve,
270276
"bias": pytest.approx(bias / nbar**2),
277+
"ngal": int(4.0 * npix),
278+
"wmean": 1.0,
279+
"var": 1.0,
271280
}
272281

273282
# compute overdensity maps with given (incorrect) nbar
@@ -293,6 +302,7 @@ def test_scalar_field(mapper, catalog):
293302
v2 = ((w * v) ** 2).sum()
294303
w = w.reshape(w.size // 4, 4).sum(axis=-1)
295304
wbar = w.mean()
305+
v1 = w.sum()
296306
bias = (4 * np.pi / npix / npix) * v2
297307

298308
assert m.shape == (npix,)
@@ -306,9 +316,9 @@ def test_scalar_field(mapper, catalog):
306316
"lmax": mapper.lmax,
307317
"deconv": mapper.deconvolve,
308318
"bias": pytest.approx(bias / wbar**2),
309-
"ngal": 4.0 * npix,
310-
"wmean": wbar,
311-
"var": v2,
319+
"ngal": int(4.0 * npix),
320+
"wmean": pytest.approx(v1 / (4.0 * npix)),
321+
"var": v2 / (4.0 * npix),
312322
}
313323
np.testing.assert_array_almost_equal(m, 0)
314324

@@ -327,8 +337,8 @@ def test_complex_field(mapper, catalog):
327337
v2 = ((w * re) ** 2 + (w * im) ** 2).sum()
328338
w = w.reshape(w.size // 4, 4).sum(axis=-1)
329339
wbar = w.mean()
340+
v1 = w.sum()
330341
bias = (4 * np.pi / npix / npix) * v2 / 2
331-
332342
assert m.shape == (2, npix)
333343
assert m.dtype.metadata == {
334344
"catalog": catalog.label,
@@ -340,9 +350,9 @@ def test_complex_field(mapper, catalog):
340350
"lmax": mapper.lmax,
341351
"deconv": mapper.deconvolve,
342352
"bias": pytest.approx(bias / wbar**2),
343-
"ngal": 4.0 * npix,
344-
"wmean": wbar,
345-
"var": v2,
353+
"ngal": int(4.0 * npix),
354+
"wmean": v1 / (4.0 * npix),
355+
"var": v2 / (4.0 * npix),
346356
}
347357
np.testing.assert_array_almost_equal(m, 0)
348358

0 commit comments

Comments
 (0)