def test_simple(self): """Test a simple example""" image = Map.create(npix=(10, 5), unit="s") image.data[3, 3] = 11 image.data[3, 4] = 10 image.data[3, 5] = 12 image.data[3, 6] = np.nan image.data[0, 9] = 1e20 table = find_peaks(image, threshold=3) assert len(table) == 3 assert table["value"].unit == "s" assert table["ra"].unit == "deg" assert table["dec"].unit == "deg" row = table[0] assert tuple((row["x"], row["y"])) == (9, 0) assert_allclose(row["value"], 1e20) assert_allclose(row["ra"], 359.55) assert_allclose(row["dec"], -0.2) row = table[1] assert tuple((row["x"], row["y"])) == (5, 3) assert_allclose(row["value"], 12)
kernel = Gaussian2DKernel(1, mode="oversample").array plt.imshow(kernel); # In[ ]: get_ipython().run_cell_magic('time', '', 'ts_image_estimator = TSMapEstimator()\nimages_ts = ts_image_estimator.run(images, kernel)\nprint(images_ts.keys())') # In[ ]: sources = find_peaks(images_ts["sqrt_ts"], threshold=8) sources # In[ ]: source_pos = SkyCoord(sources["ra"], sources["dec"]) source_pos # In[ ]: # Plot sources on top of significance sky image images_ts["sqrt_ts"].plot(add_cbar=True)
def test_constant(self): image = Map.create(npix=(10, 5)) table = find_peaks(image, threshold=3) assert len(table) == 0
def test_no_peak(self): image = Map.create(npix=(10, 5)) image.data[3, 5] = 12 table = find_peaks(image, threshold=12.1) assert len(table) == 0