def fmTest(self,amConnect,pmConnect): """Test sending to port a only """ self.connect(amConnect,True, pmConnect) expected = cxmodulation.getFmTest(100000) testInCx = cxmodulation.fmBB(expected) #print "got %s baseband samples" %len(testInCx) testIn = unpackCx(testInCx) #print "sending in %s real samples" %len(testIn) outAM, outFM, outPM = self.myTestCase(testIn) if outAM: print "am", len(outAM) if outFM: print "fm", len(outFM) if outPM: print "pm", len(outPM) sampleDelay = cxmodulation.getFilterDelay(expected,testInCx) #print "sampleDelay = %s" %sampleDelay #print self.validate(outFM, [10.0*x for x in expected[sampleDelay:sampleDelay+len(outFM)]],.1)
def amTest(self,pmConnect, fmConnect): """Test sending to port a only """ self.connect(True,fmConnect, pmConnect) expected = cxmodulation.getAmTest(100000) testInCx = cxmodulation.amBB(expected) #print "got %s baseband samples" %len(testInCx) testIn = unpackCx(testInCx) #print "sending in %s real samples" %len(testIn) outAM, outFM, outPM = self.myTestCase(testIn) if outAM: print "am", len(outAM) if outFM: print "fm", len(outFM) if outPM: print "pm", len(outPM) sampleDelay = cxmodulation.getFilterDelay(expected,testInCx) #print "sampleDelay = %s" %sampleDelay #print #toClipboard(expected[sampleDelay:sampleDelay+len(outAM)]) self.validate(outAM, expected[sampleDelay:sampleDelay+len(outAM)], 1e-5)
def amTest(self, pmConnect, fmConnect): """Test sending to port a only """ self.connect(True, fmConnect, pmConnect) expected = cxmodulation.getAmTest(100000) testInCx = cxmodulation.amBB(expected) #print "got %s baseband samples" %len(testInCx) testIn = unpackCx(testInCx) #print "sending in %s real samples" %len(testIn) outAM, outFM, outPM = self.myTestCase(testIn, sampleRate=1e6) if outAM: print "am", len(outAM) if outFM: print "fm", len(outFM) if outPM: print "pm", len(outPM) sampleDelay = cxmodulation.getFilterDelay(expected, testInCx) #print "sampleDelay = %s" %sampleDelay #print #toClipboard(expected[sampleDelay:sampleDelay+len(outAM)]) self.validate(outAM, expected[sampleDelay:sampleDelay + len(outAM)], 1e-5)
def testEos(self): """send the same data through 3 times but use Eos to flush the state Verify the output is identical after Eos but The second push on the same stream is different due to the state of the demod """ self.connect(False, False, True) expected = cxmodulation.getFmTest(8400) testInCx = cxmodulation.pmBB(expected) testIn = unpackCx(testInCx) outAM, outFM, outPM_new1 = self.myTestCase(testIn, eos=True) outAM, outFM, outPM_new2 = self.myTestCase(testIn) outAM, outFM, outPM_old = self.myTestCase(testIn) sampleDelay = cxmodulation.getFilterDelay(expected, testInCx) self.validate(outPM_new1, [ 20.0 * x for x in expected[sampleDelay:sampleDelay + len(outPM_new1)] ], 1e-4) self.validate(outPM_new1, outPM_new2, 1e-5) mse = self.getMSE(outPM_new1, outPM_old) self.assertTrue(mse > 1.0)
def testMultiStream(self): """send the same data through 3 times on 2 streams Verify the output is identical for the two unique streams but The second push on the same stream is different due to the state of the demod """ self.connect(False, False, True) expected = cxmodulation.getFmTest(8400) testInCx = cxmodulation.pmBB(expected) testIn = unpackCx(testInCx) outAM, outFM, outPM_A = self.myTestCase(testIn, 'streamA') outAM, outFM, outPM_B = self.myTestCase(testIn, 'streamB') outAM, outFM, outPM_A2 = self.myTestCase(testIn, 'streamA', sampleRate=1e6) sampleDelay = cxmodulation.getFilterDelay(expected, testInCx) self.validate(outPM_A, [ 20.0 * x for x in expected[sampleDelay:sampleDelay + len(outPM_A)] ], 1e-4) self.validate(outPM_A, outPM_B, 1e-5) mse = self.getMSE(outPM_A, outPM_A2) self.assertTrue(mse > 1.0)
def fmTest(self, amConnect, pmConnect): """Test sending to port a only """ self.connect(amConnect, True, pmConnect) expected = cxmodulation.getFmTest(100000) testInCx = cxmodulation.fmBB(expected) #print "got %s baseband samples" %len(testInCx) testIn = unpackCx(testInCx) #print "sending in %s real samples" %len(testIn) outAM, outFM, outPM = self.myTestCase(testIn) if outAM: print "am", len(outAM) if outFM: print "fm", len(outFM) if outPM: print "pm", len(outPM) sampleDelay = cxmodulation.getFilterDelay(expected, testInCx) #print "sampleDelay = %s" %sampleDelay #print self.validate( outFM, [10.0 * x for x in expected[sampleDelay:sampleDelay + len(outFM)]], .1)