-
-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding NlteIndexHelper class * adding nlte_ionization_species to io/schemas/plasma.yml * adding nlte_excitation_species to io/schemas/plasma.yml * added nlte_ionization_species in assemble_plasma * fixed the issue with getting nlte_ionization_species from config * fixed transforming string from config to tuple for nlte ionization species * ran black * attempt of writing tests 1 * ran black * test attempt 2 * black on test_hdf_plasma * experimenting with revert * attempt 3 * reverted tardis/plasma/tests/test_complete_plasmas.py * reverted tardis/plasma/tests/test_hdf_plasma.py * adding cofig for nlte * adding fixture for tardis_cofig_verysimple_nlte * added test_plasma_nlte_section_config * ran black * fixed the issue with the test, ran it locally * ran black on necessary files * updated description in schemas * switching from nlte_ionization to be used from self * ran black * changed nlte_properties_new to nlte_solver_properties * adding nlte_rate_equation_matrix.py * reverting to previous commit
- Loading branch information
1 parent
e3184f4
commit f7dc2bb
Showing
9 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
tardis_config_version: v1.0 | ||
|
||
supernova: | ||
luminosity_requested: 2.8e9 solLum | ||
time_explosion: 13 day | ||
|
||
atom_data: kurucz_atom_pure_simple.h5 | ||
|
||
model: | ||
structure: | ||
type: specific | ||
velocity: | ||
start: 1.1e4 km/s | ||
stop: 2.0e4 km/s | ||
num: 20 | ||
density: | ||
type: branch85_w7 | ||
abundances: | ||
type: uniform | ||
H: 0.1 | ||
O: 0.09 | ||
Mg: 0.03 | ||
Si: 0.52 | ||
S: 0.19 | ||
Ar: 0.04 | ||
Ca: 0.03 | ||
|
||
plasma: | ||
ionization: lte | ||
excitation: lte | ||
radiative_rates_type: dilute-blackbody | ||
line_interaction_type: macroatom | ||
continuum_interaction: | ||
species: | ||
- H I | ||
nlte_ionization_species: [H I] | ||
|
||
montecarlo: | ||
seed: 23111963 | ||
no_of_packets : 2.0e+5 | ||
iterations: 5 | ||
last_no_of_packets: 5.0e+5 | ||
no_of_virtual_packets: 5 | ||
convergence_strategy: | ||
type: damped | ||
damping_constant: 0.5 | ||
threshold: 0.05 | ||
lock_t_inner_cycles: 1 | ||
t_inner_update_exponent: -0.5 | ||
|
||
spectrum: | ||
start: 500 angstrom | ||
stop: 20000 angstrom | ||
num: 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pandas as pd | ||
from tardis.plasma.properties.base import ProcessingPlasmaProperty | ||
|
||
__all__ = [ | ||
"NLTEIndexHelper", | ||
] | ||
|
||
|
||
class NLTEIndexHelper(ProcessingPlasmaProperty): | ||
outputs = ("rate_matrix_index",) | ||
|
||
def __init__(self, plasma_parent, nlte_ionization_species=0): | ||
super().__init__(plasma_parent) | ||
self.nlte_ionization_species = nlte_ionization_species | ||
|
||
def calculate(self, levels, nlte_ionization_species): | ||
nlte_excitation_species = [] # not yet implemented | ||
rate_matrix_index = pd.MultiIndex.from_tuples( | ||
list( | ||
self.calculate_rate_matrix_index( | ||
levels, | ||
self.nlte_ionization_species, | ||
nlte_excitation_species, | ||
) | ||
), | ||
names=levels.names, | ||
).drop_duplicates() | ||
return rate_matrix_index | ||
|
||
def calculate_rate_matrix_index(self, levels, nlte_excitation_species=[]): | ||
for level in levels: | ||
if level[:2] in self.nlte_ionization_species: | ||
yield (*level[:2], "nlte_ion") | ||
elif (level[:2] not in self.nlte_ionization_species) and ( | ||
level[:2] not in nlte_excitation_species | ||
): | ||
yield (*level[:2], "lte_ion") | ||
else: | ||
yield level | ||
yield ("n_e", "n_e", "n_e") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters