aboutsummaryrefslogtreecommitdiffstats
path: root/doc/thesis/figures/data/qpsk_hw_lab.py
blob: 741f32f9e48c612c7a770573dec38323c8cce63a (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
25
26
27
28
29
30
31
#!/usr/bin/env python3

import utils
import numpy as np

# get array of samples [channel, synchronized, equalized, locked]
samples = utils.load_samples(__file__)

# range of samples we want to show
start = 250e3
end = start +400

# select every second samples
select_samples = lambda arr: arr[int(start):int(end):6]
values = map(select_samples, samples)

# split into imaginary and real parts
get_parts = lambda v: (np.real(v), np.imag(v))
parts = [p for v in map(get_parts, values) for p in v]

# zip data and add header
data = np.array(list(zip(*parts)))
headers = [
    "channel_re",      "channel_im",
    "synchronized_re", "synchronized_im",
    "equalized_re",    "equalized_im",
    "locked_re",       "locked_im"
]

# save to file
utils.save_to_file(__file__, data, headers)