EBL#

import jetset
print('tested on jetset',jetset.__version__)
tested on jetset 1.3.0rc7
import warnings
warnings.filterwarnings('ignore')

EBL models#

import matplotlib.pyplot as plt
import numpy as np

EBL models are implemented using a 2D interpolation where the x and y axes represent the redshift and the frequency, and the z axes represents the value of \(e^{-\tau}\)

Included models are:

from jetset.template_2Dmodel import EBLAbsorptionTemplate
ebl_dominguez_2010=EBLAbsorptionTemplate.from_name('Dominguez_2010_v2011')
ebl_dominguez_lopez=EBLAbsorptionTemplate.from_name('Dominguez_2023')
ebl_finke=EBLAbsorptionTemplate.from_name('Finke_2010')
ebl_franceschini=EBLAbsorptionTemplate.from_name('Franceschini_2008')
z=0.1
nu=np.logspace(23,30,100)
ebl_dominguez_lopez.parameters.z_cosm.val=z
ebl_dominguez_lopez.eval(nu=nu)
ebl_finke.parameters.z_cosm.val=z
ebl_finke.eval(nu=nu)
ebl_franceschini.parameters.z_cosm.val=z
ebl_franceschini.eval(nu=nu)
p=ebl_dominguez_lopez.plot_model()
ebl_finke.plot_model(p)
ebl_franceschini.plot_model(p)
p.setlim(y_max=1,y_min=-10,x_max=29)
../../../../_images/EBL_9_0.png
plt.figure(dpi=150)

nu=1E26
z_range=np.linspace(0.001,1,100)
y_fr = np.zeros(z_range.size)
y_fi = np.zeros(z_range.size)
y_do = np.zeros(z_range.size)
for ID,z in enumerate(z_range):
    ebl_franceschini.parameters.z_cosm.val=z
    ebl_finke.parameters.z_cosm.val=z
    ebl_dominguez_lopez.parameters.z_cosm.val=z
    y_fr[ID]=ebl_franceschini.eval(nu=nu,get_model=True)[0]
    y_fi[ID]=ebl_finke.eval(nu=nu,get_model=True)[0]
    y_do[ID]=ebl_dominguez_lopez.eval(nu=nu,get_model=True)[0]


plt.plot(z_range,y_fr,label='%s'%ebl_franceschini.name)
plt.plot(z_range,y_fi,label='%s'%ebl_finke.name)
plt.plot(z_range,y_do,label='%s'%ebl_dominguez_lopez.name)

plt.xlabel('z')
plt.ylabel(r'$exp^{-\tau}$')
plt.legend()
plt.semilogy()
t=plt.title(r'$\nu=%1.1E Hz$'%nu)
../../../../_images/EBL_10_0.png
%matplotlib inline
z_range=np.linspace(0.001,1,100)
y_fr = np.zeros(z_range.size)
y_fi = np.zeros(z_range.size)
y_do = np.zeros(z_range.size)
nu=1E27
for ID,z in enumerate(z_range):
    ebl_franceschini.parameters.z_cosm.val=z
    ebl_finke.parameters.z_cosm.val=z
    ebl_dominguez_lopez.parameters.z_cosm.val=z
    y_fr[ID]=ebl_franceschini.eval(nu=nu,get_model=True)[0]
    y_fi[ID]=ebl_finke.eval(nu=nu,get_model=True)[0]
    y_do[ID]=ebl_dominguez_lopez.eval(nu=nu,get_model=True)[0]


plt.plot(z_range,y_fr,label='%s'%ebl_franceschini.name)
plt.plot(z_range,y_fi,label='%s'%ebl_finke.name)
plt.plot(z_range,y_do,label='%s'%ebl_dominguez_lopez.name)

plt.xlabel('z')
plt.ylabel(r'$exp^{-\tau}$')
plt.legend()
plt.semilogy()
t=plt.title(r'$\nu=%1.1E Hz$'%nu)
../../../../_images/EBL_11_0.png

Combine a Jet model with the EBL model#

To apply the EBL model to a Jet model we need to define a composite model, read the section Composite Models and depending pars for more information regarding the composite models.

We start by combining a Jet model with the EBL absorption model. Please, keep in mind that the EBL absorption model is a multiplicative model, i.e. it has to multiplied and not added to the Jet model.

