Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nlte normalization #923

Merged
merged 6 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion tardis/io/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def _create_collision_coefficient_matrix(self):
C_ul_matrix[level_number_lower, level_number_upper, :] = line.values[2:]
delta_E_matrix[level_number_lower, level_number_upper] = line['delta_e']
#TODO TARDISATOMIC fix change the g_ratio to be the otherway round - I flip them now here.
g_ratio_matrix[level_number_lower, level_number_upper] = line['g_ratio']
g_ratio_matrix[level_number_lower, level_number_upper] = 1/line['g_ratio']
self.C_ul_interpolator[species] = interpolate.interp1d(
self.atom_data.collision_data_temperatures,
C_ul_matrix)
Expand Down
18 changes: 9 additions & 9 deletions tardis/plasma/properties/partition_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, plasma_parent):
def _main_nlte_calculation(
self, atomic_data, nlte_data, t_electrons,
j_blues, beta_sobolevs, general_level_boltzmann_factor,
previous_electron_densities):
previous_electron_densities, g):
"""
The core of the NLTE calculation, used with all possible config.
options.
Expand Down Expand Up @@ -189,14 +189,14 @@ def _main_nlte_calculation(
'collision data?')
else:
raise e
general_level_boltzmann_factor[i].loc[species] = \
level_boltzmann_factor
general_level_boltzmann_factor[i].ix[species] = \
level_boltzmann_factor * g.loc[species][0] / level_boltzmann_factor[0]
return general_level_boltzmann_factor

def _calculate_classical_nebular(
self, t_electrons, lines, atomic_data,
nlte_data, general_level_boltzmann_factor, j_blues,
previous_electron_densities):
previous_electron_densities, g):
"""
Performs NLTE calculations using the classical nebular treatment.
All beta sobolev values taken as 1.
Expand All @@ -210,13 +210,13 @@ def _calculate_classical_nebular(
j_blues,
beta_sobolevs,
general_level_boltzmann_factor,
previous_electron_densities)
previous_electron_densities, g)
return general_level_boltzmann_factor

def _calculate_coronal_approximation(
self, t_electrons, lines, atomic_data,
nlte_data, general_level_boltzmann_factor,
previous_electron_densities):
previous_electron_densities, g):
"""
Performs NLTE calculations using the coronal approximation.
All beta sobolev values taken as 1 and j_blues taken as 0.
Expand All @@ -226,13 +226,13 @@ def _calculate_coronal_approximation(
general_level_boltzmann_factor = self._main_nlte_calculation(
atomic_data, nlte_data, t_electrons, j_blues,
beta_sobolevs, general_level_boltzmann_factor,
previous_electron_densities)
previous_electron_densities, g)
return general_level_boltzmann_factor

def _calculate_general(
self, t_electrons, lines, atomic_data, nlte_data,
general_level_boltzmann_factor, j_blues,
previous_beta_sobolev, previous_electron_densities):
previous_beta_sobolev, previous_electron_densities, g):
"""
Full NLTE calculation without approximations.
"""
Expand All @@ -244,7 +244,7 @@ def _calculate_general(
general_level_boltzmann_factor = self._main_nlte_calculation(
atomic_data, nlte_data, t_electrons, j_blues,
beta_sobolevs, general_level_boltzmann_factor,
previous_electron_densities)
previous_electron_densities, g)
return general_level_boltzmann_factor


Expand Down