Skip to content

Commit

Permalink
Revert changes to voigt_profile() formula (tardis-sn#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin committed Aug 21, 2023
1 parent 9ffad9b commit 2653cf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions stardis/opacities/tests/test_voigt.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ def test_voigt_profile_division_by_zero(
@pytest.mark.parametrize(
"voigt_profile_sample_values_input_delta_nu, voigt_profile_sample_values_input_doppler_width, voigt_profile_sample_values_input_gamma, voigt_profile_sample_values_expected_result",
[
(0, 1, 0, 1 / sqrt(np.pi) / sqrt(2)),
(0, 2, 0, 1 / (sqrt(np.pi) * 2 * sqrt(2))),
(0, 1, 0, 1 / sqrt(np.pi)),
(0, 2, 0, 1 / (sqrt(np.pi) * 2)),
(
np.array([0, 0]),
np.array([1, 2]),
np.array([0, 0]),
np.array([1 / sqrt(2) / sqrt(np.pi), 1 / (sqrt(2) * sqrt(np.pi) * 2)]),
np.array([1 / sqrt(np.pi), 1 / (sqrt(np.pi) * 2)]),
),
],
)
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_voigt_profile_sample_values_sample_values(
np.array([0, 0]),
np.array([1, 2]),
np.array([0, 0]),
np.array([1 / sqrt(2) / sqrt(np.pi), 1 / (sqrt(np.pi) * 2 * sqrt(2))]),
np.array([1 / sqrt(np.pi), 1 / (sqrt(np.pi) * 2)]),
),
],
)
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_voigt_profile_cuda_unwrapped_sample_values(
np.array([0, 0]),
np.array([1, 2]),
np.array([0, 0]),
np.array([1 / sqrt(2) / sqrt(np.pi), 1 / (sqrt(2) * sqrt(np.pi) * 2)]),
np.array([1 / sqrt(np.pi), 1 / (sqrt(np.pi) * 2)]),
),
],
)
Expand Down Expand Up @@ -261,7 +261,7 @@ def test_voigt_profile_cuda_wrapped_sample_numpy_values(
np.array([0, 0]),
np.array([1, 2]),
np.array([0, 0]),
np.array([1 / sqrt(np.pi) / sqrt(2), 1 / (sqrt(np.pi) * 2 * sqrt(2))]),
np.array([1 / sqrt(np.pi), 1 / (sqrt(np.pi) * 2)]),
),
],
)
Expand Down
4 changes: 2 additions & 2 deletions stardis/opacities/voigt.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def _voigt_profile(delta_nu, doppler_width, gamma):
"""
delta_nu, doppler_width, gamma = float(delta_nu), float(doppler_width), float(gamma)

z = complex(delta_nu, gamma) / (SQRT_2 * doppler_width)
phi = _faddeeva(z).real / (SQRT_2 * SQRT_PI * doppler_width)
z = complex(delta_nu, gamma / (4 * PI)) / doppler_width
phi = _faddeeva(z).real / (SQRT_PI * doppler_width)
return phi


Expand Down

0 comments on commit 2653cf0

Please sign in to comment.