Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3BUU
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
simulation
KM3BUU
Commits
9845bb6d
Commit
9845bb6d
authored
2 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for kin energy calc
parent
8e2a6967
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#30942
passed with warnings
2 years ago
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3buu/tests/test_physics.py
+18
-3
18 additions, 3 deletions
km3buu/tests/test_physics.py
with
18 additions
and
3 deletions
km3buu/tests/test_physics.py
+
18
−
3
View file @
9845bb6d
...
...
@@ -27,8 +27,25 @@ PARTICLE_TESTFILE = join(dirname(__file__),
MUON_TESTFILE
=
join
(
dirname
(
__file__
),
"
data/muon_range_seawater.txt
"
)
class
TestMuonRangeSeaWater
(
unittest
.
TestCase
):
class
TestKineticEnergy
(
unittest
.
TestCase
):
def
test_electron_mass
(
self
):
val
=
get_kinetic_energy
(
0.51099895e-3
,
11
)[
0
]
self
.
assertAlmostEqual
(
val
,
0.0
,
6
)
def
test_negative_value
(
self
):
with
self
.
assertWarnsRegex
(
RuntimeWarning
,
"
invalid value encountered in sqrt
"
):
get_kinetic_energy
(
0.0
,
11
)
def
test_suppress_warning
(
self
):
import
warnings
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
get_kinetic_energy
(
0.0
,
11
,
False
)
assert
len
(
w
)
==
0
class
TestMuonRangeSeaWater
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
ref_values
=
np
.
loadtxt
(
MUON_TESTFILE
).
T
...
...
@@ -40,7 +57,6 @@ class TestMuonRangeSeaWater(unittest.TestCase):
class
TestVisEnergyParticle
(
unittest
.
TestCase
):
def
setUp
(
self
):
with
open
(
PARTICLE_TESTFILE
,
"
r
"
)
as
f
:
tmp
=
f
.
readline
()
...
...
@@ -59,7 +75,6 @@ class TestVisEnergyParticle(unittest.TestCase):
class
TestVisEnergyWeightFunctions
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
ref_values
=
np
.
loadtxt
(
FUNCTIONS_TESTFILE
).
T
...
...
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