Geometries¶
Base class to implement new geometries is Geometry
. Methods to be implemented are:
Geometry._compute_compute_IC()
Geometry._compute_compute_SSC()
Geometry._compute_photon_density()
, only for SSC calculations
It is not necessary to implement all functions, just the ones desired. The equivalent ones without underscore in front are reserved for user interface.
This is for including additional functionality such as Doppler boosting. (see DopplerBooster
).
There are two geometries prodived with the code:
HomogeneousSphere
, a basic homogeneous sphere
RadialSphere
, spherical geometry in which it is possible to specify radial profile in electron density and magnetic field.
- class Geometry(edist='thermal', method='brute', booster=None)¶
Base Geometry class to extend for other geometries
- Parameters
edist (str) – Name of the electron distribution for the geometry. Refer to docs.
method (str) – Reserved for later use.
booster (class) – A boosting implementation, ie.
DopplerBooster
- _compute_IC(nu, ne, n_ph_fun, g_params, B, params, **kwargs)¶
Definition of SSC luminosity for the geometry
- Parameters
nu (np.ndarray) – 1-D frequencies to calculate synchrotron luminosity [Hz]
ne (float) – Electron density [cm^-3]
n_ph_fun (function) – Function to calculate photon densities nph(nu) [cm-3 Hz-1]
g_params (list) – Parameters for the implemented geometry
B (float) – Magnetic Field [G]
params (list) – List of parameters for the electron distribution
**kwargs – Reserved for additional parameters
- Returns
L_nu – [erg s-1 Hz-1]
- Return type
np.ndarray
- _compute_SSC(nu, ne, g_params, B, params, **kwargs)¶
Definition of SSC luminosity for the geometry
- Parameters
nu (np.ndarray) – 1-D frequencies to calculate synchrotron luminosity [Hz]
ne (float) – Electron density [cm^-3]
g_params (list) – Parameters for the implemented geometry
B (float) – Magnetic Field [G]
params (list) – List of parameters for the electron distribution
**kwargs – Reserved for additional parameters
- Returns
L_nu – [erg s-1 Hz-1]
- Return type
np.ndarray
- _compute_photon_density(nu, ne, g_params, B, params)¶
Definition of photon density due to internal synchrotron. Note that this can return anything for any specific SSC calculation and typically not to be used for other purposes.
- Parameters
nu (np.ndarray) – 1-D frequencies to calculate synchrotron luminosity [Hz]
ne (float) – Electron density [cm^-3]
g_params (list) – Parameters for the implemented geometry
B (float) – Magnetic Field [G]
params (list) – List of parameters for the electron distribution
**kwargs – Reserved for additional parameters
- _compute_synchrotron(nu, ne, g_params, B, params, **kwargs)¶
Definition of synchrotron luminosity for the geometry
- Parameters
nu (np.ndarray) – 1-D frequencies to calculate synchrotron luminosity [Hz]
ne (float) – Electron density [cm^-3]
g_params (list) – Parameters for the implemented geometry
B (float) – Magnetic Field [G]
params (list) – List of parameters for the electron distribution
**kwargs – Reserved for additional parameters
- Returns
L_nu – [erg s-1 Hz-1]
- Return type
np.ndarray
- compute_IC(nu, ne, n_ph_fun, g_params, B, params, boost_p=None, **kwargs)¶
Same as
Geometry._compute_IC()
but acceptsboost_p
keyword. See classDopplerBooster
- compute_SSC(nu, ne, g_params, B, params, boost_p=None, **kwargs)¶
Same as
Geometry._compute_SSC()
but acceptsboost_p
keyword. See classDopplerBooster
- compute_synchrotron(nu, ne, g_params, B, params, boost_p=None, **kwargs)¶
Same as
Geometry._compute_synchrotron()
but acceptsboost_p
keyword. See classDopplerBooster
- class HomogeneousSphere(edist='thermal', method='brute', booster=None)¶
Exact homogeneous sphere.
- g_params for this class are:
R, size of the sphere [cm]
incang, Magnetic field configuration. -1 for tangled or uniform field lines at an angle to observer [rad]
- Parameters
edist (str) – Name of the electron distribution for the geometry. Refer to docs.
method (str) – Reserved for later use.
booster (class) – A boosting implementation, ie.
DopplerBooster
- class RadialSphere(n_r_fun=<function RadialSphere.<lambda>>, B_r_fun=<function RadialSphere.<lambda>>, edist='thermal', method='brute', bh=False, rsteps=64, target='cpu')¶
Numerical computation of spherical model where it is possible to set radial profiles in electron density or magnetic field.
- g_params for this class are:
R, size of the sphere [cm]
R_in, inner radius of the sphere. 0 if not necessary.
incang, Magnetic field configuration. -1 for tangled or uniform field lines at an angle to observer [rad]
- Parameters
n_r_fun (function) – Radial profile of n_e
B_r_fun (function) – Radial profile of magnetic field
edist (str) – Electron distribution tag
method (str) – Reserved for later
bh (boolean, default=False) – Max absorption below R_in
rsteps (int) – Specify number of radial grid points
target (str, default="cpu") – How to perform inverse Compton scattering, either “cpu” or “gpu”.
- class HomogeneousSphereUserdist(booster=None)¶
Special geometry class with different interface to work with given user electron distribution.
- Parameters
booster (class) – A boosting implementation, ie.
DopplerBooster
- _compute_synchrotron(nu, Ne, g_params, B, gamma, **kwargs)¶
Computes synchrotron luminosity
- Parameters
nu (np.ndarray) – Frequency array [Hz]
Ne (np.ndarray) – Electron distribution on gamma grid. Note this is not density total electrons
g_params (list) – Geometry parameters. same as
HomogeneousSphere
B (float) – Magnetic field [G]
gamma (np.ndarray) – gamma corresponding to Ne
- Returns
L_nu – [erg s-1 Hz-1]
- Return type
np.ndarray
- class DopplerBooster(beta, phi, n)¶
Doppler boost decorator for a given luminosity function.
- Parameters
beta (float) – v/c
phi (float) – Angle wrt line of sight in radian. Approaching towards observer 0, moving away from observer np.pi
n (float) – Geometry dependent boosting parameter. Spherical source with bulk velocity 3, jet-like 2 etc.