Coverage for src/km3modules/tests/test_hits.py: 100%
17 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-08 03:14 +0000
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-08 03:14 +0000
1# Filename: test_hits.py
2# -*- coding: utf-8 -*-
3# vim:set ts=4 sts=4 sw=4 et:
4"""
5Tests for Hit functions and Modules.
6"""
8import numpy as np
9from numpy.testing import assert_array_equal, assert_allclose
11from km3modules.hits import count_multiplicities
13from km3pipe import Table, Blob, Pipeline, Module
14from km3pipe.testing import TestCase
17class TestMultiplicityCounter(TestCase):
18 def test_count_multiplicities(self):
19 times = np.array([1, 10, 20, 22, 30, 34, 40, 50])
20 mtps, coinc_ids = count_multiplicities(times, tmax=20)
21 self.assertListEqual([3, 3, 3, 4, 4, 4, 4, 1], list(mtps))
22 self.assertListEqual([0, 0, 0, 1, 1, 1, 1, 2], list(coinc_ids))
24 def test_count_other_multiplicities(self):
25 times = np.array([1, 10, 20, 22, 30, 34, 40, 50])
26 mtps, coinc_ids = count_multiplicities(times, tmax=10)
27 self.assertListEqual([2, 2, 3, 3, 3, 2, 2, 1], list(mtps))
28 self.assertListEqual([0, 0, 1, 1, 1, 2, 2, 3], list(coinc_ids))