As first step, we define our Jet model

from jetset.jet_model import Jet
from jetset.model_manager import FitModel

my_jet=Jet(electron_distribution='lppl',name='jet_leptonic')
===> setting C threads to 12

As second step, we define the EBL model, and we use in this case the Franceschini_2008 model

from jetset.template_2Dmodel import EBLAbsorptionTemplate
ebl_franceschini=EBLAbsorptionTemplate.from_name('Franceschini_2008')

As third step, we add the components models to the the FitModel class, using the FitModel.add_component() method

composite_model=FitModel(nu_size=500,name='EBL corrected')
composite_model.add_component(my_jet)
composite_model.add_component(ebl_franceschini)
composite_model.show_pars()
Table length=14
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_leptonicRregion_sizecm5.000000e+151.000000e+031.000000e+30FalseFalse
jet_leptonicR_Hregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_leptonicBmagnetic_fieldgauss1.000000e-010.000000e+00--FalseFalse
jet_leptonicNH_cold_to_rel_ecold_p_to_rel_e_ratio1.000000e+000.000000e+00--FalseTrue
jet_leptonicbeam_objbeaming1.000000e+011.000000e-04--FalseFalse
jet_leptonicz_cosmredshift1.000000e-010.000000e+00--FalseFalse
jet_leptonicgminlow-energy-cut-offlorentz-factor*2.000000e+001.000000e+001.000000e+09FalseFalse
jet_leptonicgmaxhigh-energy-cut-offlorentz-factor*1.000000e+061.000000e+001.000000e+15FalseFalse
jet_leptonicNemitters_density1 / cm31.000000e+020.000000e+00--FalseFalse
jet_leptonicgamma0_log_parabturn-over-energylorentz-factor*1.000000e+041.000000e+001.000000e+09FalseFalse
jet_leptonicsLE_spectral_slope2.000000e+00-1.000000e+011.000000e+01FalseFalse
jet_leptonicrspectral_curvature4.000000e-01-1.500000e+011.500000e+01FalseFalse
Franceschini_2008scale_factorscale_factor1.000000e+000.000000e+00--FalseTrue
Franceschini_2008z_cosmredshift1.000000e+000.000000e+00--FalseTrue

Important

Starting from version 1.2.0 we have changed the syntax of link_par, please update your scripts

Since, both the Jet model the EBL share the same parameter, i.e. the redshift, we link the two parameters

composite_model.link_par(par_name='z_cosm', from_model='Franceschini_2008', to_model='jet_leptonic')
adding par: z_cosm to  z_cosm
composite_model.show_pars()
Table length=14
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_leptonicRregion_sizecm5.000000e+151.000000e+031.000000e+30FalseFalse
jet_leptonicR_Hregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_leptonicBmagnetic_fieldgauss1.000000e-010.000000e+00--FalseFalse
jet_leptonicNH_cold_to_rel_ecold_p_to_rel_e_ratio1.000000e+000.000000e+00--FalseTrue
jet_leptonicbeam_objbeaming1.000000e+011.000000e-04--FalseFalse
jet_leptonicz_cosm(M)redshift1.000000e-010.000000e+00--FalseFalse
jet_leptonicgminlow-energy-cut-offlorentz-factor*2.000000e+001.000000e+001.000000e+09FalseFalse
jet_leptonicgmaxhigh-energy-cut-offlorentz-factor*1.000000e+061.000000e+001.000000e+15FalseFalse
jet_leptonicNemitters_density1 / cm31.000000e+020.000000e+00--FalseFalse
jet_leptonicgamma0_log_parabturn-over-energylorentz-factor*1.000000e+041.000000e+001.000000e+09FalseFalse
jet_leptonicsLE_spectral_slope2.000000e+00-1.000000e+011.000000e+01FalseFalse
jet_leptonicrspectral_curvature4.000000e-01-1.500000e+011.500000e+01FalseFalse
Franceschini_2008scale_factorscale_factor1.000000e+000.000000e+00--FalseTrue
Franceschini_2008z_cosm(L,jet_leptonic)redshift------FalseTrue

As you can see, now the parameter z_cosm in Franceschini_2008 is the linked paramter (flagge by the L in parenthesis), and the one belonging to the jet_flaring component is the master one (flagged by the M in parenthesis).

