QPSK encoder with Root-raised-cosine filter reads data from stdin
and prints encoded data to stdout
.
Quadrature Phase Shift Keying is used for the input data encoding.
Output data format: <sample number, I, Q>
, where I(t)
and Q(t)
are the modulating signals.
If benchmark mode is on, then the encoding speed (bit/s) is printed to stdout
.
The encoder parameters are set in qpsk_encoder.ini file :
[Options]
FilterWidth: 10
SymbolWidth: 4
Beta: 0.25
ReadBufferSize: 1
CsvRounding: 3
[Debug]
Benchmark: False
-
FilterWidth
- the number of samples to apply the filter. -
SymbolWidth
- the number of samples per symbol. -
Beta
- β, or the roll-off factor - the parameter for Root-raised-cosine filter. -
ReadBufferSize
- the buffer size for data reading fromstdin
or file. -
CsvRounding
- the number of decimal places forI
andQ
parameters rounding. -
Benchmark
:Benchmark: False
- the encoding mode is on.Benchmark: True
- the benchmark mode is on. The input data fromstdin
is encoded, but only the encoding speed (bit/s) is printed tostdout
.
- Python 3
Run the encoder from the command line:
python3 qpsk_encoder.py < input.file > output.csv
echo 1 | python3 qpsk_encoder.py
where
echo 1
prints '1' to stdout
, and
| python3 qpsk_encoder.py
reads '1' from stdin
and encodes it into 32 samples, as there are 8 bits in the input '1' character and each input bit is encoded into 4 samples as SymbolWidth
parameter is set to 4.
The resulting output in `stdout` :
1,-0.046,-0.046
2,-0.113,-0.113
3,-0.150,-0.150
4,-0.111,-0.111
5,0.101,0.101
6,0.375,0.375
7,0.495,0.495
8,0.249,0.249
9,-0.523,-0.523
10,-1.604,-1.604
11,-2.526,-2.526
12,-2.778,-2.778
13,-2.098,-2.006
14,-0.651,-0.426
15,0.996,1.296
16,2.134,2.356
17,2.254,2.144
18,1.296,0.771
19,-0.344,-1.034
20,-2.025,-2.301
21,-3.145,-2.301
22,-3.559,-1.101
23,-3.393,0.667
24,-2.979,2.079
25,-2.646,2.319
26,-2.435,1.400
27,-2.435,-0.277
28,-2.646,-2.025
29,-2.887,-3.145
30,-3.168,-3.559
31,-3.259,-3.393
32,-2.922,-2.979
Andrey Filonov, [email protected]
QPSK encoder
is available under the MIT license. See the LICENSE file for more info.