From ad584ef66bc710a6931c99eb0412f0b23ff76804 Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Fri, 22 Aug 2025 09:53:32 +0200 Subject: [PATCH 1/4] document units a bit better \pi trips up a syntax error (need r""" """ or double backslash). == True is redundant --- src/agnsed.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/agnsed.py b/src/agnsed.py index 961d74b..34a5cd7 100644 --- a/src/agnsed.py +++ b/src/agnsed.py @@ -263,8 +263,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.nugrid * 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.nugrid * u.Hz` + Integrated luminosities correspondingly lose /Hz or /AA. + Fluxes correspondingly are per luminosity distance squared. """ #Checking valid units @@ -360,7 +364,7 @@ def _to_flux(self, L): def _calc_Ledd(self): """ - Caclulate eddington Luminosity + Calculate eddington Luminosity """ Ledd = 1.39e38 * self.M #erg/s @@ -647,7 +651,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 """ @@ -683,7 +687,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) @@ -751,7 +755,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 @@ -1003,7 +1007,7 @@ 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) From 6aa04076fd8dfbb4540ea7dc0f9a5d99ba900da9 Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Fri, 22 Aug 2025 09:58:18 +0200 Subject: [PATCH 2/4] add labels to plot --- src/agnsed.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/agnsed.py b/src/agnsed.py index 34a5cd7..114c739 100644 --- a/src/agnsed.py +++ b/src/agnsed.py @@ -1012,6 +1012,8 @@ def get_SEDcomponent(self, component, as_flux=False): 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() From 86cb9f2694c2cf05006f5ea3bd00515372761ccd Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Fri, 22 Aug 2025 21:18:55 +0200 Subject: [PATCH 3/4] typo --- src/agnsed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agnsed.py b/src/agnsed.py index 114c739..0f752e1 100644 --- a/src/agnsed.py +++ b/src/agnsed.py @@ -263,10 +263,10 @@ def set_units(self, new_unit='cgs'): ---------- new_unit : {'cgs','cgs_wave', 'SI', 'counts'}, optional The default unit to use. The default is 'cgs'. - * cgs: the luminosity spectral density is in `u.erg/u.s/u.Hz`, use `agn.nugrid * u.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.nugrid * u.Hz` + * 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. From c279842d0b809fe5b6cab5392f569a522820cb0a Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Fri, 22 Aug 2025 21:19:03 +0200 Subject: [PATCH 4/4] describe log_rout<0 as well --- src/agnsed.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/agnsed.py b/src/agnsed.py index 0f752e1..05c9805 100644 --- a/src/agnsed.py +++ b/src/agnsed.py @@ -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).