Skip to content

Commit

Permalink
doc: support step
Browse files Browse the repository at this point in the history
  • Loading branch information
zonca committed Dec 23, 2024
1 parent 6190292 commit 97c587a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/preprocess-templates/catalog/create_catalog_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 97c587a

Please sign in to comment.