discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Python block inputting vectors of random sizes


From: Chad R
Subject: [Discuss-gnuradio] Python block inputting vectors of random sizes
Date: Tue, 29 Sep 2015 17:21:40 +0200

Good day everyone

Could some please explain to me where I'm missinterpreting how to implement a block. My block code is

import numpy as np
from gnuradio import gr

class compress_ff(gr.sync_block):
    """
    Compressing Block
    """
    def __init__(self, n, m):
    global phi
    N = n
    M = m
    phi = np.load("/home/chad/Desktop/PROJECT/Python/Matrices/phi_mtx%(M)dx%(N)d.npy" %{"M":M,"N":N})
        gr.sync_block.__init__(self,
            name="compress_cc",
            in_sig=[(np.float32,N)],
            out_sig=[(np.float32,M)])

    def work(self, input_items, output_items):
        in0 = input_items[0]
    print "compin0"
    print np.shape(in0)
    in0 = in0.conj().transpose()
    out = np.dot(phi,in0)
    out = out.conj().transpose()
        # <+signal processing here+>
        output_items[0][:] = out
        return len(output_items[0])

which I would expect to take in an N length vector and return an M length vector. However my input vector, in0. Seems to be arbitarially (random number, N) in size. The random number is a multiple of four which I presume is due to the data type. I have matching data types so I am confuse as to why its not creating a (1,N) vector. Any help would be greatly appreciated.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]