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

# remove print for now
print = lambda x: None

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)