Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
KerasROOTClassification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nikolai.Hartmann
KerasROOTClassification
Commits
83c2f0d9
Commit
83c2f0d9
authored
6 years ago
by
Nikolai
Browse files
Options
Downloads
Patches
Plain Diff
Number of contour levels and log/lin scale configurable for plot_NN_vs_var_2D
parent
772956b7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plotting.py
+18
-4
18 additions, 4 deletions
plotting.py
with
18 additions
and
4 deletions
plotting.py
+
18
−
4
View file @
83c2f0d9
...
@@ -5,6 +5,7 @@ import math
...
@@ -5,6 +5,7 @@ import math
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
matplotlib.colors
import
matplotlib.colors
from
matplotlib.ticker
import
LogFormatter
import
numpy
as
np
import
numpy
as
np
import
meme
import
meme
...
@@ -43,7 +44,9 @@ def plot_NN_vs_var_2D(plotname, means,
...
@@ -43,7 +44,9 @@ def plot_NN_vs_var_2D(plotname, means,
var2_index
,
var2_range
,
var2_index
,
var2_range
,
var1_label
=
None
,
var1_label
=
None
,
var2_label
=
None
,
var2_label
=
None
,
contourdistance
=
0.1
):
logscale
=
False
,
ncontours
=
20
,
black_contourlines
=
False
):
print
(
"
Creating varied events (2d)
"
)
print
(
"
Creating varied events (2d)
"
)
# example: vary var1 vs var2
# example: vary var1 vs var2
...
@@ -73,9 +76,19 @@ def plot_NN_vs_var_2D(plotname, means,
...
@@ -73,9 +76,19 @@ def plot_NN_vs_var_2D(plotname, means,
zmin
=
np
.
min
(
scores
)
zmin
=
np
.
min
(
scores
)
zmax
=
np
.
max
(
scores
)
zmax
=
np
.
max
(
scores
)
# TODO: find out on how to set (in a reasonable way) the contour levels and z-axis ticks
if
logscale
:
pcm
=
ax
.
contourf
(
sequence1
,
sequence2
,
scores
,
norm
=
matplotlib
.
colors
.
LogNorm
(
vmin
=
zmin
,
vmax
=
zmax
))
lvls
=
np
.
logspace
(
math
.
log10
(
zmin
),
math
.
log10
(
zmax
),
ncontours
)
cbar
=
fig
.
colorbar
(
pcm
,
ax
=
ax
,
extend
=
'
max
'
)
pcm
=
ax
.
contourf
(
sequence1
,
sequence2
,
scores
,
levels
=
lvls
,
norm
=
matplotlib
.
colors
.
LogNorm
(
vmin
=
zmin
,
vmax
=
zmax
))
if
black_contourlines
:
ax
.
contour
(
sequence1
,
sequence2
,
scores
,
levels
=
lvls
,
colors
=
"
k
"
,
linewidths
=
1
)
l_f
=
LogFormatter
(
10
,
labelOnlyBase
=
False
,
minor_thresholds
=
(
np
.
inf
,
np
.
inf
))
cbar
=
fig
.
colorbar
(
pcm
,
ax
=
ax
,
extend
=
'
max
'
,
ticks
=
lvls
,
format
=
l_f
)
else
:
pcm
=
ax
.
contourf
(
sequence1
,
sequence2
,
scores
,
ncontours
,
norm
=
matplotlib
.
colors
.
Normalize
(
vmin
=
0
,
vmax
=
1
))
if
black_contourlines
:
ax
.
contour
(
sequence1
,
sequence2
,
scores
,
ncontours
,
colors
=
"
k
"
,
linewidths
=
1
)
cbar
=
fig
.
colorbar
(
pcm
,
ax
=
ax
,
extend
=
'
max
'
)
cbar
.
set_label
(
"
NN output
"
)
cbar
.
set_label
(
"
NN output
"
)
if
var1_label
is
not
None
:
if
var1_label
is
not
None
:
ax
.
set_xlabel
(
var1_label
)
ax
.
set_xlabel
(
var1_label
)
...
@@ -114,3 +127,4 @@ if __name__ == "__main__":
...
@@ -114,3 +127,4 @@ if __name__ == "__main__":
var1_index
=
c
.
branches
.
index
(
"
met
"
),
var1_range
=
(
0
,
1000
,
10
),
var1_index
=
c
.
branches
.
index
(
"
met
"
),
var1_range
=
(
0
,
1000
,
10
),
var2_index
=
c
.
branches
.
index
(
"
mt
"
),
var2_range
=
(
0
,
500
,
10
),
var2_index
=
c
.
branches
.
index
(
"
mt
"
),
var2_range
=
(
0
,
500
,
10
),
var1_label
=
"
met [GeV]
"
,
var2_label
=
"
mt [GeV]
"
)
var1_label
=
"
met [GeV]
"
,
var2_label
=
"
mt [GeV]
"
)
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