cosimoNigro / agnpy

Modelling jetted Active Galactic Nuclei radiative processes with python
https://agnpy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
48 stars 33 forks source link

Fitting of a MWL BL Lac SED: Fit doesn't converge. #147

Closed maitreyakun closed 1 year ago

maitreyakun commented 1 year ago

I am trying to fit a MWL SED of the source BL Lacertae using agnpy. I prepared my source-file - with frequency [eV], fluxes [erg / cm^2], and positive & negative flux-errors [erg / cm^2] - as an .ecsv file, following the format prescribed in the given sample MWL SED Data files (e.g., Mrk 421).

However, when I run agnpy.fit (with the gammapy wrapper and SynchrotronSelfComptonModel), I get the following error when I try to plot the SED first: 'xerr' must not contain negative values

It seems xerr means something like the error in the frequency; however, I had not specified any error there so far (the only error column in the datafile comes from fluxes - this is also the case for the given MWL SEDs), so I don't get where this error could be coming from.

Additionally, if I try to fit with minuit, the fit does not converge, giving the following output:

OptimizeResult

    backend    : minuit
    method     : migrad
    success    : False
    message    : Optimization failed. Call limit was reached.
    nfev       : 1092
    total stat : 6015.77

CovarianceResult

    backend    : minuit
    method     : hesse
    success    : True
    message    : Hesse terminated successfully.

What may be causing these issues, and how can I resolve them? I can provide the .ecsv source-file, if needed.

cosimoNigro commented 1 year ago

Hello @maitreyakun, I am very sorry for the late reply. As this seems an issue related to a particular dataset, and not to the code itself, do you mind if we discuss it on the agnpy slack. You can write in the #help channel or directly to me. Here the invitation to join slack. https://join.slack.com/t/agnpy/shared_invite/zt-1fum4zrt1-eETF1HsN_HAkF_Fxag0AFg