|
| 1 | +# SPDX-License-Identifier: BSD-3-Clause |
| 2 | +# Copyright 2025 MoDaCor Authors |
| 3 | +# |
| 4 | +# Redistribution and use in source and binary forms, with or without modification, |
| 5 | +# are permitted provided that the following conditions are met: |
| 6 | +# 1. Redistributions of source code must retain the above copyright notice, this |
| 7 | +# list of conditions and the following disclaimer. |
| 8 | +# 2. Redistributions in binary form must reproduce the above copyright notice, |
| 9 | +# this list of conditions and the following disclaimer in the documentation |
| 10 | +# and/or other materials provided with the distribution. |
| 11 | +# 3. Neither the name of the copyright holder nor the names of its contributors |
| 12 | +# may be used to endorse or promote products derived from this software without |
| 13 | +# specific prior written permission. |
| 14 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND |
| 15 | +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 | +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 | +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
| 18 | +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 | +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 | +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 21 | +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 23 | +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | + |
| 25 | +__license__ = "BSD-3-Clause" |
| 26 | +__copyright__ = "Copyright 2025 MoDaCor Authors" |
| 27 | +__status__ = "Alpha" |
| 28 | + |
| 29 | + |
| 30 | +from modacor.modules.base_modules.poisson_uncertainties import * |
| 31 | +from modacor.dataclasses.databundle import DataBundle |
| 32 | + |
| 33 | +from os.path import abspath |
| 34 | +from logging import WARNING |
| 35 | +from os.path import abspath |
| 36 | +from os import unlink |
| 37 | +import numpy as np |
| 38 | +import tempfile |
| 39 | +import unittest |
| 40 | +import h5py |
| 41 | + |
| 42 | + |
| 43 | +class TestPoissonUncertainties(unittest.TestCase): |
| 44 | + """Testing class for modacor/modules/base_modules/poisson_uncertainties.py""" |
| 45 | + |
| 46 | + def setUp(self): |
| 47 | + self.test_data = np.arange(0,100).reshape((10, 10)) |
| 48 | + self.test_data_bundle = DataBundle(signal = self.test_data) |
| 49 | + |
| 50 | + |
| 51 | + def tearDown(self): |
| 52 | + pass |
| 53 | + |
| 54 | + |
| 55 | + def test_poisson_calculation(self): |
| 56 | + poisson_uncertainties = PoissonUncertainties() |
| 57 | + poisson_uncertainties.calculate(self.test_data_bundle) |
0 commit comments