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
4c599e76
Commit
4c599e76
authored
4 years ago
by
Stefan Reck
Browse files
Options
Downloads
Patches
Plain Diff
adjust tests for new settings of t0 event info etc.
parent
09465447
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_core.py
+5
-3
5 additions, 3 deletions
tests/test_core.py
tests/test_modules.py
+23
-23
23 additions, 23 deletions
tests/test_modules.py
with
28 additions
and
26 deletions
tests/test_core.py
+
5
−
3
View file @
4c599e76
...
...
@@ -29,6 +29,7 @@ class TestFileBinner(TestCase):
mc_info_extr
=
orcasong
.
mc_info_extr
.
get_real_data
,
det_file
=
DET_FILE
,
add_t0
=
True
,
keep_event_info
=
True
,
)
cls
.
tmpdir
=
tempfile
.
TemporaryDirectory
()
cls
.
outfile
=
os
.
path
.
join
(
cls
.
tmpdir
.
name
,
"
binned.h5
"
)
...
...
@@ -48,7 +49,7 @@ class TestFileBinner(TestCase):
def
test_x
(
self
):
target
=
np
.
array
([
[[[
4
,
1
],
[
6
,
3
]],
[[
1
1
,
5
],
[
7
,
7
]]],
[[
1
2
,
5
],
[
6
,
7
]]],
[[[
4
,
2
],
[
1
,
3
]],
[[
5
,
7
],
[
8
,
5
]]],
[[[
3
,
3
],
[
2
,
4
]],
...
...
@@ -72,7 +73,7 @@ class TestFileBinner(TestCase):
target_hists
=
{
"
channel_id
"
:
np
.
array
([
20.0
,
8.0
,
10.0
,
8.0
,
16.0
,
13.0
,
11.0
,
9.0
,
10.0
,
11.0
]),
"
pos_z
"
:
np
.
array
([
0.0
,
0.0
,
0.0
,
36.0
,
0.0
,
19.0
,
30.0
,
0.0
,
31.0
,
0.0
]),
"
time
"
:
np
.
array
([
5
6
.0
,
60
.0
]),
"
time
"
:
np
.
array
([
5
7
.0
,
59
.0
]),
}
for
dim
,
infos
in
bin_stats
.
items
():
np
.
testing
.
assert_equal
(
infos
[
"
hist
"
],
target_hists
[
dim
])
...
...
@@ -88,7 +89,8 @@ class TestFileGraph(TestCase):
hit_infos
=
[
"
pos_z
"
,
"
time
"
,
"
channel_id
"
],
mc_info_extr
=
orcasong
.
mc_info_extr
.
get_real_data
,
det_file
=
DET_FILE
,
add_t0
=
True
,
add_t0
=
False
,
keep_event_info
=
True
,
)
cls
.
tmpdir
=
tempfile
.
TemporaryDirectory
()
cls
.
outfile
=
os
.
path
.
join
(
cls
.
tmpdir
.
name
,
"
binned.h5
"
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_modules.py
+
23
−
23
View file @
4c599e76
from
unittest
import
TestCase
import
numpy
as
np
import
orcasong.modules
as
modules
from
km3pipe
.dataclasses
import
Table
import
km3pipe
as
kp
__author__
=
'
Stefan Reck
'
...
...
@@ -16,7 +16,7 @@ class TestModules(TestCase):
"
time_2
"
:
hits
.
time
[
2
]}
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
dom_id
'
:
[
2
,
3
,
3
],
'
channel_id
'
:
[
0
,
1
,
2
],
'
time
'
:
[
10.1
,
11.2
,
12.3
]
...
...
@@ -42,7 +42,7 @@ class TestModules(TestCase):
"
time_2
"
:
hits
.
time
[
2
]}
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
dom_id
'
:
np
.
array
([
2
,
3
,
3
],
dtype
=
"
int8
"
),
'
time
'
:
np
.
array
([
10.1
,
11.2
,
12.3
],
dtype
=
"
float32
"
),
})
...
...
@@ -70,7 +70,7 @@ class TestModules(TestCase):
class
TestTimePreproc
(
TestCase
):
def
setUp
(
self
):
self
.
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -78,12 +78,12 @@ class TestTimePreproc(TestCase):
}
self
.
in_blob_mc
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
}),
"
McHits
"
:
Table
({
"
McHits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -95,7 +95,7 @@ class TestTimePreproc(TestCase):
add_t0
=
True
,
center_time
=
False
)
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.1
,
2.2
,
3.3
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -113,7 +113,7 @@ class TestTimePreproc(TestCase):
add_t0
=
False
,
center_time
=
True
)
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
-
1.
,
0.
,
1.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -131,7 +131,7 @@ class TestTimePreproc(TestCase):
add_t0
=
True
,
center_time
=
True
)
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
-
1.1
,
0.
,
1.1
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -150,13 +150,13 @@ class TestTimePreproc(TestCase):
add_t0
=
True
,
center_time
=
True
)
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
-
1.1
,
0.
,
1.1
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
}),
"
McHits
"
:
Table
({
'
time
'
:
[
-
1.
1
,
0.
,
1.1
],
"
McHits
"
:
kp
.
Table
({
'
time
'
:
[
-
1.
2
,
-
0.
2
,
0.8
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
}),
...
...
@@ -172,11 +172,11 @@ class TestTimePreproc(TestCase):
class
TestPointMaker
(
TestCase
):
def
setUp
(
self
):
self
.
input_blob_1
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
"
x
"
:
[
4
,
5
,
6
],
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],}),
"
EventInfo
"
:
Table
({
"
EventInfo
"
:
kp
.
Table
({
"
pad
"
:
1.
})
}
...
...
@@ -213,7 +213,7 @@ class TestPointMaker(TestCase):
def
test_input_blob_1_max_n_hits
(
self
):
input_blob_long
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
"
x
"
:
np
.
random
.
rand
(
1000
).
astype
(
"
float32
"
),
})}
result
=
modules
.
PointMaker
(
...
...
@@ -262,7 +262,7 @@ class TestImageMaker(TestCase):
module
=
modules
.
ImageMaker
(
bin_edges_list
=
bin_edges_list
)
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
"
x
"
:
[
4
,
5
,
6
],
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
...
...
@@ -271,7 +271,7 @@ class TestImageMaker(TestCase):
}
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
"
x
"
:
[
4
,
5
,
6
],
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
...
...
@@ -303,7 +303,7 @@ class TestImageMaker(TestCase):
module
=
modules
.
ImageMaker
(
bin_edges_list
=
bin_edges_list
)
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
"
x
"
:
[
4
,
5
,
6
],
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
...
...
@@ -322,7 +322,7 @@ class TestImageMaker(TestCase):
module
=
modules
.
ImageMaker
(
bin_edges_list
=
bin_edges_list
)
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -330,7 +330,7 @@ class TestImageMaker(TestCase):
}
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -357,7 +357,7 @@ class TestImageMaker(TestCase):
module
=
modules
.
ImageMaker
(
bin_edges_list
=
bin_edges_list
)
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -365,7 +365,7 @@ class TestImageMaker(TestCase):
}
target
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
'
time
'
:
[
1.
,
2.
,
3.
],
"
t0
"
:
[
0.1
,
0.2
,
0.3
],
"
triggered
"
:
[
0
,
1
,
1
],
...
...
@@ -395,7 +395,7 @@ class TestBinningStatsMaker(TestCase):
]
in_blob
=
{
"
Hits
"
:
Table
({
"
Hits
"
:
kp
.
Table
({
"
x
"
:
[
4
,
5
,
6
,
6
],
'
time
'
:
[
1.
,
2.
,
3.
,
50
],
"
z
"
:
[
0
,
3
,
4
,
5
],
...
...
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