{ "cells": [ { "cell_type": "markdown", "id": "30f0be8e-fcf6-48dd-b1ce-471518cbd421", "metadata": {}, "source": [ "# Point Source Response with Earth Occultation\n", "\n", "This notebook requires downloading the following files from wasabi:\n", "\n", "1) DC3_final_530km_3_month_with_slew_15sbins_GalacticEarth.ori (from DC3)\n", "\n", "2) SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5 (from DC2)\n", "\n", "Additionally, you need test_earth_occ.ori, which is included in the same directory as this notebook. " ] }, { "cell_type": "code", "execution_count": 1, "id": "1b5af751-2243-4366-8be8-14e1091cf71a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
16:35:19 WARNING   The naima package is not available. Models that depend on it will not be         functions.py:48\n",
       "                  available                                                                                        \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:19\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m The naima package is not available. Models that depend on it will not be \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=781318;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/astromodels/functions/functions_1D/functions.py\u001b\\\u001b[2mfunctions.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=239732;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/astromodels/functions/functions_1D/functions.py#48\u001b\\\u001b[2m48\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mavailable \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   The GSL library or the pygsl wrapper cannot be loaded. Models that depend on it  functions.py:69\n",
       "                  will not be available.                                                                           \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m The GSL library or the pygsl wrapper cannot be loaded. Models that depend on it \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=157611;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/astromodels/functions/functions_1D/functions.py\u001b\\\u001b[2mfunctions.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=426238;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/astromodels/functions/functions_1D/functions.py#69\u001b\\\u001b[2m69\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mwill not be available. \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:20 WARNING   The ebltable package is not available. Models that depend on it will not be     absorption.py:33\n",
       "                  available                                                                                        \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:20\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m The ebltable package is not available. Models that depend on it will not be \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=421755;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/astromodels/functions/functions_1D/absorption.py\u001b\\\u001b[2mabsorption.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=212297;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/astromodels/functions/functions_1D/absorption.py#33\u001b\\\u001b[2m33\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mavailable \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:21 INFO      Starting 3ML!                                                                     __init__.py:39\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:21\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;49mINFO \u001b[0m \u001b[1;38;5;251m Starting 3ML! \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=837874;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=231355;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#39\u001b\\\u001b[2m39\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   WARNINGs here are NOT errors                                                      __init__.py:40\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m WARNINGs here are \u001b[0m\u001b[1;31mNOT\u001b[0m\u001b[1;38;5;251m errors \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=586991;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=166378;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#40\u001b\\\u001b[2m40\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   but are inform you about optional packages that can be installed                  __init__.py:41\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m but are inform you about optional packages that can be installed \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=993822;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=55460;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#41\u001b\\\u001b[2m41\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING    to disable these messages, turn off start_warning in your config file            __init__.py:44\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m \u001b[0m\u001b[1;31m to disable these messages, turn off start_warning in your config file\u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=306104;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=60446;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#44\u001b\\\u001b[2m44\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   no display variable set. using backend for graphics without display (agg)         __init__.py:50\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m no display variable set. using backend for graphics without display \u001b[0m\u001b[1;38;5;251m(\u001b[0m\u001b[1;38;5;251magg\u001b[0m\u001b[1;38;5;251m)\u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=314483;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=491477;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#50\u001b\\\u001b[2m50\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:22 WARNING   ROOT minimizer not available                                                minimization.py:1345\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:22\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m ROOT minimizer not available \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=528503;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/minimizer/minimization.py\u001b\\\u001b[2mminimization.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=660971;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/minimizer/minimization.py#1345\u001b\\\u001b[2m1345\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   Multinest minimizer not available                                           minimization.py:1357\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m Multinest minimizer not available \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=555187;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/minimizer/minimization.py\u001b\\\u001b[2mminimization.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=914070;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/minimizer/minimization.py#1357\u001b\\\u001b[2m1357\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   PyGMO is not available                                                      minimization.py:1369\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m PyGMO is not available \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=853175;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/minimizer/minimization.py\u001b\\\u001b[2mminimization.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=263289;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/minimizer/minimization.py#1369\u001b\\\u001b[2m1369\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:23 WARNING   The cthreeML package is not installed. You will not be able to use plugins which  __init__.py:94\n",
       "                  require the C/C++ interface (currently HAWC)                                                     \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:23\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m The cthreeML package is not installed. You will not be able to use plugins which \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=195766;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=807920;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#94\u001b\\\u001b[2m94\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mrequire the C/C++ interface \u001b[0m\u001b[1;38;5;251m(\u001b[0m\u001b[1;38;5;251mcurrently HAWC\u001b[0m\u001b[1;38;5;251m)\u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   Could not import plugin FermiLATLike.py. Do you have the relative instrument     __init__.py:144\n",
       "                  software installed and configured?                                                               \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m Could not import plugin FermiLATLike.py. Do you have the relative instrument \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=393727;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=458256;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#144\u001b\\\u001b[2m144\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251msoftware installed and configured? \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:24 WARNING   Could not import plugin HAWCLike.py. Do you have the relative instrument         __init__.py:144\n",
       "                  software installed and configured?                                                               \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:24\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m Could not import plugin HAWCLike.py. Do you have the relative instrument \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=745007;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=898798;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#144\u001b\\\u001b[2m144\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251msoftware installed and configured? \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:26 WARNING   No fermitools installed                                              lat_transient_builder.py:44\n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:26\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m No fermitools installed \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=688121;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/utils/data_builders/fermi/lat_transient_builder.py\u001b\\\u001b[2mlat_transient_builder.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=962685;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/utils/data_builders/fermi/lat_transient_builder.py#44\u001b\\\u001b[2m44\u001b[0m\u001b]8;;\u001b\\\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
16:35:26 WARNING   Env. variable OMP_NUM_THREADS is not set. Please set it to 1 for optimal         __init__.py:387\n",
       "                  performances in 3ML                                                                              \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m16:35:26\u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m Env. variable OMP_NUM_THREADS is not set. Please set it to \u001b[0m\u001b[1;37m1\u001b[0m\u001b[1;38;5;251m for optimal \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=971080;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=965278;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#387\u001b\\\u001b[2m387\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mperformances in 3ML \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   Env. variable MKL_NUM_THREADS is not set. Please set it to 1 for optimal         __init__.py:387\n",
       "                  performances in 3ML                                                                              \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m Env. variable MKL_NUM_THREADS is not set. Please set it to \u001b[0m\u001b[1;37m1\u001b[0m\u001b[1;38;5;251m for optimal \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=329486;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=890782;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#387\u001b\\\u001b[2m387\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mperformances in 3ML \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
         WARNING   Env. variable NUMEXPR_NUM_THREADS is not set. Please set it to 1 for optimal     __init__.py:387\n",
       "                  performances in 3ML                                                                              \n",
       "
\n" ], "text/plain": [ "\u001b[38;5;46m \u001b[0m\u001b[38;5;46m \u001b[0m\u001b[38;5;134mWARNING \u001b[0m \u001b[1;38;5;251m Env. variable NUMEXPR_NUM_THREADS is not set. Please set it to \u001b[0m\u001b[1;37m1\u001b[0m\u001b[1;38;5;251m for optimal \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b]8;id=85779;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py\u001b\\\u001b[2m__init__.py\u001b[0m\u001b]8;;\u001b\\\u001b[2m:\u001b[0m\u001b]8;id=583251;file:///discover/nobackup/ckarwin/Software/COSIPY/lib/python3.10/site-packages/threeML/__init__.py#387\u001b\\\u001b[2m387\u001b[0m\u001b]8;;\u001b\\\n", "\u001b[38;5;46m \u001b[0m \u001b[1;38;5;251mperformances in 3ML \u001b[0m\u001b[1;38;5;251m \u001b[0m\u001b[2m \u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Imports\n", "from cosipy.spacecraftfile import SpacecraftFile\n", "from cosipy.response import FullDetectorResponse\n", "from cosipy.util import fetch_wasabi_file\n", "import astropy.units as u\n", "from astropy.coordinates import SkyCoord\n", "import numpy as np" ] }, { "cell_type": "markdown", "id": "120eeb60-7f17-4e97-83df-45b2f7aea854", "metadata": {}, "source": [ "Load orientation file:" ] }, { "cell_type": "code", "execution_count": 4, "id": "064aad90-a5b4-4fb7-9a36-a7bd43f95db7", "metadata": {}, "outputs": [], "source": [ "ori_file = \"your/path/DC3_final_530km_3_month_with_slew_15sbins_GalacticEarth.ori\"\n", "ori = SpacecraftFile.parse_from_file(ori_file)" ] }, { "cell_type": "markdown", "id": "55314d24-d738-45e6-9f09-4035ad18ea76", "metadata": {}, "source": [ "Define coordinate of source (Crab):" ] }, { "cell_type": "code", "execution_count": 5, "id": "59969bd5-5a3d-456f-a534-43a175781c3d", "metadata": {}, "outputs": [], "source": [ "coord = SkyCoord(l=184.56*u.deg,b=-5.78*u.deg,frame=\"galactic\")" ] }, { "cell_type": "markdown", "id": "3cbaa450-2719-4abc-83bf-eedccea347be", "metadata": {}, "source": [ "Calculate scatt map for given coordinate:" ] }, { "cell_type": "code", "execution_count": 7, "id": "8e89f3f9-aa47-47c6-acbb-a2fd1537cc53", "metadata": {}, "outputs": [], "source": [ "scatt_map = ori.get_scatt_map(coord, nside = 16, coordsys = 'galactic')" ] }, { "cell_type": "markdown", "id": "e2c4ccf0-7543-4980-8256-3876cc454b5c", "metadata": {}, "source": [ "Calculate psr:" ] }, { "cell_type": "code", "execution_count": 8, "id": "fe07ffb2-e7c0-423b-894c-b3c161d3464a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Works!\n" ] } ], "source": [ "response_path = \"your/path/\"\n", "response_file = response_path + \"SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n", "with FullDetectorResponse.open(response_file) as response:\n", " psr = response.get_point_source_response(coord = coord, scatt_map = scatt_map)\n", "print(\"Works!\") " ] }, { "cell_type": "markdown", "id": "75e50ee7-8f24-47f8-8c2a-7e99fa722891", "metadata": {}, "source": [ "### Now let's do a simple test:\n", "Load test orientation file: the z-axis of the instrument points to the Galactic center for 30 seconds. For the first 15 seconds, the instrument is in front of Earth, and then for the last 15.1 seconds the instrument is behind Earth. This should be reflected in the scatt map." ] }, { "cell_type": "code", "execution_count": 9, "id": "6d14166f-887b-4097-bf62-cbc84cca0502", "metadata": {}, "outputs": [], "source": [ "ori_file = \"your/path/test_earth_occ.ori\"\n", "ori = SpacecraftFile.parse_from_file(ori_file)" ] }, { "cell_type": "code", "execution_count": 10, "id": "99efa500-4018-4fdb-9793-363a192cff81", "metadata": {}, "outputs": [], "source": [ "coord = SkyCoord(l=0*u.deg,b=0*u.deg,frame=\"galactic\")" ] }, { "cell_type": "code", "execution_count": 11, "id": "9303a803-bc70-46b6-a0c3-6684e12ce2c5", "metadata": {}, "outputs": [], "source": [ "scatt_map = ori.get_scatt_map(coord, nside = 16, coordsys = 'galactic')" ] }, { "cell_type": "code", "execution_count": 12, "id": "60b0962f-ab6a-4155-be56-fd1e510b5ed0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "15.099999904632568" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.sum(scatt_map.contents.todense())" ] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:COSIPY]", "language": "python", "name": "conda-env-COSIPY-py" }, "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.15" } }, "nbformat": 4, "nbformat_minor": 5 }