示例#1
0
    def setUp(self):
        """Set up the unit test - this is run before every method that starts with test
        """
        ossie.utils.testing.ScaComponentTestCase.setUp(self)
        self.src = sb.DataSource()
        self.soft = sb.DataSink()
        self.bits = sb.DataSink()
        self.phase = sb.DataSink()

        #setup my components
        self.setupComponent()

        self.comp.start()
        self.src.start()
        self.soft.start()
        self.bits.start()

        #do the connections
        self.src.connect(self.comp)
        self.comp.connect(self.soft, usesPortName='softDecision_dataFloat_out')
        self.comp.connect(self.bits, usesPortName='bits_dataShort_out')
        self.comp.connect(self.phase, usesPortName='phase_dataFloat_out')
示例#2
0
    def setUp(self):
        """Set up the unit test - this is run before every method that starts with test.
        """
        ossie.utils.testing.ScaComponentTestCase.setUp(self)
        
        #######################################################################
        # Launch and initialize the component with the default execparam/property values,
        # and set debug level
        print ' * Note:'
        print ' * During this unit test, SinkVITA49 will warn about using a built-in table'
        print ' * for leap seconds if no leap seconds file is found at the indicated location.'
        self.launch(execparams={"DEBUG_LEVEL": DEBUG_LEVEL})
        
        #######################################################################
        # Set up data input/output and tracking variables
        self.dataSource = sb.DataSource()
        self.dataSource.connect(self.comp, 'dataShort_in')
        self.inVitaPort = bulkio.InVITA49Port("dataVITA49_in")
        self.inVitaPort.setNewAttachDetachListener(self)

        self.attaches = 0
        self.detaches = 0
示例#3
0
    def testEosPush(self):
        self.octetConnect()

        short_source = sb.DataSource()
        short_source.connect(self.comp, usesPortName='shortOut')

        sb.start()

        goodData1 = 1024 * [1]
        goodData2 = 1024 * [3]

        self.source.push(goodData1,
                         EOS=False,
                         streamID=self.id(),
                         sampleRate=1.0,
                         complexData=False,
                         loop=False)
        self.assertEqual(
            goodData1, list(struct.unpack('1024B',
                                          self.getPacket()[-1024:])))

        # Push an empty packet with EOS
        self.source.push([],
                         EOS=True,
                         streamID=self.id(),
                         sampleRate=1.0,
                         complexData=False,
                         loop=False)

        # Push a new stream with new stream ID
        self.source.push(goodData2,
                         EOS=False,
                         streamID="New Stream",
                         sampleRate=1.0,
                         complexData=False,
                         loop=False)
        self.assertEqual(
            goodData2, list(struct.unpack('1024B',
                                          self.getPacket()[-1024:])))
示例#4
0
    def setUp(self):
        """Set up the unit test - this is run before every method that starts with test
        """
        ossie.utils.testing.ScaComponentTestCase.setUp(self)
        self.src = sb.DataSource()
        self.sinkAM = sb.DataSink()
        self.sinkPM = sb.DataSink()
        self.sinkFM = sb.DataSink()

        #start all my components
        self.startComponent()
        props = {
            'freqDeviation': 10.0,
            'phaseDeviation': 20.0,
            'squelch': -2000.0
        }
        self.comp.configure(props_from_dict(props))
        self.comp.start()
        self.src.start()
        self.sinkAM.start()
        self.sinkPM.start()
        self.sinkFM.start()
    def _testConnectionFail(self, format, data):
        uses_name = 'data%sOut' % format
        provides_name = 'data%sIn' % format

        source = sb.DataSource()
        source.connect(self.comp1, providesPortName=provides_name)
        self.comp1.connect(self.comp2, usesPortName=uses_name)

        sink = sb.DataSink()
        self.comp1.connect(sink, usesPortName=uses_name)

        sb.start()

        os.kill(self.comp2._pid, 9)
        while self.comp2._process.isAlive():
            time.sleep(0.1)

        source.push(data, EOS=False, streamID='test_connection_fail')
        for ii in xrange(9):
            source.push(data, EOS=False)
        source.push(data, EOS=True)

        sink.getData(eos_block=True)
    def _test_FileSink(self, format):
        filename = self._tempfileName('sink_%s' % format)

        complexData = format.startswith('C')
        typecode = format[1]
        dataFormat, dataType = self.TYPEMAP[typecode]
        indata = [dataType(x) for x in xrange(16)]

        source = sb.DataSource(dataFormat=dataFormat)
        sink = sb.FileSink(filename, midasFile=True)
        source.connect(sink)
        sb.start()
        source.push(indata, complexData=complexData, EOS=True)
        sink.waitForEOS()

        hdr, outdata = bluefile.read(filename)
        self.assertEqual(hdr['format'], format)
        if complexData:
            if dataFormat in ('double', 'float'):
                outdata = list(self._flatten(outdata))
            else:
                outdata = outdata.flatten()
        self.assertTrue(numpy.array_equal(indata, outdata), msg="Format '%s' %s != %s" % (format, indata, outdata))
