-
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #312 from aoifeboyle/plasma/testing_level_population
Added tests for plasma level population properties.
- Loading branch information
Showing
4 changed files
with
38 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
import numpy as np | ||
|
||
import tardis | ||
from tardis.plasma.properties.atomic import (Levels, Lines, | ||
LinesLowerLevelIndex, LinesUpperLevelIndex, AtomicMass, IonizationData) | ||
from tardis.plasma.properties.atomic import (LinesLowerLevelIndex, | ||
LinesUpperLevelIndex) | ||
|
||
def test_levels_property(levels, selected_atoms, included_he_atomic_data): | ||
def test_levels_property(levels): | ||
assert np.isclose(levels.ix[2].ix[0].ix[1]['energy'], 3.17545416e-11) | ||
|
||
def test_lines_property(included_he_atomic_data, selected_atoms): | ||
lines_module = Lines(None) | ||
lines = lines_module.calculate(included_he_atomic_data, selected_atoms) | ||
def test_lines_property(lines): | ||
assert np.isclose(lines.ix[564954]['wavelength'], 10833.307) | ||
|
||
def test_lines_lower_level_index_property(included_he_atomic_data, | ||
selected_atoms, levels): | ||
lines_module = Lines(None) | ||
lines = lines_module.calculate(included_he_atomic_data, selected_atoms) | ||
def test_lines_lower_level_index_property(levels, lines): | ||
lines_lower_module = LinesLowerLevelIndex(None) | ||
lines_lower_level_index = lines_lower_module.calculate(levels, lines) | ||
assert lines_lower_level_index[9] == 0 | ||
|
||
def test_lines_upper_level_index_property(included_he_atomic_data, | ||
selected_atoms, levels): | ||
lines_module = Lines(None) | ||
lines = lines_module.calculate(included_he_atomic_data, selected_atoms) | ||
def test_lines_upper_level_index_property(levels, lines): | ||
lines_upper_module = LinesUpperLevelIndex(None) | ||
lines_upper_level_index = lines_upper_module.calculate(levels, lines) | ||
assert lines_upper_level_index[9] == 30 | ||
|
||
def test_ionization_data_property(included_he_atomic_data, | ||
ionization_data): | ||
def test_ionization_data_property(included_he_atomic_data, ionization_data): | ||
assert np.isclose(float(ionization_data.ix[2].ix[1]), 3.9393336e-11) |
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,16 @@ | ||
import numpy as np | ||
|
||
from tardis.plasma.properties.level_population import (LevelPopulationLTE, | ||
LevelNumberDensity) | ||
|
||
def test_level_population_lte(level_population_lte): | ||
assert np.allclose(level_population_lte.ix[2].ix[0].ix[0], 1.0) | ||
assert np.allclose(level_population_lte.ix[2].ix[0].sum(), 1.0) | ||
|
||
def test_level_number_density(level_population_lte, ion_number_density): | ||
level_number_density_module = LevelNumberDensity(None) | ||
level_number_density = level_number_density_module.calculate( | ||
level_population_lte, ion_number_density) | ||
assert np.allclose(level_number_density.ix[2].ix[0].ix[0], | ||
ion_number_density.ix[2].ix[0]) | ||
assert np.allclose(level_number_density.sum(), ion_number_density.sum()) |