Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchrotron with local-spectra modulation #152

Merged
merged 18 commits into from
Feb 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
save memory by deleting unneeded objects
  • Loading branch information
zonca committed Feb 17, 2023
commit bf20554b006945b53a2608fe94b47ad10bc5d7e0
43 changes: 23 additions & 20 deletions docs/preprocess-templates/utils_synch_generate_map.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@
"map_log_pol_tens_large_scale = hp.alm2map(alm_log_pol_tens_large_scale.astype(np.complex128), nside=output_nside)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"del alm_log_pol_tens_large_scale"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -128,7 +137,7 @@
"metadata": {},
"outputs": [],
"source": [
"modulate_alm = { k:hp.read_alm(output_dir_raw/f\"synch_{k}_modulation_alms_lmax768.fits.gz\").astype(np.complex128) for k in [\"temperature\",\"polarization\"] }"
"modulate_alm = { k:hp.read_alm(output_dir_raw/f\"synch_{k}_modulation_alms_lmax192.fits.gz\").astype(np.complex128) for k in [\"temperature\",\"polarization\"] }"
]
},
{
Expand Down Expand Up @@ -166,6 +175,7 @@
"\n",
"alm_log_pol_tens_small_scale = [hp.almxfl(each, np.ones(output_lmax+1)) for each in alm_log_pol_tens_small_scale]\n",
"map_log_pol_tens_small_scale = hp.alm2map(alm_log_pol_tens_small_scale, nside=output_nside)\n",
"del alm_log_pol_tens_small_scale\n",
"map_log_pol_tens_small_scale[0] *= hp.alm2map(modulate_alm[\"temperature\"], output_nside)\n",
"map_log_pol_tens_small_scale[1:] *= hp.alm2map(modulate_alm[\"polarization\"], output_nside)\n",
"assert np.isnan(map_log_pol_tens_small_scale).sum() == 0"
Expand All @@ -191,6 +201,15 @@
"map_log_pol_tens = map_log_pol_tens_large_scale + map_log_pol_tens_small_scale"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"del map_log_pol_tens_large_scale, map_log_pol_tens_small_scale"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -241,16 +260,9 @@
"metadata": {},
"outputs": [],
"source": [
"hp.mollview((output_map - log_pol_tens_to_map(map_log_pol_tens))[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hp.mollview(output_map[0])"
"if output_nside < 4096:\n",
" hp.mollview((output_map - log_pol_tens_to_map(map_log_pol_tens))[0])\n",
" hp.mollview(output_map[0])"
]
},
{
Expand Down Expand Up @@ -278,15 +290,6 @@
"add_metadata([output_dir / f\"synch_template_nside{output_nside}.fits\"], coord=\"G\", unit=\"uK_RJ\", ref_freq=\"23 GHz\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ls -lh $output_dir"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down