示例#7
0
    def testFlush(self):
        """
        Test the standard flush behavior.
        """
        self.utility()
        numPackets = 4

        # Set the queue depth to the number of packets intending to be sent - 1
        self.comp.mqd = numPackets - 1

        # Create a non-blocking source
        source = sb.DataSource(blocking=False)
        source.connect(self.comp)

        # Create a sink for the output
        sink = sb.DataSink()
        self.comp.connect(sink)

        # Send numPackets without starting the component, should generate a flush
        for x in range(numPackets):
            source.push([x])
        source.start()
        source.push([], EOS=True)

        # Ensure all packets are pushed before starting component
        source.waitAllPacketsSent()

        # Start the component and let the stream complete
        self.comp.start()
        sink.start()
        data = sink.getData(eos_block=True)

        self.assertEqual(len(data), 1)

        source.stop()
        sink.stop()
        self.comp.stop()
示例#8
0
文件: test_agc.py 项目: wp4613/agc
    def setUp(self):
        """Set up the unit test - this is run before every method that starts with test
        """
        ossie.utils.testing.ScaComponentTestCase.setUp(self)
        self.src = sb.DataSource()
        self.sink = sb.DataSink()

        #setup my components
        self.setupComponent()

        self.setProps(alpha=.9,
                      eps=1e-4,
                      avgPower=100,
                      minPower=1e10,
                      maxPower=-1e10,
                      enabled=True)

        self.comp.start()
        self.src.start()
        self.sink.start()

        #do the connections
        self.src.connect(self.comp)
        self.comp.connect(self.sink, 'floatIn')
    def _test_FileSinkOctet(self, format):
        filename = self._tempfileName('sink_octet_' + format.lower())

        source = sb.DataSource(dataFormat='octet')
        sink = sb.FileSink(filename, midasFile=True)
        source.connect(sink)
        sb.start()

        # Push a 256-element ramp (the maximum range of octet)
        indata = range(256)
        isComplex = bool(format[0] == 'C')
        source.push(indata, complexData=isComplex, EOS=True)
        sink.waitForEOS()

        # Check the BLUE file format matches
        hdr, data = bluefile.read(filename)
        self.assertEqual(format, hdr['format'])

        # Have to "cast" the data to unsigned 8-bit, since 'B' is a signed type
        # (as are all BLUE formats), and flattening the array re-interleaves
        # complex data
        outdata = data.view(numpy.uint8).reshape(-1)
        self.assertTrue(numpy.array_equal(indata, outdata),
                        msg="Format '%s' %s != %s" % (format, indata, outdata))
示例#10
0
#
# This file is part of REDHAWK bulkioInterfaces.
#
# REDHAWK bulkioInterfaces is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# REDHAWK bulkioInterfaces is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#
import sys
from ossie.utils import sb

dsource = sb.DataSource()
dsink = sb.DataSink()
test_comp = sb.Component('CPP_Ports')
data = range(100)
dsource.connect(test_comp, providesPortName='dataShortIn')
test_comp.connect(dsink,
                  providesPortName='shortIn',
                  usesPortName='dataShortOut')
