|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# This bash script is used to run the dory src subtraction code |
| 4 | +# on Planck legacy maps. Note that we use the Planck NPIPE beams |
| 5 | +# because legacy beams are truncated at l=4000 and the dory source |
| 6 | +# subtraction code does not work properly with truncated beams. |
| 7 | + |
| 8 | +# Path to dory.py (part of the tenki python package) |
| 9 | +#dory_path=${TENKI_PATH}/point_sources |
| 10 | +dory_path=/home/scw1361/sgiardie/tenki/point_sources |
| 11 | + |
| 12 | + |
| 13 | +# Path to npipe maps & beams |
| 14 | +map_path=/scratch/c.spxsg6/iso/dust/planck_projected |
| 15 | +beam_path=/scratch/c.spxsg6/iso/dust/beams/npipe |
| 16 | + |
| 17 | +# Path to the input point source catalog |
| 18 | +ps_catalog_path=/scratch/c.spxsg6/iso/dust/catalogs/cat_skn_090_20220526_nightonly_ordered.txt |
| 19 | +# Note that we chose here to use the 90 GHz catalog |
| 20 | + |
| 21 | +# Path to galactic mask |
| 22 | +mask_path=/scratch/c.spxsg6/dr6/masks/mask_galactic_equatorial_car_gal080_apo0_reverse.fits |
| 23 | + |
| 24 | +# dory.py parameters |
| 25 | +tile_size=3000 |
| 26 | +pad_size=30 |
| 27 | +hack=6000 |
| 28 | +## Strength of the prior loaded from the input ps_catalog |
| 29 | +prior=1 |
| 30 | +## Sources with SNR < sigma_cat (in the input catalog) are excluded from the fit |
| 31 | +sigma_cat=15 |
| 32 | +## Sources with SNR < sigma_sub (in the catalog produced during the fitting step) |
| 33 | +# are excluded from the subtraction |
| 34 | +sigma_sub=2 |
| 35 | + |
| 36 | +# Splits and frequencies |
| 37 | +splits=("1" "2") |
| 38 | +freqs=("100" "143" "217" "353") |
| 39 | + |
| 40 | +# Using 256 cpus, this should run in ~10mins per map |
| 41 | +# and produce srcfree and model maps |
| 42 | +for freq in ${freqs[@]}; do |
| 43 | + for split in ${splits[@]}; do |
| 44 | + |
| 45 | + map_file=${map_path}/HFI_SkyMap_2048_R3.01_halfmission-${split}_f${freq}_map.fits |
| 46 | + ivar_file=${map_path}/HFI_SkyMap_2048_R3.01_halfmission-${split}_f${freq}_ivar.fits |
| 47 | + beam_file=${beam_path}/bl_T_npipe_${freq}_coadd_pixwin.dat |
| 48 | + out_map_file=${map_path}/HFI_SkyMap_2048_R3.01_halfmission-${split}_f${freq}_map_srcfree.fits |
| 49 | + out_map_model_file=${map_path}/HFI_SkyMap_2048_R3.01_halfmission-${split}_f${freq}_map_model.fits |
| 50 | + |
| 51 | + out_cat_path=${map_path}/catalogs/cats_${freq}${split} |
| 52 | + |
| 53 | + time srun -n 10 -c 4 --cpu_bind=cores python "${dory_path}/dory.py" fit "${map_file}" "${ivar_file}" "${ps_catalog_path}" "${out_cat_path}" -R "tile:${tile_size}" -f "${freq}" -b "${beam_file}" --ncomp 3 --hack ${hack} -P ${prior} -m "${mask_path}" -s ${sigma_cat} --maxcorrlen 1000 |
| 54 | + time srun -n 1 -c 40 --cpu_bind=cores python "${dory_path}/dory.py" subtract "${map_file}" "${out_cat_path}/cat.fits" "${out_map_file}" "${out_map_model_file}" -R "tile:${tile_size}" -f "${freq}" -b "${beam_file}" --ncomp 3 -s ${sigma_sub} |
| 55 | + done |
| 56 | +done |
0 commit comments