asgardpy.stats.tests.test_pivot_energy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A test_get_pivot_energy_from_start() 0 17 1
A test_get_pivot_energy() 0 11 1
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