You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, track_overflow is set to True when generating an instance of PointSourceResponse. I think that track_overflow should always be False because the under/overflow bins will not be used in the response files.
Probably, we can simply add these lines in PointSourceResponse:
def __init__(self, *args, **kwargs):
"""
Initialize a PointSourceResponse object.
"""
# Not to track the under/overflow bins
kwargs['track_overflow'] = False
super().__init__(*args, **kwargs)
But when I tried this change and tested it, it caused errors in the unit test.
________________________________________________________ test_inject_point_source_saving ________________________________________________________
def test_inject_point_source_saving():
# defind the response and orientation
response_path = test_data.path / "test_precomputed_response.h5"
# powerlaw model
index = -2.2
K = 17 / u.cm / u.cm / u.s / u.keV
piv = 1 * u.keV
spectrum = Powerlaw()
spectrum.index.value = index
spectrum.K.value = K.value
spectrum.piv.value= piv.value
spectrum.K.unit = K.unit
spectrum.piv.unit = piv.unit
# Define an injector by the response
injector = SourceInjector(response_path = response_path, response_frame = "galactic")
# Define the coordinate of the point source
source_coord = SkyCoord(l = 50, b = -45, frame = "galactic", unit = "deg")
# Get the data of the injected source
> injected_crab_signal = injector.inject_point_source(spectrum = spectrum, coordinate = source_coord,
source_name = "point_source",
make_spectrum_plot = False, data_save_path = Path("./galactic_rsp.h5"),
project_axes = "Em")
tests/source_injector/test_source_injector.py:112:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cosipy/source_injector/source_injector.py:136: in inject_point_source
psr = SourceInjector.get_psr_in_galactic(coordinate = coordinate, response_path = self.response_path, spectrum = spectrum)
cosipy/source_injector/source_injector.py:81: in get_psr_in_galactic
psr = PointSourceResponse(axes[1:], f['hist/contents'][pix+1], unit = f['hist'].attrs['unit'])
cosipy/response/PointSourceResponse.py:41: in __init__
super().__init__(*args, **kwargs)
The text was updated successfully, but these errors were encountered:
Currently,
track_overflow
is set to True when generating an instance ofPointSourceResponse
. I think thattrack_overflow
should always beFalse
because the under/overflow bins will not be used in the response files.Probably, we can simply add these lines in
PointSourceResponse
:But when I tried this change and tested it, it caused errors in the unit test.
The text was updated successfully, but these errors were encountered: