Example #1
0
 def test04 (self):
     try: mgr = pmt.pmt_mgr()
     except: return #may not be implemented
     mgr.set(pmt.pmt_make_blob(100))
     mgr.set(pmt.pmt_make_blob(100))
     a = mgr.acquire(False)
     b = mgr.acquire(False)
     c = mgr.acquire(False)
     self.assertTrue(not pmt.pmt_is_null(a))
     self.assertTrue(not pmt.pmt_is_null(b))
     self.assertTrue(pmt.pmt_is_null(c))
Example #2
0
 def test04(self):
     try:
         mgr = pmt.pmt_mgr()
     except:
         return  #may not be implemented
     mgr.set(pmt.pmt_make_blob(100))
     mgr.set(pmt.pmt_make_blob(100))
     a = mgr.acquire(False)
     b = mgr.acquire(False)
     c = mgr.acquire(False)
     self.assertTrue(not pmt.pmt_is_null(a))
     self.assertTrue(not pmt.pmt_is_null(b))
     self.assertTrue(pmt.pmt_is_null(c))
Example #3
0
    def test03 (self):
        randints = numpy.random.randint(0, 256, 123)
        blob = pmt.pmt_make_blob(len(randints))
        blob_data = pmt.pmt_blob_data(blob)

        blob_data[:] = randints #assign rand ints to data
        self.assertItemsEqual(blob_data, randints)

        blob_data = pmt.pmt_blob_data(blob)
        self.assertItemsEqual(blob_data, randints)
Example #4
0
    def test03(self):
        randints = numpy.random.randint(0, 256, 123)
        blob = pmt.pmt_make_blob(len(randints))
        blob_data = pmt.pmt_blob_data(blob)

        blob_data[:] = randints  #assign rand ints to data
        self.assertItemsEqual(blob_data, randints)

        blob_data = pmt.pmt_blob_data(blob)
        self.assertItemsEqual(blob_data, randints)
Example #5
0
 def __init__(self, msgq):
     gr.block.__init__(
         self, name = "_queue_to_blob",
         in_sig = None, out_sig = None,
         num_msg_outputs = 1
     )
     self._msgq = msgq
     self._mgr = pmt.pmt_mgr()
     for i in range(64):
         self._mgr.set(pmt.pmt_make_blob(10000))
Example #6
0
def numpy_to_blob(p):
    p = p.view(numpy.uint8)
    b = pmt.pmt_make_blob(len(p))
    pmt.pmt_blob_data(b)[:] = p
    return b
Example #7
0
def numpy_to_blob(p):
    p = p.view(numpy.uint8)
    b = pmt.pmt_make_blob(len(p))
    pmt.pmt_blob_data(b)[:] = p
    return b