aboutsummaryrefslogtreecommitdiffstats
path: root/tests/correlator/epy_block_1.py
blob: 7e722fc748c234823a5f88b10b4d2663fd6d5936 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import numpy as np
from gnuradio import gr

np.set_printoptions(formatter={'int':hex})

class blk(gr.sync_block):
    def __init__(self, vlen=1):
        dt = np.byte if vlen == 1 else (np.byte, vlen)

        gr.sync_block.__init__(
            self,
            name='Printer',
            in_sig=[(np.byte, vlen)],
            out_sig=[]
        )

    def work(self, input_items, output_items):
        inp = np.array(input_items[0], dtype=np.uint8)
        print(f"Decoded {len(inp)} samples:\n{inp}")

        return len(inp)