예제 #1
0
    def testEmpty(self):
        gen = VectorInput([])
        alg = sMinToTotal()
        p = Pool()

        gen.data >> alg.envelope
        alg.minToTotal >> (p, "lowlevel.minToTotal")

        run(gen)

        # Make sure nothing was emitted to the pool
        self.assertRaises(KeyError, lambda: p["lowlevel.minToTotal"])
예제 #2
0
    def testEmpty(self):
        gen = VectorInput([])
        alg = sMinToTotal()
        p = Pool()

        gen.data >> alg.envelope
        alg.minToTotal >> (p, 'lowlevel.minToTotal')

        run(gen)

        # Make sure nothing was emitted to the pool
        self.assertRaises(KeyError, lambda: p['lowlevel.minToTotal'])
예제 #3
0
    def testRegression(self):
        # V-shaped input
        envelope = range(22050)
        envelope.reverse()
        envelope += range(22050)

        gen = VectorInput(envelope)
        minToTotal = sMinToTotal()
        p = Pool()

        gen.data >> minToTotal.envelope
        minToTotal.minToTotal >> (p, "lowlevel.minToTotal")

        run(gen)

        result = p["lowlevel.minToTotal"]
        self.assertAlmostEqual(result, 0.5, 5e-5)  # this seems like a large error -rtoscano
        self.assertAlmostEqual(result, MinToTotal()(envelope), 5e-7)
예제 #4
0
    def testRegression(self):
        # V-shaped input
        envelope = list(range(22050))
        envelope.reverse()
        envelope += list(range(22050))

        gen = VectorInput(envelope)
        minToTotal = sMinToTotal()
        p = Pool()

        gen.data >> minToTotal.envelope
        minToTotal.minToTotal >> (p, 'lowlevel.minToTotal')

        run(gen)

        result = p['lowlevel.minToTotal']
        self.assertAlmostEqual(result, .5,
                               5e-5)  #this seems like a large error -rtoscano
        self.assertAlmostEqual(result, MinToTotal()(envelope), 5e-7)