Point Source Response with Earth Occultation
This notebook requires downloading the following files from wasabi:
DC3_final_530km_3_month_with_slew_15sbins_GalacticEarth.fits (from DC3)
SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.h5 (from develop)
Additionally, you need test_earth_occ.fits, which is included in the same directory as this notebook.
[ ]:
# Imports
from cosipy.spacecraftfile import SpacecraftHistory
from cosipy.response import FullDetectorResponse
from cosipy.util import fetch_wasabi_file
import astropy.units as u
from astropy.coordinates import SkyCoord
import numpy as np
Load orientation file:
[ ]:
ori_file = "your/path/DC3_final_530km_3_month_with_slew_15sbins_GalacticEarth.fits"
ori = SpacecraftHistory.open(ori_file)
Define coordinate of source (Crab):
[ ]:
coord = SkyCoord(l=184.56*u.deg,b=-5.78*u.deg,frame="galactic")
Calculate scatt map for given coordinate:
[ ]:
scatt_map = ori.get_scatt_map(coord, nside = 16)
Calculate psr:
[ ]:
response_path = "your/path/"
response_file = response_path + "SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.h5"
with FullDetectorResponse.open(response_file) as response:
psr = response.get_point_source_response(coord = coord, scatt_map = scatt_map)
print("Works!")
Now let’s do a simple test:
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.
[ ]:
ori_file = "your/path/test_earth_occ.fits"
ori = SpacecraftHistory.open(ori_file)
[ ]:
coord = SkyCoord(l=0*u.deg,b=0*u.deg,frame="galactic")
[ ]:
scatt_map = ori.get_scatt_map(coord, nside = 16)
[ ]:
np.sum(scatt_map.weights)