Skip to content

Commit b640e6e

Browse files
author
grigory
committed
Update docs
1 parent 92da2b1 commit b640e6e

File tree

9 files changed

+109
-40
lines changed

9 files changed

+109
-40
lines changed

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/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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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

python_polar_coding/polar_codes/crc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def _compute_crc(self, message: np.array) -> int:
3636
def check_crc(self, message: np.array) -> bool:
3737
"""Check if message has errors or not using CRC."""
3838
received_crc = int(
39-
''.join([str(m) for m in message[-self.crc_size::]]), 2)
39+
''.join([str(m) for m in message[-self.crc_size::]]),
40+
2
41+
)
4042
check_crc = self._compute_crc(message[:-self.crc_size])
4143
return received_crc == check_crc

python_polar_coding/simulation/simulation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from ..channels import SimpleAWGNChannel
66
from ..modems import SimpleBPSKModem
77
from ..polar_codes import (
8-
FastSSCPolarCode,
9-
GeneralizedFastSSCPolarCode,
10-
RCSCANPolarCode,
8+
FastSSCPolarCodec,
9+
GeneralizedFastSSCPolarCodec,
10+
RCSCANPolarCodec,
1111
)
1212
from . import functions, http
1313

@@ -25,9 +25,9 @@ class ChannelTypes:
2525

2626

2727
CODE_MAP = {
28-
CodeTypes.FAST_SSC: FastSSCPolarCode,
29-
CodeTypes.RC_SCAN: RCSCANPolarCode,
30-
CodeTypes.G_FAST_SSC: GeneralizedFastSSCPolarCode,
28+
CodeTypes.FAST_SSC: FastSSCPolarCodec,
29+
CodeTypes.RC_SCAN: RCSCANPolarCodec,
30+
CodeTypes.G_FAST_SSC: GeneralizedFastSSCPolarCodec,
3131
}
3232

3333

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setuptools.setup(
1414
name='python-polar-coding',
15-
version='0.2.1',
15+
version='0.1.0',
1616
author='Grigory Timofeev',
1717
author_email='[email protected]',
1818
description='Polar coding implementation in Python',

0 commit comments

Comments
 (0)