-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/ckarwin/cosipy into develop
- Loading branch information
Showing
7 changed files
with
320 additions
and
12 deletions.
There are no files selected for viewing
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
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
Binary file not shown.
28 changes: 28 additions & 0 deletions
28
docs/tutorials/response/extended_source_response_generator.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
# coding: UTF-8 | ||
|
||
import sys | ||
import logging | ||
logger = logging.getLogger('cosipy') | ||
logger.setLevel(logging.INFO) | ||
logger.addHandler(logging.StreamHandler(sys.stdout)) | ||
|
||
from cosipy.spacecraftfile import SpacecraftFile | ||
from cosipy.response import FullDetectorResponse, ExtendedSourceResponse | ||
|
||
# file path | ||
full_detector_response_path = "SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5" | ||
orientation_path = "20280301_3_month_with_orbital_info.ori" | ||
|
||
# load response and orientation | ||
full_detector_response = FullDetectorResponse.open(full_detector_response_path) | ||
orientation = SpacecraftFile.parse_from_file(orientation_path) | ||
|
||
# generate your extended source response | ||
extended_source_response = full_detector_response.get_extended_source_response(orientation, | ||
coordsys='galactic', | ||
nside_scatt_map=None, | ||
Earth_occ=True) | ||
|
||
# save the extended source response | ||
extended_source_response.write("extended_source_response_continuum.h5", overwrite = True) |
39 changes: 39 additions & 0 deletions
39
docs/tutorials/response/extended_source_response_generator_with_multiple_nodes.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python | ||
# coding: UTF-8 | ||
|
||
import sys | ||
import logging | ||
logger = logging.getLogger('cosipy') | ||
logger.setLevel(logging.INFO) | ||
logger.addHandler(logging.StreamHandler(sys.stdout)) | ||
|
||
from cosipy.spacecraftfile import SpacecraftFile | ||
from cosipy.response import FullDetectorResponse, ExtendedSourceResponse | ||
|
||
# file path | ||
full_detector_response_path = "SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5" | ||
orientation_path = "20280301_3_month_with_orbital_info.ori" | ||
|
||
# load response and orientation | ||
full_detector_response = FullDetectorResponse.open(full_detector_response_path) | ||
orientation = SpacecraftFile.parse_from_file(orientation_path) | ||
|
||
# set the healpix pixel index list | ||
ipix_image_list = [int(_) for _ in sys.argv[1:]] | ||
|
||
print(ipix_image_list) | ||
|
||
# generate a point source response at each pixel | ||
basename = "psr/psr_" | ||
|
||
for ipix_image in ipix_image_list: | ||
|
||
psr = full_detector_response.get_point_source_response_per_image_pixel(ipix_image, orientation, | ||
coordsys='galactic', | ||
nside_image=None, | ||
nside_scatt_map=None, | ||
Earth_occ=True) | ||
|
||
psr.write(f"{basename}{ipix_image:08}.h5",overwrite = True) | ||
|
||
# see also merge_response_generated_with_mutiple_nodes.py to know how we can merge the above point source responses as a single extended source response. |
24 changes: 24 additions & 0 deletions
24
docs/tutorials/response/merge_response_generated_with_mutiple_nodes.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python | ||
# coding: UTF-8 | ||
|
||
import sys | ||
import logging | ||
logger = logging.getLogger('cosipy') | ||
logger.setLevel(logging.INFO) | ||
logger.addHandler(logging.StreamHandler(sys.stdout)) | ||
|
||
from cosipy.spacecraftfile import SpacecraftFile | ||
from cosipy.response import FullDetectorResponse, ExtendedSourceResponse | ||
|
||
# load full detector response | ||
full_detector_response_path = "SMEXv12.Continuum.HEALPixO3_10bins_log_flat.binnedimaging.imagingresponse.nonsparse_nside8.area.good_chunks_unzip.h5" | ||
full_detector_response = FullDetectorResponse.open(full_detector_response_path) | ||
|
||
# basename should be the same as one used before | ||
basename = "psr/psr_" | ||
|
||
# merge the point source responses | ||
extended_source_response = full_detector_response.merge_psr_to_extended_source_response(basename, coordsys = 'galactic', nside_image = None) | ||
|
||
# save the extended source response | ||
extended_source_response.write("extended_source_response_continuum_merged.h5", overwrite = True) |
Oops, something went wrong.