Example #1
0
B = 1 * u.G
z = Distance(1e27, unit=u.cm).z
delta_D = 10
Gamma = 10

for spectrum_dict in (spectrum_dict_pwl, spectrum_dict_bpl, spectrum_dict_bpl_2):
    for norm_type in ("integral", "differential", "gamma=1"):
        blob = Blob(
            R_b,
            z,
            delta_D,
            Gamma,
            B,
            spectrum_norm,
            spectrum_dict,
            spectrum_norm_type=norm_type,
        )
        blob.plot_n_e()

# let us trigger the error
blob = Blob(
    R_b,
    z,
    delta_D,
    Gamma,
    B,
    1e48 * u.Unit("erg"),
    spectrum_dict_bpl_2,
    spectrum_norm_type="gamma=1",
)
Example #2
0
from astropy.coordinates import Distance
from agnpy.emission_regions import Blob
import matplotlib.pyplot as plt
from agnpy.utils.plot import load_mpl_rc

# matplotlib adjustments
load_mpl_rc()

# set the spectrum normalisation (total energy in electrons in this case)
spectrum_norm = 1e48 * u.Unit("erg")
# define the spectral function parametrisation through a dictionary
spectrum_dict = {
    "type": "PowerLaw",
    "parameters": {
        "p": 2.8,
        "gamma_min": 1e2,
        "gamma_max": 1e7
    },
}
# set the remaining quantities defining the blob
R_b = 1e16 * u.cm
B = 1 * u.G
z = Distance(1e27, unit=u.cm).z
delta_D = 10
Gamma = 10
blob = Blob(R_b, z, delta_D, Gamma, B, spectrum_norm, spectrum_dict)

# plot the electron distribution
blob.plot_n_e(gamma_power=2)
plt.show()