These were not too critical errors as we normal only do + and -
Build Debian Packages / build (trixie, debian13) (push) Successful in 13m14s
Build Debian Packages / build (bookworm, debian12) (push) Successful in 13m23s
Build Debian Packages / build (bullseye, debian11) (push) Has been cancelled

operations in the experiments.

- Identified and fixed multiple logic and syntax errors in the `Accumulation` class similar to those recently found in `ADC_Result`.
- Implemented missing arithmetic operators (`*`, `/`, `//`) and their inplace/reverse counterparts for the `Accumulation` class.
- Verified that all arithmetic operations correctly maintain statistical data (sum of squares) where mathematically possible.
This commit is contained in:
2026-07-04 16:26:56 +02:00
parent 4fffcc8e3b
commit efb15606c6
2 changed files with 158 additions and 20 deletions
+14 -13
View File
@@ -233,7 +233,6 @@ class TestAccumulation(unittest.TestCase):
for i in range(adc.get_nChannels()):
np.testing.assert_array_equal(accu.y[i], y[i] - 10 - 10.)
@unittest.skip("Not implmented")
def test_operator_mul_scalar(self):
"""
Test the functionality of __mul and __rmul__
@@ -254,33 +253,35 @@ class TestAccumulation(unittest.TestCase):
for i in range(adc.get_nChannels()):
np.testing.assert_array_equal(accu.y[i], y[i] * 10 * 10.0)
@unittest.skip("Not implmented")
def test_operator_truediv_scalar(self):
"""
Test the functionality of __div__ and __rdiv__
Test the functionality of __truediv__ and __itruediv__
"""
adc = self.create_adc_result()
y = adc.y
accu = Accumulation()
accu += adc
for i in range(adc.get_nChannels()):
np.testing.assert_array_equal(adc.y[i]/10, y[i] / 10, strict=True)
adc /= 10
np.testing.assert_array_equal(accu.y[i]/10, y[i] / 10)
accu /= 10
for i in range(adc.get_nChannels()):
np.testing.assert_array_equal(adc.y[i], y[i] / 10, strict=True)
np.testing.assert_array_equal(accu.y[i], y[i] / 10)
@unittest.skip("Not implmented")
def test_operator_floordiv_scalar(self):
"""
Test the functionality of __div__ and __rdiv__
Test the functionality of __floordiv__ and __ifloordiv__
"""
adc = self.create_adc_result()
y = adc.y
accu = Accumulation()
accu += adc
for i in range(adc.get_nChannels()):
np.testing.assert_array_equal(adc.y[i]//10, y[i] // 10, strict=True)
adc //= 10
np.testing.assert_array_equal(accu.y[i]//10, y[i] // 10)
accu //= 10
for i in range(adc.get_nChannels()):
np.testing.assert_array_equal(adc.y[i], y[i] // 10, strict=True)
self.assertRaises(ValueError, adc.__floordiv__, 1.0)
self.assertRaises(ValueError, adc.__rfloordiv__, 1.0)
np.testing.assert_array_equal(accu.y[i], y[i] // 10)
self.assertRaises(ValueError, accu.__floordiv__, 1.0)
self.assertRaises(ValueError, accu.__ifloordiv__, 1.0)
if __name__ == "__main__":
unittest.main()