# Path: praatio/utilities/my_math.py
# def numToStr(inputNum: float) -> str:
# def isclose(a: float, b: float, rel_tol: float = 1e-14, abs_tol: float = 0.0) -> bool:
# def filterTimeSeriesData(
#     filterFunc: Callable[[List[float], int, bool], List[float]],
#     featureTimeList: List[list],
#     windowSize: int,
#     index: int,
#     useEdgePadding: bool,
# ) -> List[list]:
# def znormalizeSpeakerData(
#     featureTimeList: List[Tuple[float, ...]], index: int, filterZeroValues: bool
# ) -> List[Tuple[float, ...]]:
# def medianFilter(dist: List[float], window: int, useEdgePadding: bool) -> List[float]:
# def znormWindowFilter(
#     dist: List[float], window: int, useEdgePadding: bool, filterZeroValues: bool
# ) -> List[float]:
#     def znormalizeCenterVal(valList):
# def _stepFilter(
#     filterFunc, dist: List[float], window: int, useEdgePadding: bool
# ) -> List[float]:
# def znormalizeData(valList: List[float]) -> List[float]:
# def rms(intensityValues: List[float]) -> float:
# 
# Path: tests/praatio_test_case.py
# class PraatioTestCase(unittest.TestCase):
#     def __init__(self, *args, **kargs):
#         super(PraatioTestCase, self).__init__(*args, **kargs)
# 
#         root = os.path.dirname(os.path.realpath(__file__))
#         self.dataRoot = os.path.join(root, "files")
#         self.outputRoot = os.path.join(self.dataRoot, "test_output")
# 
#     def setUp(self):
#         if not os.path.exists(self.outputRoot):
#             os.mkdir(self.outputRoot)
# 
#     def assertAllAlmostEqual(self, listA, listB):
#         for valA, valB in zip(listA, listB):
#             self.assertAlmostEqual(valA, valB)


import unittest
from praatio.utilities import my_math
from tests.praatio_test_case import PraatioTestCase




class TestMyMath(PraatioTestCase):

    datasetA = [1, 10, 100, 1000]
    datasetB = [1, -10, 100, -1000]
    datasetC = [10.5, 47, 93.24, -5]
    datasetD = [32, 24, 18, 5, 61]

    def test_rms(self):
        self.assertAlmostEqual(502.518905117, my_math.rms(self.datasetA))
        self.assertAlmostEqual(502.518905117, my_math.rms(self.datasetB))
        self.assertAlmostEqual(52.5308185735, my_math.rms(self.datasetC))
        self.assertAlmostEqual(33.6749164809, my_math.rms(self.datasetD))

    def test_znormalize_data(self):
        self.assertAllAlmostEqual(
            [
                -0.5723056009616835,
                -0.553694036702767,
                -0.3675783941136016,
                1.493578031778052,
            ],

# Path: praatio/utilities/my_math.py
# def numToStr(inputNum: float) -> str:
# def isclose(a: float, b: float, rel_tol: float = 1e-14, abs_tol: float = 0.0) -> bool:
# def filterTimeSeriesData(
#     filterFunc: Callable[[List[float], int, bool], List[float]],
#     featureTimeList: List[list],
#     windowSize: int,
#     index: int,
#     useEdgePadding: bool,
# ) -> List[list]:
# def znormalizeSpeakerData(
#     featureTimeList: List[Tuple[float, ...]], index: int, filterZeroValues: bool
# ) -> List[Tuple[float, ...]]:
# def medianFilter(dist: List[float], window: int, useEdgePadding: bool) -> List[float]:
# def znormWindowFilter(
#     dist: List[float], window: int, useEdgePadding: bool, filterZeroValues: bool
# ) -> List[float]:
#     def znormalizeCenterVal(valList):
# def _stepFilter(
#     filterFunc, dist: List[float], window: int, useEdgePadding: bool
# ) -> List[float]:
# def znormalizeData(valList: List[float]) -> List[float]:
# def rms(intensityValues: List[float]) -> float:
# 
# Path: tests/praatio_test_case.py
# class PraatioTestCase(unittest.TestCase):
#     def __init__(self, *args, **kargs):
#         super(PraatioTestCase, self).__init__(*args, **kargs)
# 
#         root = os.path.dirname(os.path.realpath(__file__))
#         self.dataRoot = os.path.join(root, "files")
#         self.outputRoot = os.path.join(self.dataRoot, "test_output")
# 
#     def setUp(self):
#         if not os.path.exists(self.outputRoot):
#             os.mkdir(self.outputRoot)
# 
#     def assertAllAlmostEqual(self, listA, listB):
#         for valA, valB in zip(listA, listB):
#             self.assertAlmostEqual(valA, valB)


# Path: tests/utilities/test_my_math.py
import unittest
from praatio.utilities import my_math
from tests.praatio_test_case import PraatioTestCase





class TestMyMath(PraatioTestCase):

    datasetA = [1, 10, 100, 1000]
    datasetB = [1, -10, 100, -1000]
    datasetC = [10.5, 47, 93.24, -5]
    datasetD = [32, 24, 18, 5, 61]

    def test_rms(self):
        self.assertAlmostEqual(502.518905117, my_math.rms(self.datasetA))
        self.assertAlmostEqual(502.518905117, my_math.rms(self.datasetB))
        self.assertAlmostEqual(52.5308185735, my_math.rms(self.datasetC))
        self.assertAlmostEqual(33.6749164809, my_math.rms(self.datasetD))

    def test_znormalize_data(self):
        self.assertAllAlmostEqual(
            [
                -0.5723056009616835,
                -0.553694036702767,
                -0.3675783941136016,
                1.493578031778052,
            ],

            my_math.znormalizeData(self.datasetA),