Skip to content
Open
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
24 changes: 16 additions & 8 deletions src/agnsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def __init__(self,
r_warm : float
Outer radius of warm Compton region - units : Rg
log_rout : float
log of outer disc radius - units : Rg
log of outer disc radius - units : Rg.
If -ve, the outer disc radius is set to the radius where
self-gravity stops.
fcol : float
Colour temperature correction as described in Done et al. (2012)
If -ve then follows equation 1 and 2 in Done et al. (2012).
Expand Down Expand Up @@ -263,8 +265,12 @@ def set_units(self, new_unit='cgs'):
----------
new_unit : {'cgs','cgs_wave', 'SI', 'counts'}, optional
The default unit to use. The default is 'cgs'.
NOTE, the main cgs_wave will give spectra in erg/s/Angstrom,
while cgs gives in erg/s/Hz
* cgs: the luminosity spectral density is in `u.erg/u.s/u.Hz`, use `agn.nu_grid * u.Hz`
* counts: the luminosity spectral density is in `u.keV/u.s/u.keV`, use `agn.Egrid * u.keV`
* cgs_wave: the luminosity spectral density is in `u.erg/u.s/u.AA`, use `agn.wavegrid * u.AA`
* SI: the luminosity spectral density is in `u.W/u.s/u.Hz`, use `agn.nu_grid * u.Hz`
Integrated luminosities correspondingly lose /Hz or /AA.
Fluxes correspondingly are per luminosity distance squared.

"""
#Checking valid units
Expand Down Expand Up @@ -360,7 +366,7 @@ def _to_flux(self, L):

def _calc_Ledd(self):
"""
Caclulate eddington Luminosity
Calculate eddington Luminosity

"""
Ledd = 1.39e38 * self.M #erg/s
Expand Down Expand Up @@ -647,7 +653,7 @@ def _bb_radiance(self, T):

Returns
-------
\pi * Bnu : 2D-array, shape=(len(nus), len(Ts))
pi * Bnu : 2D-array, shape=(len(nus), len(Ts))
Black-body emission spectrum - Units : erg/s/cm^2/Hz

"""
Expand Down Expand Up @@ -683,7 +689,7 @@ def _do_disc_annuli(self, r, dr):
"""

T4_ann = self.calc_Tnt(r)
if self.rep == True:
if self.rep:
T4_ann = T4_ann + self.calc_Trep(r, self.Lx)

Tann = T4_ann**(1/4)
Expand Down Expand Up @@ -751,7 +757,7 @@ def _do_warm_annuli(self, r, dr):
"""

T4_ann = self.calc_Tnt(r)
if self.rep == True:
if self.rep:
T4_ann = T4_ann + self.calc_Trep(r, self.Lx)

kTann = self.k_B * T4_ann**(1/4) #ergs
Expand Down Expand Up @@ -1003,11 +1009,13 @@ def get_SEDcomponent(self, component, as_flux=False):
nus = agn.nu_grid
Es = agn.Egrid


agn.set_units('counts')
fEs = agn.get_SED(as_flux=True)

plt.loglog(Es, Es**2 * fEs, color='k')
plt.ylabel('Energy flux density [keV/cm$^2$/s/keV]')
plt.xlabel('Energy [keV]')
plt.ylim(1e-4, 1)
plt.show()