{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Compute synchrotron curvature harmonic coefficients\n" ], "id": "eb6cb873e076" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import healpy as hp\n", "from pathlib import Path" ], "id": "5141505c4e2c" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "datadir=Path(\"data/\")\n", "output_dir = Path(\"production-data/synch\")\n", "output_dir_raw = output_dir / \"raw\"" ], "id": "cb1010e83006" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "output_nside = 8192" ], "id": "55fa7162464f" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "output_lmax = min(int(2.5 * output_nside), 8192 * 2)" ], "id": "1a051f2d1256" }, { "cell_type": "markdown", "metadata": {}, "source": [ "### $a_{\\ell m}$" ], "id": "acf92cf96d6b" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "alm = hp.read_alm(\n", " output_dir_raw / f\"synch_curvature_alm_nside8192_lmax16384.fits\",\n", " hdu=1,\n", ")" ], "id": "aa526bb3e073" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "alm_clip = hp.almxfl(alm, np.ones(output_lmax + 1))\n", "del alm" ], "id": "a959a3d53294" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "output_map = hp.alm2map(alm_clip.astype(np.complex128), nside=output_nside)" ], "id": "69ff7deddd4c" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "output_filename = output_dir / f\"synch_curvature_nside{output_nside}.fits\"" ], "id": "5ac6dc67d883" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hp.write_map(output_filename, output_map, dtype=np.float32, overwrite=True)" ], "id": "2a9fba3c8ebb" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pysm3.utils import add_metadata" ], "id": "f7be29d0a6de" }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "add_metadata([output_filename], coord=\"G\", unit=\"\", ref_freq=\"23 GHz\", ell_max=str(output_lmax))" ], "id": "5dd2723b8631" } ], "metadata": { "kernelspec": { "display_name": "pycmb", "language": "python", "name": "pycmb" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 4 }