Currently, SourceInjector accepts all the inputs to initialize a FullDetectorResponse:
|
Parameters |
|
---------- |
|
response : str or pathlib.Path |
|
The path to the response file |
|
response_frame : str, optional |
|
The frame of the Compton data space (CDS) of the |
|
response. It only accepts `spacecraftframe` or |
|
"galactic". (the default is `spacecraftframe`, which means |
|
the CDS is in the detector frame.) |
|
pa_convention : str, optional |
|
Polarization angle convention for polarization-enabled |
|
detector-frame responses. Must be one of ('RelativeX', |
|
'RelativeY', 'RelativeZ') when the response includes a |
|
`Pol` axis and `response_frame="spacecraftframe"`. |
At first order, SourceInjector should accept a FullDetectorResponse object instead, to avoid opening multiple time.
However, now that we have the interfaces refactoring, we can go further and accept a generic ThreeMLModelFoldingInterface, and use it to convolve a generic model:
|
@runtime_checkable |
|
class ThreeMLModelFoldingInterface(Protocol): |
|
def set_model(self, model: Model): |
|
""" |
|
The model is passed as a reference and it's parameters |
|
can change. Remember to check if it changed since the |
|
last time the user called expectation. |
|
""" |
|
|
|
@runtime_checkable |
|
class UnbinnedThreeMLModelFoldingInterface(ThreeMLModelFoldingInterface, ExpectationDensityInterface, Protocol): |
|
""" |
|
No new methods. Just the inherited ones. |
|
""" |
|
|
|
@runtime_checkable |
|
class BinnedThreeMLModelFoldingInterface(ThreeMLModelFoldingInterface, BinnedExpectationInterface, Protocol): |
|
""" |
|
No new methods. Just the inherited ones. |
|
""" |
Out current standard implementation of this interface is BinnedThreeMLPointSourceResponse. You can see an usage example in the Crab fit tutorial.
This is also related to #499: if the user passes a UnbinnedThreeMLModelFoldingInterface, we can inject event data right from the same class.
Currently,
SourceInjectoraccepts all the inputs to initialize aFullDetectorResponse:cosipy/cosipy/source_injector/source_injector.py
Lines 19 to 32 in 266e133
At first order,
SourceInjectorshould accept aFullDetectorResponseobject instead, to avoid opening multiple time.However, now that we have the interfaces refactoring, we can go further and accept a generic
ThreeMLModelFoldingInterface, and use it to convolve a generic model:cosipy/cosipy/interfaces/source_response_interface.py
Lines 16 to 35 in ae814f6
Out current standard implementation of this interface is
BinnedThreeMLPointSourceResponse. You can see an usage example in the Crab fit tutorial.This is also related to #499: if the user passes a
UnbinnedThreeMLModelFoldingInterface, we can inject event data right from the same class.