Skip to content

Commit

Permalink
continue to write the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wkerzendorf committed Mar 3, 2015
1 parent b03b4cf commit f408073
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tardis/plasma/partition_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class LevelBoltzmannFactor(ProcessingPlasmaProperty):
"""

name = 'level_boltzmann_factor'
inputs = ['levels', 'beta_rad']
latex_formula = r'$g_{i, j, k} e^{E_{i, j, k} \times \beta_\textrm{rad}}$'


def calculate(self, levels, beta_rad):
@staticmethod
def calculate(levels, beta_rad):
exponential = np.exp(np.outer(levels.energy.values, -beta_rad))
level_boltzmann_factor_array = (levels.g.values[np.newaxis].T *
exponential)
Expand All @@ -37,7 +36,7 @@ def calculate(self, levels, beta_rad):
class LTEPartitionFunction(ProcessingPlasmaProperty):
name = 'partition_function'
latex_name = '$Z_{i, j}$'
inputs = ['levels', 'level_boltzmann_factor']

latex_formula = (r'$Z_{i, j} = \sum_{k=1}^n g_{i, j, k} '
r'e^{E_{i, j, k} \times \beta_\textrm{rad}}$')

Expand Down
7 changes: 7 additions & 0 deletions tardis/plasma/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from astropy import units as u

from tardis.plasma.standard_plasmas import LTEPlasma


@pytest.fixture
def number_of_cells():
Expand Down Expand Up @@ -35,3 +37,8 @@ def t_rad(number_of_cells):
return np.ones(number_of_cells) * 10000


@pytest.fixture
def standard_lte_plasma_he_db(t_rad, abundance, density, time_explosion,
included_he_atomic_data):
return LTEPlasma(t_rad, abundance, density, time_explosion,
included_he_atomic_data)

0 comments on commit f408073

Please sign in to comment.