sb.start()
dsource.push(data, EOS=True)
dest_data = dsink.getData(eos_block=True)
示例#11
0
    def testMultipleStreamsDifferentPort(self):
        self.octetConnect()

        short_source = sb.DataSource()
        short_source.connect(self.comp, usesPortName='shortOut')

        sink = sb.DataSinkSDDS()
        ad_cb = SddsAttachDetachCB()
        sink.registerAttachCallback(ad_cb.attach_cb)
        sink.registerDetachCallback(ad_cb.detach_cb)
        self.comp.connect(sink)
        sb.start()

        goodData1 = 1024 * [1]
        deckedData = 512 * [2]
        goodData2 = 512 * [3]

        # No data pushed, no attaches or detaches
        self.assertEqual(len(ad_cb.get_attach()), 0,
                         "Should not have received any attaches")

        # Push one good packet and confirm it was received
        self.source.push(goodData1,
                         EOS=False,
                         streamID=self.id(),
                         sampleRate=1.0,
                         complexData=False,
                         loop=False)
        self.assertEqual(
            goodData1, list(struct.unpack('1024B',
                                          self.getPacket()[-1024:])))

        # Since we pushed, we should get an attach, no detach
        self.assertEqual(len(ad_cb.get_attach()), 1,
                         "Should have received 1 attach total")

        # Push a new stream, it should get decked, and disabled, confirm we receive no data and still have only a single attach
        short_source.push(deckedData,
                          EOS=False,
                          streamID="Decked Stream",
                          sampleRate=1.0,
                          complexData=False,
                          loop=False)
        self.assertEqual(
            len(self.getPacket()), 0,
            "Should not have passed on new stream, stream already active")
        self.assertEqual(len(ad_cb.get_attach()), 1,
                         "Should have received 1 attach total")

        # Push an EOS which should cause a detach, the decked stream to become active and the goodData pushed and us to have another attach called.
        self.source.push(goodData1,
                         EOS=True,
                         streamID=self.id(),
                         sampleRate=1.0,
                         complexData=False,
                         loop=False)
        self.assertEqual(
            goodData1, list(struct.unpack('1024B',
                                          self.getPacket()[-1024:])))
        time.sleep(2)
        self.assertEqual(len(ad_cb.get_attach()), 2,
                         "Should have received 2 attach total")

        # Push decked data and EOS It.
        short_source.push(deckedData,
                          EOS=True,
                          streamID="Decked Stream",
                          sampleRate=1.0,
                          complexData=False,
                          loop=False)
        self.assertEqual(
            deckedData, list(struct.unpack('!512H',
                                           self.getPacket()[-1024:])))

        # Send a new stream, which means a new attach
        short_source.push(goodData2,
                          EOS=False,
                          streamID="New Stream",
                          sampleRate=1.0,
                          complexData=False,
                          loop=False)
        self.assertEqual(
            goodData2, list(struct.unpack('!512H',
                                          self.getPacket()[-1024:])))
        self.assertEqual(len(ad_cb.get_attach()), 3,
                         "Should have received 3 attach total")

        # Tear stuff down, confirm we get the final detach
        sb.release()
        self.assertEqual(len(ad_cb.get_attach()), 3,
                         "Should have received 3 attach total")
        self.assertEqual(len(ad_cb.get_detach()), 3,
                         "Should have received 3 detach total")
示例#12
0
#
# You should have received a copy of the GNU Lesser General Public License along with this
# program.  If not, see http://www.gnu.org/licenses/.
#
from ossie.utils import sb
from ossie.properties import props_from_dict

import ossie.properties
print ossie.properties.__file__
import math
from math import cos

import time
c = sb.Component('../fcalc.spd.xml')

src1 = sb.DataSource()
src2 = sb.DataSource()
sink = sb.DataSink()

src1.connect(c, 'a')
src2.connect(c, 'b')
c.connect(sink, 'floatIn')

c.equation = "math.sin(3*a)+cos(5*b)"
print c.query([])

sb.start()
data1 = [float(x) for x in xrange(1024)]
data2 = [float(x) for x in xrange(-512, 0)]
data3 = [float(x) for x in xrange(0, 512)]
src1.push(data1)
示例#13
0
#f.write('\n\n')

f.write('*********************************\n')
f.write('********** Unit Test 5 **********\n')
f.write('*********************************\n\n')

