Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FreeForestML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Benjamin Paul Jaeger
FreeForestML
Commits
4b1b0084
Verified
Commit
4b1b0084
authored
4 years ago
by
Frank Sauerburger
Browse files
Options
Downloads
Patches
Plain Diff
Specify stat uncertainty only once per stack
parent
9253c080
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Update upstream
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nnfwtbn/plot.py
+3
-0
3 additions, 0 deletions
nnfwtbn/plot.py
nnfwtbn/tests/test_hist.py
+46
-0
46 additions, 0 deletions
nnfwtbn/tests/test_hist.py
with
49 additions
and
0 deletions
nnfwtbn/plot.py
+
3
−
0
View file @
4b1b0084
...
@@ -235,6 +235,9 @@ def hist(dataframe, variable, bins, stacks, selection=None,
...
@@ -235,6 +235,9 @@ def hist(dataframe, variable, bins, stacks, selection=None,
uncertainty
=
stack
.
get_total_uncertainty
(
c_blind
(
dataframe
),
uncertainty
=
stack
.
get_total_uncertainty
(
c_blind
(
dataframe
),
bins
,
variable
,
bins
,
variable
,
weight
,
False
)
weight
,
False
)
if
i_process
!=
0
:
# We want to add the uncertainty only once!
uncertainty
*=
0
uncertainty
=
uncertainty
/
density_norm
uncertainty
=
uncertainty
/
density_norm
...
...
This diff is collapsed.
Click to expand it.
nnfwtbn/tests/test_hist.py
0 → 100644
+
46
−
0
View file @
4b1b0084
import
unittest
import
pandas
as
pd
import
nnfwtbn
class
HistTestBase
(
unittest
.
TestCase
):
"""
Test the implementation of hist().
The implementation is tested by inspecting the returned uhepp objects.
"""
def
setUp
(
self
):
"""
Set up a toy dataframe and processes
"""
self
.
data
=
pd
.
DataFrame
({
"
m
"
:
[
10
,
10
,
10
,
10
,
10
],
"
w
"
:
[
1
,
2
,
1
,
3
,
8
],
"
p
"
:
[
1
,
1
,
1
,
2
,
3
]
})
self
.
process_a
=
nnfwtbn
.
Process
(
"
a
"
,
lambda
d
:
d
.
p
==
1
)
self
.
process_b
=
nnfwtbn
.
Process
(
"
b
"
,
lambda
d
:
d
.
p
==
2
)
self
.
mc_stack
=
nnfwtbn
.
McStack
(
self
.
process_a
,
self
.
process_b
)
self
.
process_x
=
nnfwtbn
.
Process
(
"
x
"
,
lambda
d
:
d
.
p
==
3
)
self
.
data_stack
=
nnfwtbn
.
McStack
(
self
.
process_x
)
def
test_yield_base
(
self
):
"""
Check the bin contents
"""
hist
=
nnfwtbn
.
hist
(
self
.
data
,
variable
=
"
m
"
,
weight
=
"
w
"
,
bins
=
[
0
,
20
],
stacks
=
[
self
.
mc_stack
,
self
.
data_stack
],
return_uhepp
=
True
)
self
.
assertEqual
(
hist
.
yields
[
"
s0_p0
"
].
base
,
[
0
,
4
,
0
])
self
.
assertEqual
(
hist
.
yields
[
"
s0_p1
"
].
base
,
[
0
,
3
,
0
])
self
.
assertEqual
(
hist
.
yields
[
"
s1_p0
"
].
base
,
[
0
,
8
,
0
])
def
test_yiele_stat
(
self
):
"""
Check the statistical uncertainties
"""
hist
=
nnfwtbn
.
hist
(
self
.
data
,
variable
=
"
m
"
,
weight
=
"
w
"
,
bins
=
[
0
,
20
],
stacks
=
[
self
.
mc_stack
,
self
.
data_stack
],
return_uhepp
=
True
)
self
.
assertAlmostEqual
(
hist
.
yields
[
"
s0_p0
"
].
stat
[
1
]
**
2
,
15
)
self
.
assertAlmostEqual
(
hist
.
yields
[
"
s0_p1
"
].
stat
[
1
]
**
2
,
0
)
self
.
assertAlmostEqual
(
hist
.
yields
[
"
s1_p0
"
].
stat
[
1
]
**
2
,
64
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment