Skip to content

Commit

Permalink
free-free fixes (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes authored Oct 8, 2024
1 parent 8b9ef1f commit b74ecc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fiasco/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def free_free(self, wavelength: u.angstrom):
free_free = u.Quantity(np.zeros(self.temperature.shape + wavelength.shape),
'erg cm^3 s^-1 Angstrom^-1')
for ion in self:
ff = ion.free_free(wavelength)
try:
ff = ion.free_free(wavelength)
abundance = ion.abundance
ioneq = ion.ioneq
except MissingDatasetException as e:
Expand Down
9 changes: 4 additions & 5 deletions fiasco/gaunt.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,14 @@ def _free_free_itoh(self, temperature: u.K, wavelength: u.angstrom, atomic_numbe
lower_u = const.h * const.c / const.k_B / tmp
upper_u = 1. / 2.5 * (np.log10(lower_u) + 1.5)
t = 1. / 1.25 * (log10_temperature - 7.25)
itoh_coefficients = self._itoh['a'][atomic_number-1]
itoh_coefficients = self._itoh['a'][self._itoh['Z']==atomic_number].squeeze()
# calculate Gaunt factor
gf = u.Quantity(np.zeros(upper_u.shape))
for j in range(11):
for i in range(11):
for i in range(itoh_coefficients.shape[0]):
for j in range(itoh_coefficients.shape[1]):
gf += (itoh_coefficients[i, j] * (t**i))[:, np.newaxis] * (upper_u**j)
# apply NaNs where Itoh approximation is not valid
gf = np.where(np.logical_and(np.log10(lower_u) >= -4., np.log10(lower_u) <= 1.0),
gf, np.nan)
gf = np.where(np.logical_and(np.log10(lower_u) >= -4., np.log10(lower_u) <= 1.0), gf, np.nan)
gf[np.where(np.logical_or(log10_temperature <= 6.0, log10_temperature >= 8.5)), :] = np.nan
return gf

Expand Down

0 comments on commit b74ecc0

Please sign in to comment.