From 97c587a4e88373e76ee14b69d91fd18e941b48bf Mon Sep 17 00:00:00 2001 From: Andrea Zonca Date: Sun, 22 Dec 2024 22:43:55 -0800 Subject: [PATCH] doc: support step --- .../catalog/create_catalog_background.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/preprocess-templates/catalog/create_catalog_background.py b/docs/preprocess-templates/catalog/create_catalog_background.py index 6e4e8e17..f4fd43b8 100644 --- a/docs/preprocess-templates/catalog/create_catalog_background.py +++ b/docs/preprocess-templates/catalog/create_catalog_background.py @@ -59,24 +59,27 @@ ".h5", f"_nside_{nside}_map_{freq.value:04.1f}.h5" ) - if os.path.exists(out_filename.replace(".h5", "COMPLETED.txt")): sys.exit(0) catalog_size = len(h5py.File(catalog_filename)["theta"]) -slice_size = int(2.82 * 1e6) +step = 10 +if step != 1: + out_filename = out_filename.replace(".h5", f"_sparse{step}.h5") + +slice_size = int(2.82 * 1e6 * step) fwhm = {8192: 0.9 * u.arcmin, 4096: 2.6 * u.arcmin, 2048: 5.1 * u.arcmin} m = None - +num_slice = 0 for slice_start in range(0, catalog_size, slice_size): gc.collect() catalog = PointSourceCatalog( catalog_filename, - catalog_slice=np.index_exp[slice_start : slice_start + slice_size], + catalog_slice=np.index_exp[slice_start : slice_start + slice_size : step], nside=nside, ) temp_m = catalog.get_emission(