Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
km3py
km3io
Commits
91a156ef
Commit
91a156ef
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
make yapf
parent
70e12780
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
km3io/online.py
+1
-1
1 addition, 1 deletion
km3io/online.py
km3io/tools.py
+12
-13
12 additions, 13 deletions
km3io/tools.py
tests/test_gseagen.py
+1
-1
1 addition, 1 deletion
tests/test_gseagen.py
tests/test_online.py
+7
-7
7 additions, 7 deletions
tests/test_online.py
with
21 additions
and
22 deletions
km3io/online.py
+
1
−
1
View file @
91a156ef
...
...
@@ -336,7 +336,7 @@ class OnlineEvents:
def
__getitem__
(
self
,
item
):
return
OnlineEvent
(
self
.
headers
[
item
],
self
.
snapshot_hits
[
item
],
self
.
triggered_hits
[
item
])
self
.
triggered_hits
[
item
])
def
__len__
(
self
):
return
len
(
self
.
headers
)
...
...
This diff is collapsed.
Click to expand it.
km3io/tools.py
+
12
−
13
View file @
91a156ef
...
...
@@ -36,17 +36,16 @@ def _unfold_indices(obj, indices):
class
BranchMapper
:
def
__init__
(
self
,
name
,
key
,
extra
=
None
,
exclude
=
None
,
update
=
None
,
attrparser
=
None
,
flat
=
True
,
interpretations
=
None
,
toawkward
=
None
):
def
__init__
(
self
,
name
,
key
,
extra
=
None
,
exclude
=
None
,
update
=
None
,
attrparser
=
None
,
flat
=
True
,
interpretations
=
None
,
toawkward
=
None
):
"""
Mapper helper for keys in a ROOT branch.
...
...
@@ -191,8 +190,8 @@ class Branch:
def
__str__
(
self
):
length
=
len
(
self
)
return
"
{} ({}) with {} element{}
"
.
format
(
self
.
__class__
.
__name__
,
self
.
_mapper
.
name
,
length
,
'
s
'
if
length
>
1
else
''
)
self
.
_mapper
.
name
,
length
,
'
s
'
if
length
>
1
else
''
)
def
__repr__
(
self
):
length
=
len
(
self
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_gseagen.py
+
1
−
1
View file @
91a156ef
...
...
@@ -47,7 +47,7 @@ class TestGSGHeader(unittest.TestCase):
self
.
assertAlmostEqual
(
self
.
header
[
"
SiteLatitude
"
],
0.747
)
self
.
assertAlmostEqual
(
self
.
header
[
"
SiteLongitude
"
],
0.10763
)
self
.
assertAlmostEqual
(
self
.
header
[
"
SeaBottomRadius
"
],
6368000.
)
assert
round
(
self
.
header
[
"
GlobalGenWeight
"
]
-
6.26910765e+08
,
0
)
==
0
assert
round
(
self
.
header
[
"
GlobalGenWeight
"
]
-
6.26910765e+08
,
0
)
==
0
self
.
assertAlmostEqual
(
self
.
header
[
"
RhoSW
"
],
1.03975
)
self
.
assertAlmostEqual
(
self
.
header
[
"
RhoSR
"
],
2.65
)
self
.
assertAlmostEqual
(
self
.
header
[
"
TGen
"
],
31556926.
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_online.py
+
7
−
7
View file @
91a156ef
...
...
@@ -10,7 +10,7 @@ SAMPLES_DIR = os.path.join(os.path.dirname(__file__), "samples")
class
TestOnlineEvents
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
events
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
events
"
daq_v1.0.0.root
"
)).
events
def
test_index_lookup
(
self
):
assert
3
==
len
(
self
.
events
)
...
...
@@ -25,7 +25,7 @@ class TestOnlineEvents(unittest.TestCase):
class
TestOnlineEvent
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
event
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
events
[
0
]
"
daq_v1.0.0.root
"
)).
events
[
0
]
def
test_str
(
self
):
assert
re
.
match
(
"
.*event.*96.*snapshot.*18.*triggered
"
,
...
...
@@ -39,7 +39,7 @@ class TestOnlineEvent(unittest.TestCase):
class
TestOnlineEventsSnapshotHits
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
events
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
events
"
daq_v1.0.0.root
"
)).
events
self
.
lengths
=
{
0
:
96
,
1
:
124
,
-
1
:
78
}
self
.
total_item_count
=
298
...
...
@@ -78,7 +78,7 @@ class TestOnlineEventsSnapshotHits(unittest.TestCase):
class
TestOnlineEventsTriggeredHits
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
events
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
events
"
daq_v1.0.0.root
"
)).
events
self
.
lengths
=
{
0
:
18
,
1
:
53
,
-
1
:
9
}
self
.
total_item_count
=
80
...
...
@@ -119,7 +119,7 @@ class TestOnlineEventsTriggeredHits(unittest.TestCase):
class
TestTimeslices
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
ts
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
timeslices
"
daq_v1.0.0.root
"
)).
timeslices
def
test_data_lengths
(
self
):
assert
3
==
len
(
self
.
ts
.
_timeslices
[
"
L1
"
][
0
])
...
...
@@ -145,7 +145,7 @@ class TestTimeslices(unittest.TestCase):
class
TestTimeslice
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
ts
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
timeslices
"
daq_v1.0.0.root
"
)).
timeslices
self
.
n_frames
=
{
"
L1
"
:
[
69
,
69
,
69
],
"
SN
"
:
[
64
,
66
,
68
]}
def
test_str
(
self
):
...
...
@@ -159,7 +159,7 @@ class TestTimeslice(unittest.TestCase):
class
TestSummaryslices
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
ss
=
OnlineReader
(
os
.
path
.
join
(
SAMPLES_DIR
,
"
daq_v1.0.0.root
"
)).
summaryslices
"
daq_v1.0.0.root
"
)).
summaryslices
def
test_headers
(
self
):
assert
3
==
len
(
self
.
ss
.
headers
)
...
...
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