Пример #1
0
 def test_001(self):
     
     src1_data = [0,2,-3,0,12,0]
     src2_data = [0,0,3,0,10,0]
     src3_data = (0,0,3,0,1,0)
     src4_data = (0,1,8,6,3,4)
     a = sb.DataSource(dataFormat="short")
     b = sb.DataSource(dataFormat="short")
     c = sb.DataSource(dataFormat="short")
     d = sb.DataSource(dataFormat="short")
     argmax = gr.argmax(gr.sizeof_short, len(src1_data), 4)
     a.connect(argmax,providesPortName="short_in_1")
     b.connect(argmax,providesPortName="short_in_2")
     c.connect(argmax,providesPortName="short_in_3")
     d.connect(argmax,providesPortName="short_in_4")
     dest1 = gr.vector_sink_s ()
     dest2 = gr.vector_sink_s ()
     argmax.connect(dest1,usesPortName="short_out_1")
     argmax.connect(dest2,usesPortName="short_out_2")
     sb.start()
     a.push(src1_data,EOS=True)
     b.push(src2_data,EOS=True)
     c.push(src2_data,EOS=True)
     d.push(src2_data,EOS=True)
     index = dest1.getData(eos_block=True)
     source = dest2.getData(eos_block=True)
     self.assertEqual ( tuple(index), (4,))
     self.assertEqual ( tuple(source), (0,))
Пример #2
0
    def test_001(self):

        src1_data = [0, 2, -3, 0, 12, 0]
        src2_data = [0, 0, 3, 0, 10, 0]
        src3_data = (0, 0, 3, 0, 1, 0)
        src4_data = (0, 1, 8, 6, 3, 4)
        a = sb.DataSource(dataFormat="short")
        b = sb.DataSource(dataFormat="short")
        c = sb.DataSource(dataFormat="short")
        d = sb.DataSource(dataFormat="short")
        argmax = gr.argmax(gr.sizeof_short, len(src1_data), 4)
        a.connect(argmax, providesPortName="short_in_1")
        b.connect(argmax, providesPortName="short_in_2")
        c.connect(argmax, providesPortName="short_in_3")
        d.connect(argmax, providesPortName="short_in_4")
        dest1 = gr.vector_sink_s()
        dest2 = gr.vector_sink_s()
        argmax.connect(dest1, usesPortName="short_out_1")
        argmax.connect(dest2, usesPortName="short_out_2")
        sb.start()
        a.push(src1_data, EOS=True)
        b.push(src2_data, EOS=True)
        c.push(src2_data, EOS=True)
        d.push(src2_data, EOS=True)
        index = dest1.getData(eos_block=True)
        source = dest2.getData(eos_block=True)
        self.assertEqual(tuple(index), (4, ))
        self.assertEqual(tuple(source), (0, ))
Пример #3
0
 def test_001(self):
     
     src1_data = [0,0.2,-0.3,0,12,0]
     a = sb.DataSource(dataFormat="float")
     argmax = gr.argmax(gr.sizeof_float, len(src1_data),1 )
     a.connect(argmax,providesPortName="float_in")
     dest1 = gr.vector_sink_s ()
     dest2 = gr.vector_sink_s ()
     argmax.connect(dest1,usesPortName="short_out_1")
     argmax.connect(dest2,usesPortName="short_out_2")
     sb.start()
     a.push(src1_data,EOS=True)
     index = dest1.getData(eos_block=True)
     source = dest2.getData(eos_block=True)
     self.assertEqual ( tuple(index), (4,))
     self.assertEqual ( tuple(source), (0,))
Пример #4
0
    def test_001(self):

        src1_data = [0, 0.2, -0.3, 0, 12, 0]
        a = sb.DataSource(dataFormat="float")
        argmax = gr.argmax(gr.sizeof_float, len(src1_data), 1)
        a.connect(argmax, providesPortName="float_in")
        dest1 = gr.vector_sink_s()
        dest2 = gr.vector_sink_s()
        argmax.connect(dest1, usesPortName="short_out_1")
        argmax.connect(dest2, usesPortName="short_out_2")
        sb.start()
        a.push(src1_data, EOS=True)
        index = dest1.getData(eos_block=True)
        source = dest2.getData(eos_block=True)
        self.assertEqual(tuple(index), (4, ))
        self.assertEqual(tuple(source), (0, ))