-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General restructuring of the SED for their usage as fittable models #52
Conversation
…rapz_loglog failing for PS behind the jet
…s against each other
…ntegration General restructuring of the SED for their usage as fittable models (Sourcery refactored)
Codecov Report
@@ Coverage Diff @@
## master #52 +/- ##
==========================================
+ Coverage 90.90% 93.99% +3.08%
==========================================
Files 16 30 +14
Lines 1462 1681 +219
==========================================
+ Hits 1329 1580 +251
+ Misses 133 101 -32
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@jsitarek I apologise if this breaks the changes you were doing to check the absorption. Let me know what do you think of the handling of the fitting procedure, as you can see in the notebook I mentioned above it takes few lines to define a |
This PR implements many internal changes aimed at creating functions suited to be passed to a fitting procedure.
staticmethod
s for each of the radiative processes such that the SED can be computed changing all the parameters together.The problem was this: if we wanted to fit an external Compton SED with the previous version of the code,
half of the parameters were contained in the
Blob
instance, the other half in thetarget
instance.Therefore a fitting procedure would have needed to access the objects individually, change them, and redefine the
ExternalCompton
class with them.Now everything can be done within a single function containing all the parameters of the model, e.g.
for the Synchrotron radiation
for the SSC.
You can find in
experiments/basic/sherpa_fitting_ssc_trial.ipynb
an example of how I plugged these new functions insherpa
to create a fittable model. The fit is not decent but I did not play that much with the parameters!I just wanted to be sure that the
agnpy
model could be coupled tosherpa
.Of course the high-level function
sed_flux(nu)
has remained the same.I introduced a new integration procedure half-copied from
naima
.It is an implementation of the trapezoidal rule in log-space. Each slice of the function is interpolated with a power-law rather than with a straight line. It is slightly more precise of the trapezoidal rule in linear space. Both for the spectra and for the radiative processes one can choose whether to use the trapezoidal rule in log-log space or the normal one when integrating through the
integrator
argument.Here a comparison of the SED for EC on Disk computed with both the integration methods.
I added some functionalities in
utils
that we often use (conversion, geometric computation, plotting routines).The only major change in the API is this: it is not needed anymore to pass the Synchrotron object to the SynchrotronSelfCompton class. It was just redundant.
SynchrotronSelfCompton(blob, synchro)
is now justSynchrotronSelfCompton(blob)
I updated the docs accordingly.
I marked this modifications as 0.0.7.9, If anyone wants to try it, please do it.
We can make the 0.0.8 release in few days.