Skip to content

Commit

Permalink
minor changes on the image deconvolution notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
hiyoneda committed Jan 31, 2024
1 parent 9cde63a commit a4742e2
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
"from matplotlib.gridspec import GridSpec \n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand All @@ -70,7 +72,7 @@
"From wasabi\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Responses/PointSourceReponse/psr_gal_511_DC2.h5.gz (please gunzip it)\n",
" - a pre-computed 511 keV line response file converted into the Galactic coordinate system\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months_unbinned_data.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\n",
" - In this notebook, only the albedo gamma-ray background is considered for a tutorial.\n",
" - If you want to consider all of the background components, please replace it with cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/total_bg_3months_unbinned_data.fits.gz\n",
Expand Down Expand Up @@ -102,9 +104,11 @@
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Responses/PointSourceReponse/psr_gal_511_DC2.h5.gz --endpoint-url=https://s3.us-west-1.wasabisys.com psr_gal_511_DC2.h5.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com 511_thin_disk_3months.fits.gz\")\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com 511_thin_disk_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com albedo_photons_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com albedo_photons_3months_unbinned_data.fits.gz\")"
"os.system('gunzip psr_gal_511_DC2.h5.gz')"
]
},
{
Expand Down Expand Up @@ -158,7 +162,7 @@
"source": [
"%%time\n",
"\n",
"signal_filepath = path_data + \"Data/Sources/511_thin_disk_3months.fits.gz\"\n",
"signal_filepath = path_data + \"511_thin_disk_3months_unbinned_data.fits.gz\"\n",
"\n",
"binned_signal = BinnedData(input_yaml = \"inputs_511keV_DC2.yaml\")\n",
"\n",
Expand Down Expand Up @@ -196,7 +200,7 @@
"source": [
"%%time\n",
"\n",
"bkg_filepath = path_data + \"Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\"\n",
"bkg_filepath = path_data + \"albedo_photons_3months_unbinned_data.fits.gz\"\n",
"\n",
"binned_bkg = BinnedData(input_yaml = \"inputs_511keV_DC2.yaml\")\n",
"\n",
Expand Down Expand Up @@ -323,7 +327,7 @@
"source": [
"%%time\n",
"\n",
"response_path = path_data + \"Responses/PointSourceResponse/psr_gal_511_DC2.h5\"\n",
"response_path = path_data + \"psr_gal_511_DC2.h5\"\n",
"\n",
"image_response = Histogram.open(response_path)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,9 @@
"import matplotlib.pyplot as plt\n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand All @@ -409,7 +411,7 @@
"\n",
"From wasabi\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Responses/SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months_unbinned_data.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\n",
" - In this notebook, only the albedo gamma-ray background is considered for a tutorial.\n",
" - If you want to consider all of the background components, please replace it with cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/total_bg_3months_unbinned_data.fits.gz\n",
Expand Down Expand Up @@ -459,7 +461,7 @@
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Responses/SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5 --endpoint-url=https://s3.us-west-1.wasabisys.com SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com 511_thin_disk_3months.fits.gz\")\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/511_thin_disk_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com 511_thin_disk_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com albedo_photons_3months_unbinned_data.fits.gz\")\n",
"\n",
Expand Down Expand Up @@ -504,7 +506,7 @@
"source": [
"%%time\n",
"\n",
"ori_filepath = path_data + \"Data/Orientation/20280301_3_month.ori\"\n",
"ori_filepath = path_data + \"20280301_3_month.ori\"\n",
"ori = SpacecraftFile.parse_from_file(ori_filepath)"
]
},
Expand All @@ -526,7 +528,7 @@
}
],
"source": [
"full_detector_response_filename = path_data + \"Responses/SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\"\n",
"full_detector_response_filename = path_data + \"SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\"\n",
"full_detector_response = FullDetectorResponse.open(full_detector_response_filename)\n",
"\n",
"nside_local = full_detector_response.nside\n",
Expand Down Expand Up @@ -1312,7 +1314,7 @@
"source": [
"%%time\n",
"\n",
"signal_filepath = path_data + \"Data/Sources/511_thin_disk_3months.fits.gz\"\n",
"signal_filepath = path_data + \"511_thin_disk_3months_unbinned_data.fits.gz\"\n",
"\n",
"unbinned_signal = UnBinnedData(input_yaml = \"inputs_511keV_DC2.yaml\")\n",
"\n",
Expand Down Expand Up @@ -1347,7 +1349,7 @@
"source": [
"%%time\n",
"\n",
"bkg_filepath = path_data + \"Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\"\n",
"bkg_filepath = path_data + \"albedo_photons_3months_unbinned_data.fits.gz\"\n",
"\n",
"unbinned_bkg = UnBinnedData(input_yaml = \"inputs_511keV_DC2.yaml\")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@
"from matplotlib.gridspec import GridSpec \n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -433,7 +435,7 @@
"metadata": {},
"outputs": [],
"source": [
"response_path = path_data + \"Responses/SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\"\n",
"response_path = path_data + \"SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\"\n",
"\n",
"response = FullDetectorResponse.open(response_path)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
"from matplotlib.gridspec import GridSpec \n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -148,7 +150,7 @@
"source": [
"%%time\n",
"\n",
"ori_filepath = path_data + \"Data/Orientation/20280301_3_month.ori\"\n",
"ori_filepath = path_data + \"20280301_3_month.ori\"\n",
"ori = SpacecraftFile.parse_from_file(ori_filepath)"
]
},
Expand All @@ -170,7 +172,7 @@
}
],
"source": [
"full_detector_response_filename = path_data + \"Responses/SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\"\n",
"full_detector_response_filename = path_data + \"SMEXv12.511keV.HEALPixO4.binnedimaging.imagingresponse.nonsparse_nside16.area.h5\"\n",
"full_detector_response = FullDetectorResponse.open(full_detector_response_filename)\n",
"\n",
"nside_local = full_detector_response.nside\n",
Expand Down Expand Up @@ -819,7 +821,7 @@
"source": [
"%%time\n",
"\n",
"signal_filepath = path_data + \"Data/Sources/511_thin_disk_3months.fits.gz\"\n",
"signal_filepath = path_data + \"511_thin_disk_3months_unbinned_data.fits.gz\"\n",
"\n",
"unbinned_signal = UnBinnedData(input_yaml = \"inputs_511keV_DC2.yaml\")\n",
"\n",
Expand All @@ -846,7 +848,7 @@
"source": [
"%%time\n",
"\n",
"bkg_filepath = path_data + \"Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\"\n",
"bkg_filepath = path_data + \"albedo_photons_3months_unbinned_data.fits.gz\"\n",
"\n",
"unbinned_bkg = UnBinnedData(input_yaml = \"inputs_511keV_DC2.yaml\")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
"from matplotlib.gridspec import GridSpec \n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand All @@ -70,7 +72,7 @@
"From wasabi\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Responses/PointSourceReponse/psr_gal_continuum_DC2.h5.zip (please unzip it)\n",
" - a pre-computed continuum response file converted into the Galactic coordinate system\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/crab_3months_unbinned_data.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/Crab_DC2_3months_unbinned_data.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\n",
" - In this notebook, only the albedo gamma-ray background is considered for a tutorial.\n",
" - If you want to consider all of the background components, please replace it with cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/total_bg_3months_unbinned_data.fits.gz\n",
Expand Down Expand Up @@ -103,9 +105,11 @@
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Responses/PointSourceReponse/psr_gal_continuum_DC2.h5.zip --endpoint-url=https://s3.us-west-1.wasabisys.com psr_gal_continuum_DC2.h5.zip\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/crab_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com crab_3months_unbinned_data.fits.gz\")\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/Crab_DC2_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com Crab_DC2_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com albedo_photons_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com albedo_photons_3months_unbinned_data.fits.gz\")"
"os.system(\"unzip psr_gal_continuum_DC2.h5.zip\")"
]
},
{
Expand Down Expand Up @@ -159,7 +163,7 @@
"source": [
"%%time\n",
"\n",
"signal_filepath = path_data + \"Data/Sources/crab_3months_unbinned_data.fits.gz\"\n",
"signal_filepath = path_data + \"Crab_DC2_3months_unbinned_data.fits.gz\"\n",
"\n",
"binned_signal = BinnedData(input_yaml = \"inputs_Crab_DC2.yaml\")\n",
"\n",
Expand Down Expand Up @@ -197,7 +201,7 @@
"source": [
"%%time\n",
"\n",
"bkg_filepath = path_data + \"Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\"\n",
"bkg_filepath = path_data + \"albedo_photons_3months_unbinned_data.fits.gz\"\n",
"\n",
"binned_bkg = BinnedData(input_yaml = \"inputs_Crab_DC2.yaml\")\n",
"\n",
Expand Down Expand Up @@ -324,7 +328,7 @@
"source": [
"%%time\n",
"\n",
"response_path = path_data + \"Responses/PointSourceResponse/psr_gal_continuum_DC2.h5\"\n",
"response_path = path_data + \"psr_gal_continuum_DC2.h5\"\n",
"\n",
"image_response = Histogram.open(response_path)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@
"import matplotlib.pyplot as plt\n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand All @@ -407,7 +409,7 @@
"\n",
"From wasabi\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Responses/SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5 (please unzip it)\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/crab_3months_unbinned_data.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Sources/Crab_DC2_3months_unbinned_data.fits.gz\n",
"- cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\n",
" - In this notebook, only the albedo gamma-ray background is considered for a tutorial.\n",
" - If you want to consider all of the background components, please replace it with cosi-pipeline-public/COSI-SMEX/DC2/Data/Backgrounds/total_bg_3months_unbinned_data.fits.gz\n",
Expand Down Expand Up @@ -439,11 +441,13 @@
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Responses/SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5.zip --endpoint-url=https://s3.us-west-1.wasabisys.com SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5.zip\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/crab_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com crab_3months_unbinned_data.fits.gz\")\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Sources/Crab_DC2_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com Crab_DC2_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz --endpoint-url=https://s3.us-west-1.wasabisys.com albedo_photons_3months_unbinned_data.fits.gz\")\n",
"\n",
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Orientation/20280301_3_month.ori --endpoint-url=https://s3.us-west-1.wasabisys.com 20280301_3_month.ori\")"
"os.system(header + \" --bucket cosi-pipeline-public --key COSI-SMEX/DC2/Data/Orientation/20280301_3_month.ori --endpoint-url=https://s3.us-west-1.wasabisys.com 20280301_3_month.ori\")\n",
"\n",
"os.system(\"unzip SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5.zip\")"
]
},
{
Expand Down Expand Up @@ -484,7 +488,7 @@
"source": [
"%%time\n",
"\n",
"ori_filepath = path_data + \"Data/Orientation/20280301_3_month.ori\"\n",
"ori_filepath = path_data + \"20280301_3_month.ori\"\n",
"ori = SpacecraftFile.parse_from_file(ori_filepath)"
]
},
Expand All @@ -506,7 +510,7 @@
}
],
"source": [
"full_detector_response_filename = path_data + \"Responses/SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n",
"full_detector_response_filename = path_data + \"SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n",
"full_detector_response = FullDetectorResponse.open(full_detector_response_filename)\n",
"\n",
"nside = full_detector_response.nside\n",
Expand Down Expand Up @@ -1288,7 +1292,7 @@
"source": [
"%%time\n",
"\n",
"signal_filepath = path_data + \"Data/Sources/crab_3months_unbinned_data.fits.gz\"\n",
"signal_filepath = path_data + \"Crab_DC2_3months_unbinned_data.fits.gz\"\n",
"\n",
"unbinned_signal = UnBinnedData(input_yaml = \"inputs_Crab_DC2.yaml\")\n",
"\n",
Expand Down Expand Up @@ -1323,7 +1327,7 @@
"source": [
"%%time\n",
"\n",
"bkg_filepath = path_data + \"Data/Backgrounds/albedo_photons_3months_unbinned_data.fits.gz\"\n",
"bkg_filepath = path_data + \"albedo_photons_3months_unbinned_data.fits.gz\"\n",
"\n",
"unbinned_bkg = UnBinnedData(input_yaml = \"inputs_Crab_DC2.yaml\")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@
"from matplotlib.gridspec import GridSpec \n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -446,7 +448,7 @@
"metadata": {},
"outputs": [],
"source": [
"response_path = path_data + \"Responses/SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n",
"response_path = path_data + \"SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n",
"\n",
"response = FullDetectorResponse.open(response_path)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
"from matplotlib.gridspec import GridSpec \n",
"\n",
"import healpy as hp\n",
"from tqdm.autonotebook import tqdm"
"from tqdm.autonotebook import tqdm\n",
"\n",
"%matplotlib inline"
]
},
{
Expand Down Expand Up @@ -152,7 +154,7 @@
"source": [
"%%time\n",
"\n",
"ori_filepath = path_data + \"Data/Orientation/20280301_3_month.ori\"\n",
"ori_filepath = path_data + \"20280301_3_month.ori\"\n",
"ori = SpacecraftFile.parse_from_file(ori_filepath)"
]
},
Expand All @@ -174,7 +176,7 @@
}
],
"source": [
"full_detector_response_filename = path_data + \"Responses/SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n",
"full_detector_response_filename = path_data + \"SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5\"\n",
"full_detector_response = FullDetectorResponse.open(full_detector_response_filename)\n",
"\n",
"nside_local = full_detector_response.nside\n",
Expand Down
Loading

0 comments on commit a4742e2

Please sign in to comment.