Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add physical particle distributions #144

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions agnpy/emission_regions/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import astropy.units as u
from astropy.coordinates import Distance
from astropy.constants import c, sigma_T, m_e
from ..spectra import PowerLaw
from ..spectra import PowerLaw, SteadyStateSynchrotronCooling
from ..utils.conversion import mec2, mpc2, B_to_cgs


Expand Down Expand Up @@ -63,17 +63,29 @@ def __init__(
gamma_e_size=200,
gamma_p_size=200,
):
self.R_b = R_b.to("cm")
# if this is a physical solutions, then we want to inherit its B and R parameters
if isinstance(n_e, SteadyStateSynchrotronCooling):
self.R_b = n_e.R_b.to("cm")
self.B = n_e.B
else:
self.R_b = R_b.to("cm")
self.B = B

self.z = z
self.delta_D = delta_D
self.Gamma = Gamma
self.B = B
self._n_e = n_e
self._n_p = n_p
self.xi = xi

# set the parameters of the array of electrons Lorentz factors
# physical solutions don't have gamma_min and gamma_max
if isinstance(n_e, SteadyStateSynchrotronCooling):
self.set_gamma_e(gamma_e_size, 10, 1e6)
else:
self.set_gamma_e(gamma_e_size, self._n_e.gamma_min, self._n_e.gamma_max)

# we might want to have different array of Lorentz factors for e and p
self.set_gamma_e(gamma_e_size, self._n_e.gamma_min, self._n_e.gamma_max)
if self._n_p is not None:
self.set_gamma_p(gamma_p_size, self._n_p.gamma_min, self._n_p.gamma_max)

Expand Down
3 changes: 2 additions & 1 deletion agnpy/spectra/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .spectra import *
from .analytical import *
from .physical import *
Loading