Skip to content

Commit f857a34

Browse files
author
grigory
committed
Merge branch 'feature/improve-codec-structure'
2 parents 4c1a92b + b640e6e commit f857a34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+920
-942
lines changed

.isort.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[settings]
2+
line_length=79
3+
length_sort_stdlib=1
4+
multi_line_output=3
5+
include_trailing_comma=True

Changelog.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
## 0.2.1
2-
3-
Fix issues with decoding tree of `FastSSCDecoder` and `GeneralizedFastSSCDecoder`
4-
5-
## 0.2.0
6-
7-
Add implementation of [Generalized Fast SSC Decoding](https://arxiv.org/pdf/1804.09508.pdf).
8-
9-
## 0.1.1
10-
11-
Improve the structure of Fast SSC polar code
1+
# Changelog
122

133
## 0.1.0
144

README.md

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,80 @@
11
# Python-polar-coding
2-
A package for modelling Polar codes.
2+
3+
A package for Polar codes simulation.
34

45
## Installation
56

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+
```
756

857
## Current progress
958

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
1173

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
1575

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)
2477

25-
**Modulation:**
78+
## License
2679

27-
- [x] BPSK;
28-
- [ ] M-PSK;
29-
- [ ] M-QAM;
80+
[MIT License](LICENSE.MD)

TODO.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# TODO List
2+
3+
### Polar code construction
4+
5+
- [ ] Arikan’s Monte-Carlo estimation [Section V.B](https://arxiv.org/pdf/1501.02473.pdf)
6+
- [ ] Trifonov’s Gaussian approximation [Section V.D](https://arxiv.org/pdf/1501.02473.pdf)
7+
8+
### Decoding
9+
- [ ] [SC STACK Decoding](https://ieeexplore.ieee.org/document/6215306)
10+
- [ ] [Fast SSC List Decoding](https://arxiv.org/pdf/1703.08208.pdf)
11+
- [ ] [Generalized Fast SSC LIST Decoding](https://arxiv.org/pdf/1804.09508.pdf)
12+
13+
### Modulation
14+
15+
- [ ] Q-PSK
16+
- [ ] 4-QAM
17+
18+
### General
19+
20+
- [ ] Add tests for CRC
21+
- [ ] Fix CRC-aided SC List decoder

examples/modelling/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from datetime import datetime
21
from math import ceil
32
from random import shuffle
3+
from datetime import datetime
44

55
import numpy as np
66
from pymongo import MongoClient

examples/modelling/runner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import multiprocessing
2-
from concurrent import futures
32
from datetime import datetime
43
from functools import partial
4+
from concurrent import futures
55

6-
from examples.modelling.functions import (generate_simulation_parameters,
7-
simulation_task)
6+
from examples.modelling.functions import (
7+
generate_simulation_parameters,
8+
simulation_task,
9+
)
810
from examples.modelling.mongo import DB_NAME
911
from python_polar_coding.channels.simple import SimpleBPSKModulationAWGN
1012

examples/simple_simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from datetime import datetime
22

33
from python_polar_coding.channels.simple import SimpleBPSKModulationAWGN
4-
from python_polar_coding.polar_codes.fast_ssc import FastSSCPolarCode
4+
from python_polar_coding.polar_codes import FastSSCPolarCodec
55
from python_polar_coding.simulation import simulation_task
66

77

88
def fast_ssc_simulation():
9-
code = FastSSCPolarCode(N=4096, K=1024, design_snr=2.0)
9+
code = FastSSCPolarCodec(N=4096, K=1024, design_snr=2.0)
1010
channel = SimpleBPSKModulationAWGN(fec_rate=code.K/code.N)
1111
snr_range = [1.0, 1.5, 2.0, 2.5, 3.0]
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .simple import SimpleAWGNChannel
1+
from .simple import SimpleAWGNChannel, SimpleBPSKModulationAWGN
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .fast_ssc import FastSSCPolarCode
2-
from .g_fast_ssc import GeneralizedFastSSCPolarCode
3-
from .rc_scan import RCSCANPolarCode
4-
from .sc import SCPolarCode
5-
from .sc_list import SCListPolarCode
1+
from .fast_ssc import FastSSCPolarCodec
2+
from .g_fast_ssc import GeneralizedFastSSCPolarCodec
3+
from .rc_scan import RCSCANPolarCodec
4+
from .sc import SCPolarCodec
5+
from .sc_list import SCListPolarCodec
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .codec import BaseCRCPolarCodec, BasePolarCodec
2+
from .decoder import BaseDecoder
3+
from .decoding_path import DecodingPathMixin
4+
from .functions import *

0 commit comments

Comments
 (0)