-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sofia Calgaro
committed
Dec 31, 2024
1 parent
daf90a3
commit 6e1610d
Showing
3 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Pkg | ||
Pkg.activate(".") | ||
Pkg.instantiate() | ||
using Random | ||
include("../../src/ZeroNuFit.jl") | ||
using .ZeroNuFit | ||
include("../../main.jl") | ||
|
||
@testset "test_get_corr_info" begin | ||
|
||
@info "Testing function to retrieve bkg correlation info (function 'get_corr_info' in src/fitting.jl)" | ||
|
||
# no entry for correlated bkg | ||
config = Dict("bkg" => Dict()) | ||
|
||
corr = false | ||
hier_mode=nothing | ||
hier_range=nothing | ||
try | ||
corr,hier_mode,hier_range = ZeroNuFit.get_corr_info(config) | ||
catch e | ||
@error "Error in 'get_corr_info' evaluation: $e" | ||
throw(e) | ||
end | ||
|
||
@test corr == false | ||
@test hier_mode == nothing | ||
@test hier_range == nothing | ||
|
||
# not-correlated bkg | ||
config = Dict("bkg" => Dict("correlated" => Dict("mode" => "none", "range" => "none"))) | ||
|
||
corr = false | ||
hier_mode=nothing | ||
hier_range=nothing | ||
try | ||
corr,hier_mode,hier_range = ZeroNuFit.get_corr_info(config) | ||
catch e | ||
@error "Error in 'get_corr_info' evaluation: $e" | ||
throw(e) | ||
end | ||
|
||
@test corr == false | ||
@test hier_mode == nothing | ||
@test hier_range == nothing | ||
|
||
# correlated bkg | ||
config = Dict("bkg" => Dict("correlated" => Dict("mode" => "lognormal", "range" => [0,0.1]))) | ||
|
||
corr = false | ||
hier_mode=nothing | ||
hier_range=nothing | ||
try | ||
corr,hier_mode,hier_range = ZeroNuFit.get_corr_info(config) | ||
catch e | ||
@error "Error in 'get_corr_info' evaluation: $e" | ||
throw(e) | ||
end | ||
|
||
expected_value = true | ||
@testset "Check corr accuracy" begin | ||
@test corr == expected_value | ||
end | ||
expected_value = config["bkg"]["correlated"]["mode"] | ||
@testset "Check hier_mode accuracy" begin | ||
@test hier_mode == expected_value | ||
end | ||
expected_value = config["bkg"]["correlated"]["range"] | ||
@testset "Check hier_range accuracy" begin | ||
@test hier_range == expected_value | ||
end | ||
|
||
end |