# This unit test relies on rhSourceVITA49 component for end-to-end testing
if "rh.SourceVITA49" not in sb.catalog():
    print "ERROR - cannot run tests without rh.SourceVITA49. Install in $SDRROOT and try again."
    sys.exit(1)

f.write('********** Creating components and connections **********\n')
sink = sb.launch('../SinkVITA49.spd.xml', execparams={"DEBUG_LEVEL": 0})
source = sb.launch('rh.SourceVITA49', execparams={"DEBUG_LEVEL": 0})
#push data into the sink NIC
inputS = sb.DataSource()
outputS = sb.DataSink()

sink.connect(source, providesPortName='dataVITA49_in')
inputS.connect(sink, providesPortName='dataShort_in')
source.connect(outputS, providesPortName='shortIn')

f.write('***** Source Configuration *****\n')
source.interface = ethernet_device
f.write('source.interface = "em1"\n')
source.attachment_override.enabled = False
f.write('source.attachment_override.enabled = True\n')
source.attachment_override.ip_address = ip_address
f.write('source.attachment_override.ip_address = ip_address\n')
source.attachment_override.port = network_port
f.write('source.attachment_override.port = 29465')
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

import time
from ossie.utils import sb

print '*****************************************'
print '**** Differenetial Decoder Unit Test ****'
print '*****************************************'

print '\n********* Creating Components ***********'
#Use sb helpers for producing and receiving data from component
src = sb.DataSource()
sink = sb.DataSink()
decoder = sb.launch('DifferentialDecoder', execparams={'DEBUG_LEVEL': 5})

print '\n********* Creating Connections **********'
#Make connections
src.connect(decoder)
decoder.connect(sink)
print 'Connections Created'

print '\n*********** Starting Sandbox ************'
#Start sandbox env
sb.start()
print 'Components Started'

