From 42c8c249e73f12a1aec0a02659cfc2e5121f3718 Mon Sep 17 00:00:00 2001 From: Josh Shields Date: Thu, 2 Nov 2023 15:17:11 -0400 Subject: [PATCH] aimprove comments and mention korg reduction --- stardis/plasma/base.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/stardis/plasma/base.py b/stardis/plasma/base.py index e08a843b..abe5ee18 100644 --- a/stardis/plasma/base.py +++ b/stardis/plasma/base.py @@ -155,9 +155,9 @@ def calculate( g, ionization_data, ): - # solve n_lower : n * g_i / g_0 * e ^ (E_i/kT) + # solve n_lower : n * g_i / g_0 * e ^ (-E_i/kT) # get f_lu : loggf -> use g = 2j+1 - # emission_correction = (1-e^(-h nu / kT)) + # emission_correction = (1-e^(-h*nu / kT)) # alphas = ALPHA_COEFFICIENT * n_lower * f_lu * emission_correction points = len(t_electrons) @@ -197,6 +197,11 @@ def calculate( -linelist.e_low.values * u.eV, 1 / (t_electrons * u.K * const.k_B) ).to(1) ) + # -np.exp( + # np.outer(-linelist.e_up.values * u.eV, 1 / (t_electrons * u.K * const.k_B)) + # ).to( + # 1 + # ) # This reduction appears in Korg - I'm guessing it's due to spontaneous emission from the upper level - reduces opacity by ~1-3% # grab densities for n_lower - need to use linelist as the index linelist_with_densities = linelist.merge( @@ -206,7 +211,9 @@ def calculate( ) n_lower = ( - (exponent_by_point * linelist_with_densities[np.arange(points)]).values.T + ( + exponent_by_point * linelist_with_densities[np.arange(points)] + ).values.T # arange mask of the dataframe returns the set of densities of the appropriate ion for the line at each point * linelist_with_densities.g_lo.values / linelist_with_densities.g_0.values )