These methods are alternative ways to set a parameter in a composite model

composite_model.jet_leptonic.parameters.z_cosm.val=0.1
composite_model.set_par('jet_leptonic','z_cosm',0.1)
composite_model.set_par(my_jet,'z_cosm',0.1)

Since as default, added components are summed together, so we need to define the correct multiplicative for for the composite model.

composite_model.show_model_components()
--------------------------------------------------------------------------------
Composite model description
--------------------------------------------------------------------------------
name: EBL corrected
type: composite_model
components models:
 -model name: jet_leptonic model type: jet
 -model name: Franceschini_2008 model type: table2D

--------------------------------------------------------------------------------

This can be done just by writing the mathematical expression as a string, using the model names reported in the model description table, and that’s it!

composite_model.composite_expr='jet_leptonic*Franceschini_2008'
composite_model.jet_leptonic.IC_nu_size=150
composite_model.eval()
p=composite_model.plot_model()
p.setlim(y_max=1E-12)
../../../../_images/EBL_33_0.png

if you want to remove the link from the parameter

composite_model.parameters.reset_dependencies()
composite_model.parameters
Table length=14
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_leptonicRregion_sizecm5.000000e+151.000000e+031.000000e+30FalseFalse
jet_leptonicR_Hregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_leptonicBmagnetic_fieldgauss1.000000e-010.000000e+00--FalseFalse
jet_leptonicNH_cold_to_rel_ecold_p_to_rel_e_ratio1.000000e+000.000000e+00--FalseTrue
jet_leptonicbeam_objbeaming1.000000e+011.000000e-04--FalseFalse
jet_leptonicz_cosmredshift1.000000e-010.000000e+00--FalseFalse
jet_leptonicgminlow-energy-cut-offlorentz-factor*2.000000e+001.000000e+001.000000e+09FalseFalse
jet_leptonicgmaxhigh-energy-cut-offlorentz-factor*1.000000e+061.000000e+001.000000e+15FalseFalse
jet_leptonicNemitters_density1 / cm31.000000e+020.000000e+00--FalseFalse
jet_leptonicgamma0_log_parabturn-over-energylorentz-factor*1.000000e+041.000000e+001.000000e+09FalseFalse
jet_leptonicsLE_spectral_slope2.000000e+00-1.000000e+011.000000e+01FalseFalse
jet_leptonicrspectral_curvature4.000000e-01-1.500000e+011.500000e+01FalseFalse
Franceschini_2008scale_factorscale_factor1.000000e+000.000000e+00--FalseTrue
Franceschini_2008z_cosmredshift1.000000e-010.000000e+00--FalseTrue
None

now the two z_cosm parameters are not linkend anymore

Example of model fitting with EBL#

from jetset.test_data_helper import  test_SEDs
from jetset.data_loader import ObsData,Data
test_SEDs
['/Users/orion/miniforge3/envs/jetset/lib/python3.10/site-packages/jetset/test_data/SEDs_data/SED_3C345.ecsv',
 '/Users/orion/miniforge3/envs/jetset/lib/python3.10/site-packages/jetset/test_data/SEDs_data/SED_MW_Mrk421_EBL_DEABS.ecsv',
 '/Users/orion/miniforge3/envs/jetset/lib/python3.10/site-packages/jetset/test_data/SEDs_data/SED_MW_Mrk501_EBL_ABS.ecsv',
 '/Users/orion/miniforge3/envs/jetset/lib/python3.10/site-packages/jetset/test_data/SEDs_data/SED_MW_Mrk501_EBL_DEABS.ecsv']
%matplotlib inline
data=Data.from_file(test_SEDs[2])
sed_data=ObsData(data_table=data)
myPlot=sed_data.plot_sed()

sed_data.group_data(bin_width=0.2)
sed_data.add_systematics(0.1,[10.**6,10.**29])
myPlot.add_data_plot(sed_data,label='rebinned')
myPlot.setlim(y_min=1E-14,y_max=1E-9,x_min=1E9,x_max=1E29)
================================================================================

*  binning data  *
---> N bins= 90
---> bin_widht= 0.2
================================================================================
../../../../_images/EBL_41_1.png
from jetset.sed_shaper import  SEDShape
my_shape=SEDShape(sed_data)
my_shape.eval_indices(silent=True)
p=my_shape.plot_indices()
p.setlim(y_min=1E-15,y_max=1E-6)
================================================================================

