Created
February 28, 2025 20:49
-
-
Save zonca/8b2becd32e1ffd9e1bc268ebae100c14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "01a3fc32", | |
"metadata": { | |
"tags": [ | |
"papermill-error-cell-tag" | |
] | |
}, | |
"source": [ | |
"<span style=\"color:red; font-family:Helvetica Neue, Helvetica, Arial, sans-serif; font-size:2em;\">An Exception was encountered at '<a href=\"#papermill-error-cell\">In [26]</a>'.</span>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "c8dae6fc", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:17.923411Z", | |
"iopub.status.busy": "2025-02-28T20:49:17.923193Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.270188Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.269657Z" | |
}, | |
"papermill": { | |
"duration": 2.351971, | |
"end_time": "2025-02-28T20:49:20.271364", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:17.919393", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import healpy as hp\n", | |
"import numpy as np\n", | |
"import pickle\n", | |
"import h5py\n", | |
"import altair as alt\n", | |
"\n", | |
"alt.renderers.enable(\"html\")\n", | |
"import pandas as pd\n", | |
"import warnings\n", | |
"\n", | |
"warnings.filterwarnings(\"ignore\")\n", | |
"import pysm3.units as u" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "b706dd79", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.279723Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.279244Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.284613Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.284265Z" | |
}, | |
"papermill": { | |
"duration": 0.009581, | |
"end_time": "2025-02-28T20:49:20.285368", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.275787", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<script>\n", | |
"code_show=true; \n", | |
"function code_toggle() {\n", | |
" if (code_show){\n", | |
" $('div.input').hide();\n", | |
" } else {\n", | |
" $('div.input').show();\n", | |
" }\n", | |
" code_show = !code_show\n", | |
"} \n", | |
"$( document ).ready(code_toggle);\n", | |
"</script>\n", | |
"<form action=\"javascript:code_toggle()\"><input type=\"submit\" value=\"Click here to toggle on/off the raw code.\"></form>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"from IPython.display import HTML\n", | |
"\n", | |
"HTML(\n", | |
" \"\"\"<script>\n", | |
"code_show=true; \n", | |
"function code_toggle() {\n", | |
" if (code_show){\n", | |
" $('div.input').hide();\n", | |
" } else {\n", | |
" $('div.input').show();\n", | |
" }\n", | |
" code_show = !code_show\n", | |
"} \n", | |
"$( document ).ready(code_toggle);\n", | |
"</script>\n", | |
"<form action=\"javascript:code_toggle()\"><input type=\"submit\" value=\"Click here to toggle on/off the raw code.\"></form>\"\"\"\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "bc1e1d35", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.292487Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.292286Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.294416Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.294072Z" | |
}, | |
"papermill": { | |
"duration": 0.006019, | |
"end_time": "2025-02-28T20:49:20.295117", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.289098", | |
"status": "completed" | |
}, | |
"tags": [ | |
"parameters" | |
] | |
}, | |
"outputs": [], | |
"source": [ | |
"pol = \"T\"" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "c962896c", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.301236Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.301027Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.302986Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.302646Z" | |
}, | |
"papermill": { | |
"duration": 0.005897, | |
"end_time": "2025-02-28T20:49:20.303728", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.297831", | |
"status": "completed" | |
}, | |
"tags": [ | |
"injected-parameters" | |
] | |
}, | |
"outputs": [], | |
"source": [ | |
"# Parameters\n", | |
"pol = \"T\"\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "4753444c", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.309672Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.309480Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.311558Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.311218Z" | |
}, | |
"papermill": { | |
"duration": 0.005927, | |
"end_time": "2025-02-28T20:49:20.312326", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.306399", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"selection = {}\n", | |
"cl = {}\n", | |
"i_pol = \"TEB\".index(pol)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "1dbaf7b3", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.318519Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.318316Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.338951Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.338619Z" | |
}, | |
"papermill": { | |
"duration": 0.024605, | |
"end_time": "2025-02-28T20:49:20.339709", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.315104", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"/mnt/home/azonca/p/software/map_based_simulations/mbs-s0019-20250221\n" | |
] | |
} | |
], | |
"source": [ | |
"%cd .." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "5ade373a", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.346012Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.345818Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.348142Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.347808Z" | |
}, | |
"papermill": { | |
"duration": 0.006276, | |
"end_time": "2025-02-28T20:49:20.348782", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.342506", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import os\n", | |
"\n", | |
"if os.path.basename(os.getcwd()) == \"verification\":\n", | |
" %cd .." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"id": "8c96f954", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.354987Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.354794Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.356896Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.356559Z" | |
}, | |
"papermill": { | |
"duration": 0.00606, | |
"end_time": "2025-02-28T20:49:20.357607", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.351547", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"from astropy.table import QTable" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"id": "cd1a3cf5", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.363999Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.363795Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.368726Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.368392Z" | |
}, | |
"papermill": { | |
"duration": 0.008882, | |
"end_time": "2025-02-28T20:49:20.369378", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.360496", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"chs = QTable.read(\"instrument_model/instrument_model.tbl\", format=\"ascii.ipac\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "4e84eb99", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.375748Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.375555Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.379052Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.378737Z" | |
}, | |
"papermill": { | |
"duration": 0.007631, | |
"end_time": "2025-02-28T20:49:20.379828", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.372197", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div><i>QTable length=5</i>\n", | |
"<table id=\"table23447026100240\" class=\"table-striped table-bordered table-condensed\">\n", | |
"<thead><tr><th>telescope</th><th>band</th><th>nside</th><th>bandpass_file</th><th>beam_file</th></tr></thead>\n", | |
"<thead><tr><th>str4</th><th>str2</th><th>int64</th><th>str15</th><th>str11</th></tr></thead>\n", | |
"<tr><td>WMAP</td><td>K</td><td>512</td><td>bandpass_K.tbl</td><td>beam_K.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>Ka</td><td>512</td><td>bandpass_Ka.tbl</td><td>beam_Ka.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>Q</td><td>512</td><td>bandpass_Q.tbl</td><td>beam_Q.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>V</td><td>512</td><td>bandpass_V.tbl</td><td>beam_V.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>W</td><td>512</td><td>bandpass_W.tbl</td><td>beam_W.tbl</td></tr>\n", | |
"</table></div>" | |
], | |
"text/plain": [ | |
"<QTable length=5>\n", | |
"telescope band nside bandpass_file beam_file \n", | |
" str4 str2 int64 str15 str11 \n", | |
"--------- ---- ----- --------------- -----------\n", | |
" WMAP K 512 bandpass_K.tbl beam_K.tbl\n", | |
" WMAP Ka 512 bandpass_Ka.tbl beam_Ka.tbl\n", | |
" WMAP Q 512 bandpass_Q.tbl beam_Q.tbl\n", | |
" WMAP V 512 bandpass_V.tbl beam_V.tbl\n", | |
" WMAP W 512 bandpass_W.tbl beam_W.tbl" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"chs" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"id": "2c867551", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.386704Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.386379Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.389071Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.388767Z" | |
}, | |
"papermill": { | |
"duration": 0.006852, | |
"end_time": "2025-02-28T20:49:20.389758", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.382906", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"DataTransformerRegistry.enable('default')" | |
] | |
}, | |
"execution_count": 11, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"alt.data_transformers.enable(\"default\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"id": "58243521", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.396502Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.396306Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.398924Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.398613Z" | |
}, | |
"papermill": { | |
"duration": 0.006936, | |
"end_time": "2025-02-28T20:49:20.399697", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.392761", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"DataTransformerRegistry.enable('default')" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"alt.data_transformers.disable_max_rows()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"id": "4a1a3820", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.406617Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.406376Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.408390Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.408062Z" | |
}, | |
"papermill": { | |
"duration": 0.006223, | |
"end_time": "2025-02-28T20:49:20.409015", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.402792", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import pysm3 as pysm\n", | |
"from pysm3 import units as u" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"id": "c2f4a800", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.415887Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.415694Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.435577Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.435257Z" | |
}, | |
"papermill": { | |
"duration": 0.024331, | |
"end_time": "2025-02-28T20:49:20.436408", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.412077", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"import mapsims" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"id": "7f5ff98d", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.443401Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.443210Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.445436Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.445104Z" | |
}, | |
"papermill": { | |
"duration": 0.006584, | |
"end_time": "2025-02-28T20:49:20.446139", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.439555", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"pol_label = [\"TT\", \"EE\", \"BB\"][i_pol]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"id": "a09e167d", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.453064Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.452861Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.454846Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.454507Z" | |
}, | |
"papermill": { | |
"duration": 0.006278, | |
"end_time": "2025-02-28T20:49:20.455602", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.449324", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"from glob import glob" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"id": "e918e076", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.462580Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.462389Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.464596Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.464264Z" | |
}, | |
"papermill": { | |
"duration": 0.006554, | |
"end_time": "2025-02-28T20:49:20.465331", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.458777", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"toml_files = glob(\"*.toml\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"id": "73a3d299", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.472434Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.472240Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.474231Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.473901Z" | |
}, | |
"papermill": { | |
"duration": 0.006471, | |
"end_time": "2025-02-28T20:49:20.474968", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.468497", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"toml_files.remove(\"common.toml\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"id": "3aa3a12c", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.482190Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.481990Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.484017Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.483675Z" | |
}, | |
"papermill": { | |
"duration": 0.006549, | |
"end_time": "2025-02-28T20:49:20.484743", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.478194", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"toml_files.remove(\"co_co1.toml\")\n", | |
"toml_files.remove(\"co_co3.toml\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 20, | |
"id": "27df25ee", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.491872Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.491683Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.493740Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.493422Z" | |
}, | |
"papermill": { | |
"duration": 0.006524, | |
"end_time": "2025-02-28T20:49:20.494474", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.487950", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"toml_files.sort()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"id": "062c5ee0", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.501745Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.501465Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.503332Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.503018Z" | |
}, | |
"papermill": { | |
"duration": 0.006311, | |
"end_time": "2025-02-28T20:49:20.504054", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.497743", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"pysm_nside = 2048" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 22, | |
"id": "fbb66902", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.511280Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.511092Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.513619Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.513318Z" | |
}, | |
"papermill": { | |
"duration": 0.007002, | |
"end_time": "2025-02-28T20:49:20.514364", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.507362", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"astropy.table.table.QTable" | |
] | |
}, | |
"execution_count": 22, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"type(chs)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 23, | |
"id": "df06c552", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.521651Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.521455Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.524039Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.523730Z" | |
}, | |
"papermill": { | |
"duration": 0.007109, | |
"end_time": "2025-02-28T20:49:20.524789", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.517680", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"5" | |
] | |
}, | |
"execution_count": 23, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"len(chs)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 24, | |
"id": "c0ce7d0c", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.532301Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.532107Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.534120Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.533790Z" | |
}, | |
"papermill": { | |
"duration": 0.006589, | |
"end_time": "2025-02-28T20:49:20.534836", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.528247", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"channels = chs[\"band\"]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 25, | |
"id": "89eec40d", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.542425Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.542235Z", | |
"iopub.status.idle": "2025-02-28T20:49:20.545409Z", | |
"shell.execute_reply": "2025-02-28T20:49:20.545084Z" | |
}, | |
"papermill": { | |
"duration": 0.007916, | |
"end_time": "2025-02-28T20:49:20.546186", | |
"exception": false, | |
"start_time": "2025-02-28T20:49:20.538270", | |
"status": "completed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div><i>QTable length=5</i>\n", | |
"<table id=\"table23447026100240\" class=\"table-striped table-bordered table-condensed\">\n", | |
"<thead><tr><th>telescope</th><th>band</th><th>nside</th><th>bandpass_file</th><th>beam_file</th></tr></thead>\n", | |
"<thead><tr><th>str4</th><th>str2</th><th>int64</th><th>str15</th><th>str11</th></tr></thead>\n", | |
"<tr><td>WMAP</td><td>K</td><td>512</td><td>bandpass_K.tbl</td><td>beam_K.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>Ka</td><td>512</td><td>bandpass_Ka.tbl</td><td>beam_Ka.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>Q</td><td>512</td><td>bandpass_Q.tbl</td><td>beam_Q.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>V</td><td>512</td><td>bandpass_V.tbl</td><td>beam_V.tbl</td></tr>\n", | |
"<tr><td>WMAP</td><td>W</td><td>512</td><td>bandpass_W.tbl</td><td>beam_W.tbl</td></tr>\n", | |
"</table></div>" | |
], | |
"text/plain": [ | |
"<QTable length=5>\n", | |
"telescope band nside bandpass_file beam_file \n", | |
" str4 str2 int64 str15 str11 \n", | |
"--------- ---- ----- --------------- -----------\n", | |
" WMAP K 512 bandpass_K.tbl beam_K.tbl\n", | |
" WMAP Ka 512 bandpass_Ka.tbl beam_Ka.tbl\n", | |
" WMAP Q 512 bandpass_Q.tbl beam_Q.tbl\n", | |
" WMAP V 512 bandpass_V.tbl beam_V.tbl\n", | |
" WMAP W 512 bandpass_W.tbl beam_W.tbl" | |
] | |
}, | |
"execution_count": 25, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"chs" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "d0ec674d", | |
"metadata": { | |
"tags": [ | |
"papermill-error-cell-tag" | |
] | |
}, | |
"source": [ | |
"<span id=\"papermill-error-cell\" style=\"color:red; font-family:Helvetica Neue, Helvetica, Arial, sans-serif; font-size:2em;\">Execution using papermill encountered an exception here and stopped:</span>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 26, | |
"id": "a43ee0e3", | |
"metadata": { | |
"execution": { | |
"iopub.execute_input": "2025-02-28T20:49:20.554054Z", | |
"iopub.status.busy": "2025-02-28T20:49:20.553838Z", | |
"iopub.status.idle": "2025-02-28T20:49:26.282208Z", | |
"shell.execute_reply": "2025-02-28T20:49:26.281669Z" | |
}, | |
"papermill": { | |
"duration": 5.733159, | |
"end_time": "2025-02-28T20:49:26.282876", | |
"exception": true, | |
"start_time": "2025-02-28T20:49:20.549717", | |
"status": "failed" | |
}, | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"ame_a1\n" | |
] | |
}, | |
{ | |
"ename": "KeyError", | |
"evalue": "'center_frequency'", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", | |
"Cell \u001b[0;32mIn[26], line 21\u001b[0m\n\u001b[1;32m 10\u001b[0m sky \u001b[38;5;241m=\u001b[39m pysm\u001b[38;5;241m.\u001b[39mSky(\n\u001b[1;32m 11\u001b[0m nside\u001b[38;5;241m=\u001b[39mpysm_nside,\n\u001b[1;32m 12\u001b[0m preset_strings\u001b[38;5;241m=\u001b[39m[mapsim\u001b[38;5;241m.\u001b[39mpysm_components_string],\n\u001b[1;32m 13\u001b[0m output_unit\u001b[38;5;241m=\u001b[39mu\u001b[38;5;241m.\u001b[39muK_CMB,\n\u001b[1;32m 14\u001b[0m )\n\u001b[1;32m 15\u001b[0m onecl \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 16\u001b[0m pd\u001b[38;5;241m.\u001b[39mDataFrame({ch: pd\u001b[38;5;241m.\u001b[39mSeries(cl[component][ch][i_pol]) \u001b[38;5;28;01mfor\u001b[39;00m ch \u001b[38;5;129;01min\u001b[39;00m channels})\n\u001b[1;32m 17\u001b[0m \u001b[38;5;241m.\u001b[39mreset_index()\n\u001b[1;32m 18\u001b[0m \u001b[38;5;241m.\u001b[39mrename(columns\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mindex\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mell\u001b[39m\u001b[38;5;124m\"\u001b[39m})\n\u001b[1;32m 19\u001b[0m )\n\u001b[0;32m---> 21\u001b[0m pysm_emission \u001b[38;5;241m=\u001b[39m sky\u001b[38;5;241m.\u001b[39mget_emission(\u001b[43mchs\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcenter_frequency\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m[\u001b[38;5;241m0\u001b[39m])\n\u001b[1;32m 22\u001b[0m label \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPySM \u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m+\u001b[39m channels[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 24\u001b[0m pysm_low \u001b[38;5;241m=\u001b[39m hp\u001b[38;5;241m.\u001b[39manafast(\n\u001b[1;32m 25\u001b[0m pysm_emission, lmax\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mint\u001b[39m(\u001b[38;5;241m1.5\u001b[39m \u001b[38;5;241m*\u001b[39m pysm_nside), use_pixel_weights\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 26\u001b[0m )[i_pol]\n", | |
"File \u001b[0;32m~/micromamba/envs/cmb/lib/python3.12/site-packages/astropy/table/table.py:2093\u001b[0m, in \u001b[0;36mTable.__getitem__\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m 2091\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__getitem__\u001b[39m(\u001b[38;5;28mself\u001b[39m, item):\n\u001b[1;32m 2092\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(item, \u001b[38;5;28mstr\u001b[39m):\n\u001b[0;32m-> 2093\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[43m[\u001b[49m\u001b[43mitem\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 2094\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(item, (\u001b[38;5;28mint\u001b[39m, np\u001b[38;5;241m.\u001b[39minteger)):\n\u001b[1;32m 2095\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mRow(\u001b[38;5;28mself\u001b[39m, item)\n", | |
"File \u001b[0;32m~/micromamba/envs/cmb/lib/python3.12/site-packages/astropy/table/table.py:267\u001b[0m, in \u001b[0;36mTableColumns.__getitem__\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m 256\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Get items from a TableColumns object.\u001b[39;00m\n\u001b[1;32m 257\u001b[0m \n\u001b[1;32m 258\u001b[0m \u001b[38;5;124;03m::\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 264\u001b[0m \u001b[38;5;124;03m tc[1:3] # <TableColumns names=('b', 'c')>\u001b[39;00m\n\u001b[1;32m 265\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(item, \u001b[38;5;28mstr\u001b[39m):\n\u001b[0;32m--> 267\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mOrderedDict\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__getitem__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mitem\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(item, (\u001b[38;5;28mint\u001b[39m, np\u001b[38;5;241m.\u001b[39minteger)):\n\u001b[1;32m 269\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mlist\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvalues())[item]\n", | |
"\u001b[0;31mKeyError\u001b[0m: 'center_frequency'" | |
] | |
} | |
], | |
"source": [ | |
"for config_file in toml_files:\n", | |
" mapsim = mapsims.from_config(\n", | |
" [\"common.toml\", config_file], override={\"channels\": \"all\"}\n", | |
" )\n", | |
" component = config_file.split(\".\")[0]\n", | |
" print(component)\n", | |
" filename = f\"output/C_ell/C_ell_{component}.pkl\"\n", | |
" with open(filename, \"rb\") as f:\n", | |
" cl[component] = pickle.load(f)\n", | |
" sky = pysm.Sky(\n", | |
" nside=pysm_nside,\n", | |
" preset_strings=[mapsim.pysm_components_string],\n", | |
" output_unit=u.uK_CMB,\n", | |
" )\n", | |
" onecl = (\n", | |
" pd.DataFrame({ch: pd.Series(cl[component][ch][i_pol]) for ch in channels})\n", | |
" .reset_index()\n", | |
" .rename(columns={\"index\": \"ell\"})\n", | |
" )\n", | |
"\n", | |
" pysm_emission = sky.get_emission(chs[\"center_frequency\"][0])\n", | |
" label = \"PySM \" + channels[0]\n", | |
"\n", | |
" pysm_low = hp.anafast(\n", | |
" pysm_emission, lmax=int(1.5 * pysm_nside), use_pixel_weights=True\n", | |
" )[i_pol]\n", | |
" pysm_low *= (\n", | |
" hp.gauss_beam(chs[0][\"fwhm\"].to_value(u.rad), lmax=int(1.5 * pysm_nside)) ** 2\n", | |
" )\n", | |
" onecl[label] = 0\n", | |
" onecl[label][: len(pysm_low)] = pysm_low\n", | |
"\n", | |
" pysm_emission = sky.get_emission(\n", | |
" chs[-1][\"center_frequency\"],\n", | |
" )\n", | |
" label = \"PySM \" + channels[-1]\n", | |
"\n", | |
" pysm_high = hp.anafast(\n", | |
" pysm_emission, lmax=int(1.5 * pysm_nside), use_pixel_weights=True\n", | |
" )[i_pol]\n", | |
" pysm_high *= (\n", | |
" hp.gauss_beam(chs[-1][\"fwhm\"].to_value(u.rad), lmax=int(1.5 * pysm_nside)) ** 2\n", | |
" )\n", | |
" onecl[label] = 0\n", | |
" onecl[label][: len(pysm_high)] = pysm_high\n", | |
"\n", | |
" onecl = onecl[onecl.ell != 0]\n", | |
" decim = np.concatenate(\n", | |
" [[0], np.logspace(0, np.log10(len(onecl)), 100, endpoint=False)]\n", | |
" )\n", | |
" onecl = onecl.iloc[decim, :] # decimate in log scale to make plots smaller\n", | |
"\n", | |
" onecl_long = onecl.melt(\"ell\", var_name=\"channel\")\n", | |
" onecl_long[onecl_long.value == 0] = np.nan\n", | |
" selection[component] = alt.selection_multi(fields=[\"channel\"], bind=\"legend\")\n", | |
"\n", | |
" chart = (\n", | |
" alt.Chart(onecl_long, title=component + \" \" + pol_label)\n", | |
" .mark_line()\n", | |
" .encode(\n", | |
" x=alt.X(\"ell\", scale=alt.Scale(type=\"log\", base=10, domain=[1, 1e4])),\n", | |
" y=alt.Y(\"value\", scale=alt.Scale(type=\"log\", base=10)),\n", | |
" color=alt.Color(\n", | |
" \"channel\",\n", | |
" sort=[\"PySM \" + channels[0]]\n", | |
" + list(channels)\n", | |
" + [\"PySM \" + channels[-1]],\n", | |
" ),\n", | |
" opacity=alt.condition(selection[component], alt.value(1), alt.value(0.2)),\n", | |
" )\n", | |
" .add_selection(selection[component])\n", | |
" .interactive()\n", | |
" )\n", | |
" chart.display()\n", | |
" # chart.save(f\"verification/out_plot_cl/{component}_{input_telescope}_{pol}.json\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "d0421814", | |
"metadata": { | |
"papermill": { | |
"duration": null, | |
"end_time": null, | |
"exception": null, | |
"start_time": null, | |
"status": "pending" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"len(onecl)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "6ed3bd82", | |
"metadata": { | |
"papermill": { | |
"duration": null, | |
"end_time": null, | |
"exception": null, | |
"start_time": null, | |
"status": "pending" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "d7489e87", | |
"metadata": { | |
"papermill": { | |
"duration": null, | |
"end_time": null, | |
"exception": null, | |
"start_time": null, | |
"status": "pending" | |
}, | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"# Make sure the notebook is saved\n", | |
"\n", | |
"from ipylab import JupyterFrontEnd\n", | |
"\n", | |
"app = JupyterFrontEnd()\n", | |
"app.commands.execute(\"docmanager:save\")" | |
] | |
} | |
], | |
"metadata": { | |
"jupytext": { | |
"formats": "ipynb,py" | |
}, | |
"kernelspec": { | |
"display_name": "cmb", | |
"language": "python", | |
"name": "python3" | |
}, | |
"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.12.7" | |
}, | |
"papermill": { | |
"default_parameters": {}, | |
"duration": 9.804915, | |
"end_time": "2025-02-28T20:49:26.804652", | |
"environment_variables": {}, | |
"exception": true, | |
"input_path": "plot_cl.ipynb", | |
"output_path": "out_plot_cl_T.ipynb", | |
"parameters": { | |
"pol": "T" | |
}, | |
"start_time": "2025-02-28T20:49:16.999737", | |
"version": "2.6.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment