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

Test for intensity added in test_util.py #258

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 16 additions & 1 deletion tardis/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
import pytest
from astropy import units as u
from tardis import atomic
from tardis.util import species_string_to_tuple, parse_quantity, element_symbol2atomic_number, atomic_number2element_symbol, reformat_element_symbol, MalformedQuantityError
from tardis.util import species_string_to_tuple, parse_quantity, element_symbol2atomic_number, atomic_number2element_symbol, reformat_element_symbol, MalformedQuantityError, intensity_black_body
from astropy import constants

k_B_cgs = constants.k_B.cgs.value
c_cgs = constants.c.cgs.value
h_cgs = constants.h.cgs.value
m_e_cgs = constants.m_e.cgs.value
e_charge_gauss = constants.e.gauss.value

testdata = [(10**4, 1092, 3.3550151563259252e-26),
(10**6, 1365, 4.1937684951576179e-22),
(10**7, 1683, 5.1707776564400651e-20)]

@pytest.mark.parametrize("nu,T,expected", testdata)
def test_intensity_black_body(nu, T, expected):
assert intensity_black_body(nu, T) == expected

def test_quantity_parser_normal():
q1 = parse_quantity('5 km/s')
Expand Down