* evaluating spectral indices for data *
================================================================================
../../../../_images/EBL_42_1.png
mm,best_fit=my_shape.sync_fit(check_host_gal_template=True,
                  Ep_start=None,
                  minimizer='lsb',
                  silent=True,
                  fit_range=[10,21])
================================================================================

* Log-Polynomial fitting of the synchrotron component *
---> first blind fit run,  fit range: [10, 21]
---> class:  HSP

---> class:  HSP
Table length=6
model namenamevalbestfit valerr +err -start valfit range minfit range maxfrozen
LogCubicb-6.522794e-02-6.522794e-025.892905e-03---4.913172e-02-1.000000e+010.000000e+00False
LogCubicc-1.908748e-03-1.908748e-038.488797e-04--5.440153e-03-1.000000e+011.000000e+01False
LogCubicEp1.704833e+011.704833e+016.858392e-02--1.593204e+010.000000e+003.000000e+01False
LogCubicSp-1.030052e+01-1.030052e+011.424853e-02---1.022242e+01-3.000000e+010.000000e+00False
host_galaxynuFnu_p_host-1.008538e+01-1.008538e+012.900917e-02---1.022242e+01-1.222242e+01-8.222416e+00False
host_galaxynu_scale1.934519e-021.934519e-021.919833e-03--0.000000e+00-5.000000e-015.000000e-01False
---> sync       nu_p=+1.704833e+01 (err=+6.858392e-02)  nuFnu_p=-1.030052e+01 (err=+1.424853e-02) curv.=-6.522794e-02 (err=+5.892905e-03)
================================================================================
my_shape.IC_fit(fit_range=[23,29],minimizer='minuit')
p=my_shape.plot_shape_fit()
p.setlim(y_min=1E-15)
================================================================================

* Log-Polynomial fitting of the IC component *
---> fit range: [23, 29]
---> LogCubic fit
====> simplex
====> migrad
====> simplex
====> migrad
====> simplex
====> migrad
-------------------------------------------------------------------------
Fit report

Model: IC-shape-fit
Table length=4
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
LogCubicbcurvature-1.569967e-01-1.000000e+010.000000e+00FalseFalse
LogCubiccthird-degree-4.422595e-02-1.000000e+011.000000e+01FalseFalse
LogCubicEppeak freqHz2.530691e+010.000000e+003.000000e+01TrueFalse
LogCubicSppeak fluxerg / (s cm2)-1.058920e+01-3.000000e+010.000000e+00TrueFalse
converged=True
calls=99
mesg=
Migrad
FCN = 2.768 Nfcn = 99
EDM = 1.26e-07 (Goal: 0.0002)
Valid Minimum No Parameters at limit
Below EDM threshold (goal x 10) Below call limit
Covariance Hesse ok Accurate Pos. def. Not forced
Name Value Hesse Error Minos Error- Minos Error+ Limit- Limit+ Fixed
0 par_0 -0.157 0.025 -10 0
1 par_1 -0.044 0.020 -10 10
2 par_2 25.31 0.18 0 30
3 par_3 -10.59 0.05 -30 0
dof=7
chisq=2.767806, chisq/red=0.395401 null hypothesis sig=0.905619

stats without the UL
dof  UL=7
chisq=2.767806, chisq/red=0.395401 null hypothesis sig=0.905619


best fit pars
Table length=4
model namenamevalbestfit valerr +err -start valfit range minfit range maxfrozen
LogCubicb-1.569967e-01-1.569967e-012.511269e-02---1.000000e+00-1.000000e+010.000000e+00False
LogCubicc-4.422595e-02-4.422595e-022.000320e-02---1.000000e+00-1.000000e+011.000000e+01False
LogCubicEp2.530691e+012.530691e+011.798034e-01--2.536233e+010.000000e+003.000000e+01False
LogCubicSp-1.058920e+01-1.058920e+014.983735e-02---1.000000e+01-3.000000e+010.000000e+00False
-------------------------------------------------------------------------
Table length=4
model namenamevalbestfit valerr +err -start valfit range minfit range maxfrozen
LogCubicb-1.569967e-01-1.569967e-012.511269e-02---1.000000e+00-1.000000e+010.000000e+00False
LogCubicc-4.422595e-02-4.422595e-022.000320e-02---1.000000e+00-1.000000e+011.000000e+01False
LogCubicEp2.530691e+012.530691e+011.798034e-01--2.536233e+010.000000e+003.000000e+01False
LogCubicSp-1.058920e+01-1.058920e+014.983735e-02---1.000000e+01-3.000000e+010.000000e+00False
---> IC         nu_p=+2.530691e+01 (err=+1.798034e-01)  nuFnu_p=-1.058920e+01 (err=+4.983735e-02) curv.=-1.569967e-01 (err=+2.511269e-02)
================================================================================
../../../../_images/EBL_44_9.png
from jetset.obs_constrain import ObsConstrain
from jetset.model_manager import  FitModel
sed_obspar=ObsConstrain(beaming=25,
                        B_range=[0.001,0.1],
                        distr_e='lppl',
                        t_var_sec=3*86400,
                        nu_cut_IR=1E11,
                        SEDShape=my_shape)


prefit_jet=sed_obspar.constrain_SSC_model(electron_distribution_log_values=False, silent=True)
prefit_jet.save_model('prefit_jet_gal_templ.pkl')
================================================================================

*  constrains parameters from observable *

===> setting C threads to 12
Table length=12
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_leptonicRregion_sizecm1.153993e+161.000000e+031.000000e+30FalseFalse
jet_leptonicR_Hregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_leptonicBmagnetic_fieldgauss5.050000e-020.000000e+00--FalseFalse
jet_leptonicNH_cold_to_rel_ecold_p_to_rel_e_ratio1.000000e+000.000000e+00--FalseTrue
jet_leptonicbeam_objbeaming2.500000e+011.000000e-04--FalseFalse
jet_leptonicz_cosmredshift3.360000e-020.000000e+00--FalseFalse
jet_leptonicgminlow-energy-cut-offlorentz-factor*1.487509e+021.000000e+001.000000e+09FalseFalse
jet_leptonicgmaxhigh-energy-cut-offlorentz-factor*2.310708e+061.000000e+001.000000e+15FalseFalse
jet_leptonicNemitters_density1 / cm32.237058e+010.000000e+00--FalseFalse
jet_leptonicgamma0_log_parabturn-over-energylorentz-factor*1.107634e+041.000000e+001.000000e+09FalseFalse
jet_leptonicsLE_spectral_slope2.248426e+00-1.000000e+011.000000e+01FalseFalse
jet_leptonicrspectral_curvature3.261397e-01-1.500000e+011.500000e+01FalseFalse
================================================================================
composite_model=FitModel(nu_size=500,name='EBL corrected',template=my_shape.host_gal)
composite_model.add_component(prefit_jet)
composite_model.eval()
composite_model.plot_model()
<jetset.plot_sedfit.PlotSED at 0x15814ceb0>
../../../../_images/EBL_46_1.png
from jetset.template_2Dmodel import EBLAbsorptionTemplate
ebl_franceschini=EBLAbsorptionTemplate.from_name('Franceschini_2008')
composite_model.add_component(ebl_franceschini)
composite_model.link_par(par_name='z_cosm', from_model='Franceschini_2008', to_model='jet_leptonic')
composite_model.composite_expr='(jet_leptonic+host_galaxy)*Franceschini_2008'
adding par: z_cosm to  z_cosm
composite_model.show_model()
--------------------------------------------------------------------------------
Composite model description
--------------------------------------------------------------------------------
name: EBL corrected
type: composite_model
components models:
 -model name: host_galaxy model type: template
 -model name: jet_leptonic model type: jet
 -model name: Franceschini_2008 model type: table2D

--------------------------------------------------------------------------------
individual component description

--------------------------------------------------------------------------------
model description
--------------------------------------------------------------------------------
name: host_galaxy
type: template

--------------------------------------------------------------------------------
Table length=2
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
host_galaxynuFnu_p_hostnuFnu-scaleerg / (s cm2)-1.008538e+01-2.000000e+012.000000e+01FalseFalse
host_galaxynu_scalenu-scaleHz1.934519e-02-2.000000e+002.000000e+00FalseFalse
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
model description:
--------------------------------------------------------------------------------
type: Jet
name: jet_leptonic
geometry: spherical