print '\n*********** Generating Data *************'
示例#15
0
def main():
    f = open('unit_test.log', 'w')

    display(f, "*********************************")
    display(f, "******** BPSK Unit Test *********")
    display(f, "*********************************")

    # Launch the component and the input sources and output sink
    display(f, "\n******* Creating Component ******")
    test_component = sb.launch('../BPSK.spd.xml',
                               execparams={'DEBUG_LEVEL': 5})
    clockSource = sb.DataSource()
    dataSource = sb.DataSource()
    dataSink = sb.DataSink()

    # Connect the output of the clock source and the data source
    # to the inputs of the BPSK.  Connect the output of the BPSK
    # to the input of the data sink
    display(f, "\n****** Creating Connections *****")
    clockSource.connect(test_component, providesPortName='clockFloat_in')
    dataSource.connect(test_component, providesPortName='dataFloat_in')
    test_component.connect(dataSink, providesPortName='shortIn')
    display(f, "Connections created")

    display(f, "\n******** Generating Data ********")
    # Generate a simple sine wave for use as the clock and the
    # data
    convenient_time_data = linspace(0, 48 * pi, 2400)
    clock = sin(convenient_time_data).tolist()

    display(f, "Single Packet Case...")
    # Use 24 bits to generate a BPSK modulated signal
    single_packet_data = [
        0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1
    ]
    single_packet_keyed_data = []
    i = 0
    for j in single_packet_data:
        for k in range(i, i + 100):
            if j == 1:
                single_packet_keyed_data.append(clock[k])
            else:
                single_packet_keyed_data.append(-clock[k])

        i += 100

    display(f, "Two Packet Case...")
    # Use a 16 bit packet and an 8 bit packet to generate two
    # BPSK modulated signals using the same clock
    two_packet_data1 = [0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1]
    two_packet_data2 = [0, 1, 0, 1, 0, 1, 1, 1]
    two_packet_keyed_data1 = []
    two_packet_keyed_data2 = []
    i = 0
    for j in two_packet_data1:
        for k in range(i, i + 100):
            if j == 1:
                two_packet_keyed_data1.append(clock[k])
            else:
                two_packet_keyed_data1.append(-clock[k])

        i += 100

    for j in two_packet_data2:
        for k in range(i, i + 100):
            if j == 1:
                two_packet_keyed_data2.append(clock[k])
            else:
                two_packet_keyed_data2.append(-clock[k])

        i += 100

    display(f, "Two Packets, Unaligned Case...")
    # Reuse the one packet from above, but send it as two
    # that aren't lined up on the period boundary
    two_packet_unaligned_keyed_data1 = []
    two_packet_unaligned_keyed_data2 = []
    i = 0
    for j in single_packet_data[:14]:
        for k in range(i, i + 100):
            if j == 1:
                two_packet_unaligned_keyed_data1.append(clock[k])
            else:
                two_packet_unaligned_keyed_data1.append(-clock[k])

        i += 100

    for k in range(i, i + 100):
        # Put the first 27 samples into the first packet and the next
        # 73 into the second packet
        if k < (i + 27):
            if single_packet_data[14] == 1:
                two_packet_unaligned_keyed_data1.append(clock[k])
            else:
                two_packet_unaligned_keyed_data1.append(-clock[k])
        else:
            if single_packet_data[14] == 1:
                two_packet_unaligned_keyed_data2.append(clock[k])
            else:
                two_packet_unaligned_keyed_data2.append(-clock[k])

    i += 100

    for j in single_packet_data[15:]:
        for k in range(i, i + 100):
            if j == 1:
                two_packet_unaligned_keyed_data2.append(clock[k])
            else:
                two_packet_unaligned_keyed_data2.append(-clock[k])

        i += 100

    display(f, "\n******* Starting Components ******")
    sb.start()
    display(f, "Component started")
    display(f, "** Testing Single Packet Case **")
    # For now, the only accepted output rate of the BPSK is
    # 1187.5 bps.  Since 100 samples of the clock represents
    # a period, this will force the output to be one bit per
    # period
    clockSource.push(clock, False, 'Test', (100 * 1187.5), False, [], None)
    dataSource.push(single_packet_keyed_data, False, 'Test', (100 * 1187.5),
                    False, [], None)
    time.sleep(1)

    received_data = dataSink.getData()
    passed_test_1 = True
    test_1_message = ""

    displayList(f, "Received Data:  ", received_data)
    displayList(f, "Original Data:  ", single_packet_data)

    # Make sure that the received data and original data
    # are of the same length and that they match
    if len(received_data) == len(single_packet_data):
        for i in range(0, len(received_data)):
            if received_data[i] != single_packet_data[i]:
                passed_test_1 = False
                test_1_message = "received_data[" + str(
                    i) + "] != original_data[" + str(i) + "]"
                break
    else:
        passed_test_1 = False
        test_1_message = "len(received_data) != len(original_data)"

    #******************************************************
    display(f, "\n*** Testing Two Packet Case ****")

    clockSource.push(clock[:len(two_packet_keyed_data1)], False, 'Test',
                     (100 * 1187.5), False, [], None)
    dataSource.push(two_packet_keyed_data1, False, 'Test', (100 * 1187.5),
                    False, [], None)
    time.sleep(1)

    received_data = dataSink.getData()

    clockSource.push(clock[len(two_packet_keyed_data1):], False, 'Test',
                     (100 * 1187.5), False, [], None)
    dataSource.push(two_packet_keyed_data2, False, 'Test', (100 * 1187.5),
                    False, [], None)
    time.sleep(1)

    received_data += dataSink.getData()
    passed_test_2 = True
    test_2_message = ""

    displayList(f, "Received Data:  ", received_data)
    displayList(f, "Original Data1: ", two_packet_data1)
    displayList(f, "Original Data2: ", two_packet_data2)

    # Make sure that the received data and original data
    # are of the same length and that they match
    if len(received_data) == (len(two_packet_data1) + len(two_packet_data2)):
        for i in range(0, len(received_data)):
            if i < len(two_packet_data1):
                if received_data[i] != two_packet_data1[i]:
                    passed_test_2 = False
                    test_2_message = "received_data[" + str(
                        i) + "] != original_data1[" + str(i) + "]"
                    break
            else:
                if received_data[i] != two_packet_data2[i -
                                                        len(two_packet_data1)]:
                    passed_test_2 = False
                    test_2_message = "received_data[" + str(
                        i) + "] != original_data2[" + str(
                            i - len(two_packet_data1)) + "]"
    else:
        passed_test_2 = False
        test_2_message = "len(received_data) != len(original_data1) + len(original_data2)"

    #******************************************************
    display(f, "\n** Testing Two Packet, Unaligned Case **")
    clockSource.push(clock[:len(two_packet_unaligned_keyed_data1)], False,
                     'Test', (100 * 1187.5), False, [], None)
    dataSource.push(two_packet_unaligned_keyed_data1, False, 'Test',
                    (100 * 1187.5), False, [], None)
    time.sleep(1)

    received_data = dataSink.getData()

    clockSource.push(clock[len(two_packet_unaligned_keyed_data1):], False,
                     'Test', (100 * 1187.5), False, [], None)
    dataSource.push(two_packet_unaligned_keyed_data2, False, 'Test',
                    (100 * 1187.5), False, [], None)
    time.sleep(1)

    received_data += dataSink.getData()
    passed_test_3 = True
    test_3_message = ""

    displayList(f, "Received Data:  ", received_data)
    displayList(f, "Original Data:  ", single_packet_data)

    # Make sure that the received data and original data
    # are of the same length and that they match
    if len(received_data) == len(single_packet_data):
        for i in range(0, len(received_data)):
            if received_data[i] != single_packet_data[i]:
                passed_test_3 = False
                test_3_message = "received_data[" + str(
                    i) + "] != original_data[" + str(i) + "]"
                break
    else:
        passed_test_3 = False
        test_3_message = "len(received_data) != len(original_data1) + len(original_data2)"

    display(f, "\n******* Stopping Components ******")
    sb.stop()
    display(f, "Components stopped")

    # Display the results of the unit test
    if passed_test_1:
        display(
            f, "\nSingle Packet Test ...................." +
            u'\u2714'.encode('utf8'))
    else:
        display(
            f, "\nSingle Packet Test ...................." +
            u'\u2718'.encode('utf8') + '\t' + test_1_message)

    if passed_test_2:
        display(
            f, "Two Packet Test ......................." +
            u'\u2714'.encode('utf8'))
    else:
        display(
            f, "Two Packet Test ......................." +
            u'\u2718'.encode('utf8') + '\t' + test_2_message)

    if passed_test_3:
        display(
            f, "Two Packet, Unaligned Test ............" +
            u'\u2714'.encode('utf8'))
    else:
        display(
            f, "Two Packet, Unaligned Test ............" +
            u'\u2718'.encode('utf8') + '\t' + test_3_message)

    display(f, '\n')
    display(f, "Unit Test Complete")

    f.close()
