Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reconstruction_benchmarks
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
EIC
benchmarks
reconstruction_benchmarks
Commits
62751498
Commit
62751498
authored
3 years ago
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
improve some functions in analysis scripts
parent
a1b3797c
No related branches found
No related tags found
1 merge request
!128
add benchmark for pion0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmarks/clustering/scripts/cluster_plots.py
+11
-2
11 additions, 2 deletions
benchmarks/clustering/scripts/cluster_plots.py
benchmarks/ecal/scripts/draw_cluters.py
+10
-2
10 additions, 2 deletions
benchmarks/ecal/scripts/draw_cluters.py
with
21 additions
and
4 deletions
benchmarks/clustering/scripts/cluster_plots.py
+
11
−
2
View file @
62751498
...
@@ -27,15 +27,23 @@ def flatten_collection(rdf, collection, cols=None):
...
@@ -27,15 +27,23 @@ def flatten_collection(rdf, collection, cols=None):
cols
=
[
str
(
c
)
for
c
in
rdf
.
GetColumnNames
()
if
str
(
c
).
startswith
(
'
{}.
'
.
format
(
collection
))]
cols
=
[
str
(
c
)
for
c
in
rdf
.
GetColumnNames
()
if
str
(
c
).
startswith
(
'
{}.
'
.
format
(
collection
))]
else
:
else
:
cols
=
[
'
{}.{}
'
.
format
(
collection
,
c
)
for
c
in
cols
]
cols
=
[
'
{}.{}
'
.
format
(
collection
,
c
)
for
c
in
cols
]
if
not
cols
:
print
(
'
cannot find any branch under collection {}
'
.
format
(
collection
))
return
pd
.
DataFrame
()
data
=
rdf
.
AsNumpy
(
cols
)
data
=
rdf
.
AsNumpy
(
cols
)
# flatten the data, add an event id to identify clusters from different events
# flatten the data, add an event id to identify clusters from different events
evns
=
[]
evns
=
[]
for
i
,
vec
in
enumerate
(
data
[
cols
[
0
]]):
for
i
,
vec
in
enumerate
(
data
[
cols
[
0
]]):
evns
+=
[
i
]
*
vec
.
size
()
evns
+=
[
i
]
*
vec
.
size
()
for
n
,
vals
in
data
.
items
():
for
n
,
vals
in
data
.
items
():
data
[
n
]
=
np
.
asarray
([
v
for
vec
in
vals
for
v
in
vec
])
# make sure ints are not converted to floats
typename
=
vals
[
0
].
__class__
.
__name__
.
lower
()
dtype
=
np
.
int64
if
'
int
'
in
typename
or
'
long
'
in
typename
else
np
.
float64
# type safe creation
data
[
n
]
=
np
.
asarray
([
v
for
vec
in
vals
for
v
in
vec
],
dtype
=
dtype
)
# build data frame
# build data frame
dfp
=
pd
.
DataFrame
(
columns
=
cols
,
data
=
np
.
vstack
(
list
(
data
.
values
())).
T
)
dfp
=
pd
.
DataFrame
(
{
c
:
pd
.
Series
(
v
)
for
c
,
v
in
data
.
items
()}
)
dfp
.
loc
[:,
'
event
'
]
=
evns
dfp
.
loc
[:,
'
event
'
]
=
evns
return
dfp
return
dfp
...
@@ -152,6 +160,7 @@ if __name__ == '__main__':
...
@@ -152,6 +160,7 @@ if __name__ == '__main__':
# calculate eta
# calculate eta
if
'
eta
'
not
in
df
.
columns
:
if
'
eta
'
not
in
df
.
columns
:
df
.
loc
[:,
'
eta
'
]
=
-
np
.
log
(
np
.
tan
(
df
[
'
polar.theta
'
].
values
/
2.
))
df
.
loc
[:,
'
eta
'
]
=
-
np
.
log
(
np
.
tan
(
df
[
'
polar.theta
'
].
values
/
2.
))
# print(df[['eta', 'polar.theta', 'position.x', 'position.y', 'position.z']])
fig
,
axs
=
plt
.
subplots
(
2
,
2
,
figsize
=
(
12
,
8
),
dpi
=
160
)
fig
,
axs
=
plt
.
subplots
(
2
,
2
,
figsize
=
(
12
,
8
),
dpi
=
160
)
ncl
=
df
.
groupby
(
'
event
'
)[
'
clusterID
'
].
nunique
().
values
ncl
=
df
.
groupby
(
'
event
'
)[
'
clusterID
'
].
nunique
().
values
axs
[
0
][
0
].
hist
(
ncl
,
weights
=
np
.
repeat
(
1.
/
float
(
ncl
.
shape
[
0
]),
ncl
.
shape
[
0
]),
axs
[
0
][
0
].
hist
(
ncl
,
weights
=
np
.
repeat
(
1.
/
float
(
ncl
.
shape
[
0
]),
ncl
.
shape
[
0
]),
...
...
This diff is collapsed.
Click to expand it.
benchmarks/ecal/scripts/draw_cluters.py
+
10
−
2
View file @
62751498
...
@@ -28,15 +28,23 @@ def flatten_collection(rdf, collection, cols=None):
...
@@ -28,15 +28,23 @@ def flatten_collection(rdf, collection, cols=None):
cols
=
[
str
(
c
)
for
c
in
rdf
.
GetColumnNames
()
if
str
(
c
).
startswith
(
'
{}.
'
.
format
(
collection
))]
cols
=
[
str
(
c
)
for
c
in
rdf
.
GetColumnNames
()
if
str
(
c
).
startswith
(
'
{}.
'
.
format
(
collection
))]
else
:
else
:
cols
=
[
'
{}.{}
'
.
format
(
collection
,
c
)
for
c
in
cols
]
cols
=
[
'
{}.{}
'
.
format
(
collection
,
c
)
for
c
in
cols
]
if
not
cols
:
print
(
'
cannot find any branch under collection {}
'
.
format
(
collection
))
return
pd
.
DataFrame
()
data
=
rdf
.
AsNumpy
(
cols
)
data
=
rdf
.
AsNumpy
(
cols
)
# flatten the data, add an event id to identify clusters from different events
# flatten the data, add an event id to identify clusters from different events
evns
=
[]
evns
=
[]
for
i
,
vec
in
enumerate
(
data
[
cols
[
0
]]):
for
i
,
vec
in
enumerate
(
data
[
cols
[
0
]]):
evns
+=
[
i
]
*
vec
.
size
()
evns
+=
[
i
]
*
vec
.
size
()
for
n
,
vals
in
data
.
items
():
for
n
,
vals
in
data
.
items
():
data
[
n
]
=
np
.
asarray
([
v
for
vec
in
vals
for
v
in
vec
])
# make sure ints are not converted to floats
typename
=
vals
[
0
].
__class__
.
__name__
.
lower
()
dtype
=
np
.
int64
if
'
int
'
in
typename
or
'
long
'
in
typename
else
np
.
float64
# type safe creation
data
[
n
]
=
np
.
asarray
([
v
for
vec
in
vals
for
v
in
vec
],
dtype
=
dtype
)
# build data frame
# build data frame
dfp
=
pd
.
DataFrame
(
columns
=
cols
,
data
=
np
.
vstack
(
list
(
data
.
values
())).
T
)
dfp
=
pd
.
DataFrame
(
{
c
:
pd
.
Series
(
v
)
for
c
,
v
in
data
.
items
()}
)
dfp
.
loc
[:,
'
event
'
]
=
evns
dfp
.
loc
[:,
'
event
'
]
=
evns
return
dfp
return
dfp
...
...
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