Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OrcaSong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Machine Learning
OrcaSong
Commits
f123674d
Commit
f123674d
authored
6 years ago
by
ViaFerrata
Browse files
Options
Downloads
Patches
Plain Diff
Add small tool to count number of events in a folder.
parent
b958ff57
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utilities/count_number_of_events_in_folder.py
+84
-0
84 additions, 0 deletions
utilities/count_number_of_events_in_folder.py
with
84 additions
and
0 deletions
utilities/count_number_of_events_in_folder.py
0 → 100644
+
84
−
0
View file @
f123674d
import
os
import
numpy
as
np
import
h5py
def
count_number_of_events_in_folder
(
dirpath
):
fpath_list
=
[]
for
file
in
os
.
listdir
(
dirpath
):
if
file
.
endswith
(
'
.h5
'
):
fpath
=
os
.
path
.
join
(
dirpath
,
file
)
fpath_list
.
append
(
fpath
)
n_total
=
0
for
fpath
in
fpath_list
:
f
=
h5py
.
File
(
fpath
,
'
r
'
)
n_total
+=
f
[
'
event_info
'
].
shape
[
0
]
f
.
close
()
return
n_total
def
main
():
dirpath_rn
=
'
/home/saturn/capn/mppi033h/Data/raw_data/random_noise
'
rn_n_total
=
count_number_of_events_in_folder
(
dirpath_rn
)
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of random_noise events:
'
+
str
(
rn_n_total
))
print
(
'
--------------------------------------------------------
'
)
dirpath_mupage
=
'
/home/saturn/capn/mppi033h/Data/raw_data/mupage
'
mupage_n_total
=
count_number_of_events_in_folder
(
dirpath_mupage
)
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of mupage events:
'
+
str
(
mupage_n_total
))
print
(
'
--------------------------------------------------------
'
)
dirpath_muon_cc_low_e
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/1-5GeV/muon-CC
'
dirpath_muon_cc_high_e
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/3-100GeV/muon-CC
'
muon_cc_low_e_n_total
=
count_number_of_events_in_folder
(
dirpath_muon_cc_low_e
)
muon_cc_high_e_n_total
=
count_number_of_events_in_folder
(
dirpath_muon_cc_high_e
)
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of muon-CC 1-5GeV events:
'
+
str
(
muon_cc_low_e_n_total
))
print
(
'
Total number of muon-CC 3-100GeV events:
'
+
str
(
muon_cc_high_e_n_total
))
print
(
'
--------------------------------------------------------
'
)
dirpath_elec_cc_low_e
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/1-5GeV/elec-CC
'
dirpath_elec_cc_high_e
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/3-100GeV/elec-CC
'
elec_cc_low_e_n_total
=
count_number_of_events_in_folder
(
dirpath_elec_cc_low_e
)
elec_cc_high_e_n_total
=
count_number_of_events_in_folder
(
dirpath_elec_cc_high_e
)
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of elec-CC 1-5GeV events:
'
+
str
(
elec_cc_low_e_n_total
))
print
(
'
Total number of elec-CC 3-100GeV events:
'
+
str
(
elec_cc_high_e_n_total
))
print
(
'
--------------------------------------------------------
'
)
dirpath_elec_nc_low_e
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/1-5GeV/elec-NC
'
dirpath_elec_nc_high_e
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/3-100GeV/elec-NC
'
elec_nc_low_e_n_total
=
count_number_of_events_in_folder
(
dirpath_elec_nc_low_e
)
elec_nc_high_e_n_total
=
count_number_of_events_in_folder
(
dirpath_elec_nc_high_e
)
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of elec-NC 1-5GeV events:
'
+
str
(
elec_nc_low_e_n_total
))
print
(
'
Total number of elec-NC 3-100GeV events:
'
+
str
(
elec_nc_high_e_n_total
))
print
(
'
--------------------------------------------------------
'
)
dirpath_tau_cc
=
'
/home/saturn/capn/mppi033h/Data/raw_data/ORCA_JTE_NEMOWATER/calibrated/with_jte_times/3-100GeV/tau-CC
'
tau_cc_n_total
=
count_number_of_events_in_folder
(
dirpath_tau_cc
)
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of tau-CC 3-100GeV events:
'
+
str
(
tau_cc_n_total
))
print
(
'
--------------------------------------------------------
'
)
n_total_neutr
=
muon_cc_low_e_n_total
+
muon_cc_high_e_n_total
+
elec_cc_low_e_n_total
+
elec_cc_high_e_n_total
\
+
elec_nc_low_e_n_total
+
elec_nc_high_e_n_total
+
tau_cc_n_total
print
(
'
--------------------------------------------------------
'
)
print
(
'
Total number of neutrino events:
'
+
str
(
n_total_neutr
))
print
(
'
--------------------------------------------------------
'
)
if
__name__
==
'
__main__
'
:
main
()
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