示例#16
0
    def test_bpsk_decode(self):
        nbits = 6000
        samples_per_symbol = 4

        # Generate random bit sequence and convert to BPSK symbols
        bits_in = [random.randint(0, 1) for x in range(nbits)]
        samples_in = symbols_to_samples(bits_to_symbols(bits_in),
                                        samples_per_symbol)

        # Add Gaussian noise and a slow rotation to the symbols
        sig_in = apply_rotation(add_noise(samples_in, 0.10), 0.01)

        # Convert from a list of complex pairs to a single list of floats
        sig_in = expand_complex(sig_in)

        source = sb.DataSource()
        sink = sb.DataSink()

        # FLL
        fll_ntaps = 55
        freq_recov = sb.Component(
            '../components/fll_band_edge_cc_4o/fll_band_edge_cc_4o.spd.xml',
            execparams=execparams)
        freq_recov.samples_per_symbol = samples_per_symbol
        freq_recov.rolloff = 0.35
        freq_recov.filter_size = fll_ntaps
        freq_recov.bandwidth = 2.0 * math.pi / 100.0

        # Timing recovery
        nfilts = 32
        time_recov = sb.Component(
            '../components/pfb_clock_sync_ccf_4o/pfb_clock_sync_ccf_4o.spd.xml',
            execparams=execparams)
        time_recov.sps = samples_per_symbol
        time_recov.loop_bw = 2 * math.pi / 100.0
        # Note: taps are hard-coded
        time_recov.taps = list(bpsk_taps.taps)
        time_recov.filter_size = nfilts
        time_recov.init_phase = nfilts / 2
        time_recov.max_rate_deviation = 1.5
        time_recov.osps = 1

        # BPSK symbol decode
        receiver = sb.Component(
            '../components/psk_demod_cb/psk_demod_cb.spd.xml',
            execparams=execparams)
        receiver.constellation = 1
        receiver.loop_bw = 2 * math.pi / 100.0
        receiver.fmin = -0.25
        receiver.fmax = 0.25

        # Connect components
        source.connect(freq_recov)
        freq_recov.connect(time_recov, usesPortName='data_complex_out')
        time_recov.connect(receiver, usesPortName='data_complex_out')
        receiver.connect(sink)

        # Push data through components, waiting for completion
        sb.start()
        source.push(sig_in, EOS=True, complexData=True)
        sym_out = sink.getData(eos_block=True)
        sb.stop()

        # The symbol is equivalent to the bit value; unpack from a char to
        # a number.
        bits_out = map(lambda x: struct.unpack('b', x)[0], sym_out)

        # The output data is delayed by 34 samples
        delay = 34

        # Verify that our delayed output data matches the input
        bit_errors = 0
        for ii in range(len(bits_out) - delay):
            if bits_out[ii + delay] != bits_in[ii]:
                bit_errors += 1

        self.failUnless(bit_errors == 0, '%d bit errors' % (bit_errors, ))
    def pushDataAndCheck(self,
                         inputData=range(100),
                         expectedOutput=range(100),
                         pause=PAUSE,
                         streamID='defaultStreamID',
                         sampleRate=1.0,
                         complexData=False,
                         SRIKeywords=[],
                         usesPortName="vectorOut0",
                         providesPortName="vectorIn0"):

        dataFormat = "double"
        source = sb.DataSource(dataFormat=dataFormat)
        sink = sb.DataSink()

        # connect source -> compoennt -> sink
        source.connect(self.comp,
                       usesPortName=source.supportedPorts[dataFormat]
                       ["portDict"]["Port Name"],
                       providesPortName=providesPortName)
        self.comp.connect(sink,
                          usesPortName=usesPortName,
                          providesPortName=sink.supportedPorts[dataFormat]
                          ["portDict"]["Port Name"])

        # Start all
        source.start()
        self.comp.start()
        sink.start()
        source.push(inputData,
                    EOS=True,
                    streamID=streamID,
                    sampleRate=sampleRate,
                    complexData=complexData,
                    SRIKeywords=SRIKeywords)

        # Give the component some time to process the data
        time.sleep(pause)
        retData = sink.getData()
        self.assertEquals(retData, expectedOutput)

        # SRI tests
        retSri = sink.sri()
        self.assertEquals(sink.eos(), True)
        self.assertEquals(retSri.streamID, streamID)

        # sample rate is checked via Xdelta
        self.assertEquals(retSri.xdelta, 1. / sampleRate)
        self.assertEquals(retSri.mode, complexData)

        # SRI keywords
        if len(SRIKeywords) != len(retSri.keywords):
            self.fail(
                "Incorrect number of SRI keywords returned by component.")
        for expectedKeyword in SRIKeywords:
            found = False
            for retKeyword in retSri.keywords:
                if retKeyword.id == expectedKeyword._name:
                    self.assertEquals(str(retKeyword.value),
                                      str(any.to_any(expectedKeyword._value)))
                    found = True
                    break
            if not found:
                self.fail("SRI keyword not found: " + expectedKeyword.id)
display(
    f,
    '******************** Unit Test 1 - Lowpass - Real Data ********************\n'
)
display(
    f,
    '***************************************************************************\n\n'
)

#------------------------------------------------
# Create components and connections
#------------------------------------------------
display(f, '* Creating Components and Connections\n')
filt = sb.launch('../FilterDecimate.spd.xml', execparams={"DEBUG_LEVEL": 3})

inputS = sb.DataSource(bytesPerPush=64)
outputS = sb.DataSink()
inputS.connect(filt, providesPortName='dataFloat_in')
filt.connect(outputS, providesPortName='floatIn')

#------------------------------------------------
# Start Components
#------------------------------------------------
display(f, '* Starting Component\n\n')
sb.start()

case = 0
for ii in lowpass_cases:
    case += 1
    passed_count += 1
    display(f, '*** TEST CASE ' + str(passed_count) + ' ***\n')