|
1 | 1 | # Python-polar-coding |
2 | | -A package for modelling Polar codes. |
| 2 | + |
| 3 | +A package for Polar codes simulation. |
3 | 4 |
|
4 | 5 | ## Installation |
5 | 6 |
|
6 | | -`pip install git+git://github.com/fr0mhell/python-polar-coding.git#egg=python_polar_coding` |
| 7 | +```bash |
| 8 | +pip install git+git://github.com/fr0mhell/python-polar-coding.git#egg=python_polar_coding |
| 9 | +``` |
| 10 | + |
| 11 | +## Example |
| 12 | + |
| 13 | +Here is a simple example of simulation using `python_polar_coding`. |
| 14 | + |
| 15 | +Binary messages encoded with Polar code, modulated using BPSK, transmitted over |
| 16 | +channel with AWGN and decoded using [Fast SSC](https://arxiv.org/abs/1307.7154) algorithm. |
| 17 | + |
| 18 | +```python |
| 19 | +from python_polar_coding.channels import SimpleBPSKModulationAWGN |
| 20 | +from python_polar_coding.polar_codes import FastSSCPolarCodec |
| 21 | +from python_polar_coding.simulation.functions import ( |
| 22 | + compute_fails, |
| 23 | + generate_binary_message, |
| 24 | +) |
| 25 | + |
| 26 | +N = 128 |
| 27 | +K = 64 |
| 28 | +design_snr = 2.0 |
| 29 | +messages = 10000 |
| 30 | +# SNR in [.0, .5, ..., 4.5, 5] |
| 31 | +snr_range = [i / 2 for i in range(11)] |
| 32 | + |
| 33 | +codec = FastSSCPolarCodec(N=N, K=K, design_snr=design_snr) |
| 34 | +bpsk = SimpleBPSKModulationAWGN(fec_rate=K/N) |
| 35 | + |
| 36 | +result_ber = dict() |
| 37 | +result_fer = dict() |
| 38 | + |
| 39 | +for snr in snr_range: |
| 40 | + ber = 0 |
| 41 | + fer = 0 |
| 42 | + |
| 43 | + for _ in range(messages): |
| 44 | + msg = generate_binary_message(size=K) |
| 45 | + encoded = codec.encode(msg) |
| 46 | + transmitted = bpsk.transmit(message=msg, snr_db=snr) |
| 47 | + decoded = codec.decode(transmitted) |
| 48 | + |
| 49 | + bit_errors, frame_error = compute_fails(msg, decoded) |
| 50 | + ber += bit_errors |
| 51 | + fer += frame_error |
| 52 | + |
| 53 | + result_ber[snr] = ber |
| 54 | + result_fer[snr] = fer |
| 55 | +``` |
7 | 56 |
|
8 | 57 | ## Current progress |
9 | 58 |
|
10 | | -**Polar code construction:** |
| 59 | +### Polar code construction |
| 60 | + |
| 61 | +- [x] Arikan's Bhattacharyya bounds [Section V.A](https://arxiv.org/pdf/1501.02473.pdf) |
| 62 | + |
| 63 | +### Decoding |
| 64 | +- [x] SC Decoding |
| 65 | +- [x] [SC LIST Decoding](https://arxiv.org/abs/1206.0050) |
| 66 | +- [x] [Fast SSC Decoding](https://arxiv.org/abs/1307.7154) |
| 67 | +- [x] [RC SCAN Decoding]() |
| 68 | +- [x] [Generalized Fast SSC Decoding](https://arxiv.org/pdf/1804.09508.pdf) |
| 69 | + |
| 70 | +### Modulation |
| 71 | + |
| 72 | +- [x] BPSK |
11 | 73 |
|
12 | | -- [x] Arikan's Bhattacharyya bounds [Section V.A](https://arxiv.org/pdf/1501.02473.pdf); |
13 | | -- [ ] Arikan’s Monte-Carlo estimation [Section V.B](https://arxiv.org/pdf/1501.02473.pdf); |
14 | | -- [ ] Trifonov’s Gaussian approximation [Section V.D](https://arxiv.org/pdf/1501.02473.pdf); |
| 74 | +## TODO |
15 | 75 |
|
16 | | -**Decoding:** |
17 | | -- [x] SC Decoding; |
18 | | -- [x] [SC LIST Decoding](https://arxiv.org/abs/1206.0050); |
19 | | -- [ ] [SC STACK Decoding](https://ieeexplore.ieee.org/document/6215306/?denied=); |
20 | | -- [x] [Fast SSC Decoding](https://arxiv.org/abs/1307.7154); |
21 | | -- [x] [RC SCAN Decoding](); |
22 | | -- [x] [Generalized Fast SSC Decoding](https://arxiv.org/pdf/1804.09508.pdf); |
23 | | -- [ ] [Generalized Fast SSC LIST Decoding](https://arxiv.org/pdf/1804.09508.pdf); |
| 76 | +[TODO List](TODO.md) |
24 | 77 |
|
25 | | -**Modulation:** |
| 78 | +## License |
26 | 79 |
|
27 | | -- [x] BPSK; |
28 | | -- [ ] M-PSK; |
29 | | -- [ ] M-QAM; |
| 80 | +[MIT License](LICENSE.MD) |
0 commit comments