Example #1
0
    def test_docompress(self):
        output = self.pipe.run(get_compress_input())
        target = os.path.join(self.tmpdir,"compressed.npz")
        self.assertTrue(os.path.exists(target),
            "No compression output file")

        decomp = Decompressor(target)
        recon = decomp.decompress()

        errthresh = 0.65

        for tsn in xrange(recon.shape[0]):
            err = recon_error(output["data"][tsn][-1], recon[tsn,:])
            self.assertTrue(err[0] > errthresh, 
                "Expected stream reconstruction accuracy > %f" % errthresh)

            #to examine reconstruction versus original:
            examine = False
            if examine and tsn == 6:
               plot(output["data"][tsn][-1],'r')
               plot(recon[tsn,:],'b')
               show()
Example #2
0
    def test_docompress(self):
        output = self.pipe.run(get_compress_input())
        target = os.path.join(self.tmpdir, "compressed.npz")
        self.assertTrue(os.path.exists(target), "No compression output file")

        decomp = Decompressor(target)
        recon = decomp.decompress()

        errthresh = 0.65

        for tsn in xrange(recon.shape[0]):
            err = recon_error(output["data"][tsn][-1], recon[tsn, :])
            self.assertTrue(
                err[0] > errthresh,
                "Expected stream reconstruction accuracy > %f" % errthresh)

            #to examine reconstruction versus original:
            examine = False
            if examine and tsn == 6:
                plot(output["data"][tsn][-1], 'r')
                plot(recon[tsn, :], 'b')
                show()
Example #3
0
 def test_reconerror(self):
     self.assertEqual(recon_error(np.array([1,1,1]),np.array([1,1,1]))[0],1.0)
     rerr = recon_error(np.array([1.,0.5,1.]),np.array([1.,0.9,1.]))
     self.assertTrue(rerr[0] < 1)
     self.assertTrue(rerr[0] > 0)
Example #4
0
 def test_reconerror(self):
     self.assertEqual(
         recon_error(np.array([1, 1, 1]), np.array([1, 1, 1]))[0], 1.0)
     rerr = recon_error(np.array([1., 0.5, 1.]), np.array([1., 0.9, 1.]))
     self.assertTrue(rerr[0] < 1)
     self.assertTrue(rerr[0] > 0)