Exemple #1
0
    def test_convertToPeriodic(self):
        '''
        Test the :mod:`buildingspy.io.Plotter.convertToPeriodic`
        function.
        '''
        import numpy as np
        import random
        import copy

        t = np.arange(0, 1000, 1.0)
        y = copy.copy(t)
        # Shuffle the y vector
        random.shuffle(y, random.seed(1))
        (tP, yP) = Plotter.convertToPeriodic(10, t, y)
        # Test whether the time vector is periodic
        for i in range(10):
            numpy.testing.assert_allclose(tP[i * 10:(i + 1) * 10], range(10))
        # Test whether y remains unchanged
        numpy.testing.assert_allclose(y, yP)
    def test_convertToPeriodic(self):
        """
        Test the :mod:`buildingspy.io.Plotter.convertToPeriodic`
        function.
        """
        import numpy as np
        import random
        import copy

        t = np.arange(0, 1000, 1.0)
        y = copy.copy(t)
        # Shuffle the y vector
        random.shuffle(y, random.seed(1))
        (tP, yP) = Plotter.convertToPeriodic(10, t, y)
        # Test whether the time vector is periodic
        for i in range(10):
            numpy.testing.assert_allclose(tP[i * 10:(i + 1) * 10], list(range(10)))
        # Test whether y remains unchanged
        numpy.testing.assert_allclose(y, yP)