electrons distribution:
 type: lppl
 gamma energy grid size:  201
 gmin grid : 1.487509e+02
 gmax grid : 2.310708e+06
 normalization:  True
 log-values:  False
 ratio of cold protons to relativistic electrons: 1.000000e+00

radiative fields:
 seed photons grid size:  100
 IC emission grid size:  100
 source emissivity lower bound :  1.000000e-120
 spectral components:
   name:Sum, state: on
   name:Sum, hidden: False
   name:Sync, state: self-abs
   name:Sync, hidden: False
   name:SSC, state: on
   name:SSC, hidden: False
external fields transformation method: blob

SED info:
 nu grid size jetkernel: 1000
 nu size: 500
 nu mix (Hz): 1.000000e+06
 nu max (Hz): 1.000000e+30

flux plot lower bound   :  1.000000e-30

--------------------------------------------------------------------------------
Table length=12
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_leptonicRregion_sizecm1.153993e+161.000000e+031.000000e+30FalseFalse
jet_leptonicR_Hregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_leptonicBmagnetic_fieldgauss5.050000e-020.000000e+00--FalseFalse
jet_leptonicNH_cold_to_rel_ecold_p_to_rel_e_ratio1.000000e+000.000000e+00--FalseTrue
jet_leptonicbeam_objbeaming2.500000e+011.000000e-04--FalseFalse
jet_leptonicz_cosm(M)redshift3.360000e-020.000000e+00--FalseFalse
jet_leptonicgminlow-energy-cut-offlorentz-factor*1.487509e+021.000000e+001.000000e+09FalseFalse
jet_leptonicgmaxhigh-energy-cut-offlorentz-factor*2.310708e+061.000000e+001.000000e+15FalseFalse
jet_leptonicNemitters_density1 / cm32.237058e+010.000000e+00--FalseFalse
jet_leptonicgamma0_log_parabturn-over-energylorentz-factor*1.107634e+041.000000e+001.000000e+09FalseFalse
jet_leptonicsLE_spectral_slope2.248426e+00-1.000000e+011.000000e+01FalseFalse
jet_leptonicrspectral_curvature3.261397e-01-1.500000e+011.500000e+01FalseFalse
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
model description
--------------------------------------------------------------------------------
name: Franceschini_2008
type: table2D

--------------------------------------------------------------------------------
Table length=2
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
Franceschini_2008scale_factorscale_factor1.000000e+000.000000e+00--FalseTrue
Franceschini_2008z_cosm(L,jet_leptonic)redshift------FalseTrue
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
composite_model.eval()
composite_model.plot_model()
<jetset.plot_sedfit.PlotSED at 0x158b22500>
../../../../_images/EBL_50_1.png
from jetset.minimizer import ModelMinimizer
from jetset.model_manager import  FitModel
from jetset.jet_model import Jet



composite_model.freeze(prefit_jet,'z_cosm')
composite_model.freeze(prefit_jet,'R_H')
composite_model.jet_leptonic.parameters.beam_obj.fit_range=[5,50]
composite_model.jet_leptonic.parameters.R.fit_range=[10**15.5,10**17.5]
composite_model.jet_leptonic.parameters.gmax.fit_range=[1E4,1E8]
composite_model.jet_leptonic.parameters.z_cosm.val=0.03


composite_model.host_galaxy.parameters.nuFnu_p_host.frozen=False
composite_model.host_galaxy.parameters.nu_scale.frozen=True
composite_model.jet_leptonic.nu_size=200
composite_model.jet_leptonic.IC_nu_size=100
model_minimizer_lsb=ModelMinimizer('lsb')
best_fit=model_minimizer_lsb.fit(composite_model,sed_data,1E11,1E29,fitname='SSC-best-fit-lsb',repeat=3)
filtering data in fit range = [1.000000e+11,1.000000e+29]
data length 31
================================================================================

* start fit process *
-----
fit run: 0
0it [00:00, ?it/s]
- best chisq=1.05075e+01

fit run: 1
- old chisq=1.05075e+01
0it [00:00, ?it/s]
- best chisq=1.03861e+01

fit run: 2
- old chisq=1.03861e+01
0it [00:00, ?it/s]
- best chisq=1.03473e+01

-------------------------------------------------------------------------
Fit report

