Skip to content

Commit 0e954b6

Browse files
author
grigory
committed
Reorganize code of SC List Polar codec
1 parent a7f74db commit 0e954b6

File tree

18 files changed

+236
-307
lines changed

18 files changed

+236
-307
lines changed

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

python_polar_coding/polar_codes/decoders/sc_list_decoder.py

Lines changed: 0 additions & 214 deletions
This file was deleted.

python_polar_coding/polar_codes/sc_list.py

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .codec import SCListPolarCodec
2+
from .decoder import SCListDecoder
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from typing import Union
2+
3+
from ..base import BasePolarCodec
4+
from .decoder import SCListDecoder
5+
6+
7+
class SCListPolarCodec(BasePolarCodec):
8+
"""Polar code with SC List decoding algorithm."""
9+
decoder_class = SCListDecoder
10+
11+
def __init__(self, N: int, K: int,
12+
design_snr: float = 0.0,
13+
is_systematic: bool = True,
14+
mask: Union[str, None] = None,
15+
pcc_method: str = BasePolarCodec.BHATTACHARYYA,
16+
L: int = 1):
17+
18+
self.L = L
19+
super().__init__(N=N, K=K,
20+
is_systematic=is_systematic,
21+
design_snr=design_snr,
22+
mask=mask,
23+
pcc_method=pcc_method)
24+
25+
def init_decoder(self):
26+
return self.decoder_class(n=self.n, mask=self.mask,
27+
is_systematic=self.is_systematic, L=self.L)
28+
29+
def to_dict(self):
30+
d = super().to_dict()
31+
d.update({'L': self.L})
32+
return d

0 commit comments

Comments
 (0)