test_get_pivot_energy()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
from asgardpy.analysis import AsgardpyAnalysis
2
from asgardpy.stats import fetch_pivot_energy
3
4
5
def test_get_pivot_energy(gpy_hess_magic):
6
    """
7
    Check the pivot energy for given fit model on a dataset.
8
    """
9
    analysis = AsgardpyAnalysis(gpy_hess_magic)
10
11
    analysis.run(["datasets-3d", "datasets-1d"])
12
13
    e_ref = fetch_pivot_energy(analysis)
14
15
    assert e_ref.value == 0.20085434771049843
16
17
18
def test_get_pivot_energy_from_start(gpy_hess_magic):
19
    """
20
    Check the pivot energy for given fit model on a dataset from the start of
21
    the AsgardpyAnalysis object. Test using the SpectralModel of ECPL
22
    and without any associated EBL absorption model.
23
    """
24
    from asgardpy.config.operations import get_model_template
25
26
    new_model = get_model_template("ecpl2")
27
    gpy_hess_magic.target.models_file = new_model
28
    gpy_hess_magic.target.components[0].spectral.ebl_abs.reference = ""
29
30
    analysis = AsgardpyAnalysis(gpy_hess_magic)
31
32
    e_ref = fetch_pivot_energy(analysis)
33
34
    assert e_ref.value == 0.030128153004345924
35