Model: SSC-best-fit-lsb
Table length=16
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
host_galaxynuFnu_p_hostnuFnu-scaleerg / (s cm2)-1.008256e+01-2.000000e+012.000000e+01FalseFalse
host_galaxynu_scalenu-scaleHz1.934519e-02-2.000000e+002.000000e+00FalseTrue
jet_leptonicRregion_sizecm1.126068e+161.000000e+031.000000e+30FalseFalse
jet_leptonicR_Hregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_leptonicBmagnetic_fieldgauss1.449834e-020.000000e+00--FalseFalse
jet_leptonicNH_cold_to_rel_ecold_p_to_rel_e_ratio1.000000e+000.000000e+00--FalseTrue
jet_leptonicbeam_objbeaming4.382890e+011.000000e-04--FalseFalse
jet_leptonicz_cosm(M)redshift3.000000e-020.000000e+00--FalseTrue
jet_leptonicgminlow-energy-cut-offlorentz-factor*1.304507e+021.000000e+001.000000e+09FalseFalse
jet_leptonicgmaxhigh-energy-cut-offlorentz-factor*1.905419e+061.000000e+001.000000e+15FalseFalse
jet_leptonicNemitters_density1 / cm31.978842e+010.000000e+00--FalseFalse
jet_leptonicgamma0_log_parabturn-over-energylorentz-factor*5.056404e+031.000000e+001.000000e+09FalseFalse
jet_leptonicsLE_spectral_slope2.170379e+00-1.000000e+011.000000e+01FalseFalse
jet_leptonicrspectral_curvature2.277509e-01-1.500000e+011.500000e+01FalseFalse
Franceschini_2008scale_factorscale_factor1.000000e+000.000000e+00--FalseTrue
Franceschini_2008z_cosm(L,jet_leptonic)redshift------FalseTrue
converged=True
calls=326
mesg=
'ftol termination condition is satisfied.'
dof=21
chisq=10.347315, chisq/red=0.492729 null hypothesis sig=0.974041

best fit pars
Table length=16
model namenamevalbestfit valerr +err -start valfit range minfit range maxfrozen
host_galaxynuFnu_p_host-1.008256e+01-1.008256e+011.788949e-02---1.008538e+01-1.222242e+01-8.222416e+00False
host_galaxynu_scale1.934519e-02------1.934519e-02-5.000000e-015.000000e-01True
jet_leptonicR1.126068e+161.126068e+161.680987e+16--1.153993e+163.162278e+153.162278e+17False
jet_leptonicR_H1.000000e+17------1.000000e+170.000000e+00--True
jet_leptonicB1.449834e-021.449834e-021.028970e-02--5.050000e-020.000000e+00--False
jet_leptonicNH_cold_to_rel_e1.000000e+00------1.000000e+000.000000e+00--True
jet_leptonicbeam_obj4.382890e+014.382890e+011.999181e+01--2.500000e+015.000000e+005.000000e+01False
jet_leptonicz_cosm(M)3.000000e-02------3.000000e-020.000000e+00--True
jet_leptonicgmin1.304507e+021.304507e+021.659813e+02--1.487509e+021.000000e+001.000000e+09False
jet_leptonicgmax1.905419e+061.905419e+061.052149e+06--2.310708e+061.000000e+041.000000e+08False
jet_leptonicN1.978842e+011.978842e+016.026864e+01--2.237058e+010.000000e+00--False
jet_leptonicgamma0_log_parab5.056404e+035.056404e+032.100881e+03--1.107634e+041.000000e+001.000000e+09False
jet_leptonics2.170379e+002.170379e+003.289732e-02--2.248426e+00-1.000000e+011.000000e+01False
jet_leptonicr2.277509e-012.277509e-011.739429e-02--3.261397e-01-1.500000e+011.500000e+01False
Franceschini_2008scale_factor1.000000e+00------1.000000e+000.000000e+00--True
Franceschini_2008z_cosm(L,jet_leptonic)3.000000e-02--------0.000000e+00--True
-------------------------------------------------------------------------

================================================================================
composite_model.nu_min=1E8
composite_model.jet_leptonic.nu_min=1E8
composite_model.eval()
p=composite_model.plot_model(sed_data=sed_data)
../../../../_images/EBL_52_0.png