Skip to content

Commit e7a24c1

Browse files
committed
Add test
1 parent d375e99 commit e7a24c1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_analysis.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,20 @@ def test_power():
2626

2727
with raises(ValueError):
2828
random_power(2.7, 5 * u.GeV, 10 * u.GeV, e_ref=1 * u.GeV, size=1)
29+
30+
31+
def test_power_law_integral():
32+
from fact.analysis.statistics import power_law_integral, FLUX_UNIT
33+
import astropy.units as u
34+
import numpy as np
35+
36+
# wolfram alpha result https://www.wolframalpha.com/input/?i=int_100%5E1000+x%5E-2
37+
result = power_law_integral(
38+
flux_normalization=1 * FLUX_UNIT,
39+
spectral_index=-2,
40+
e_min=100 * u.GeV,
41+
e_max=1000 * u.GeV,
42+
e_ref=1 * u.GeV,
43+
)
44+
assert np.isclose(result.value, 0.009)
45+
assert result.unit == (FLUX_UNIT * u.GeV)

0 commit comments

Comments
 (0)