Skip to content

Commit 7cf0e2f

Browse files
author
grigory
committed
Remove codec tests for codes with N = 2048
1 parent 70304b0 commit 7cf0e2f

File tree

14 files changed

+127
-626
lines changed

14 files changed

+127
-626
lines changed
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 GFastSSCPolarCodec
3+
from .rc_scan import RCSCANPolarCodec
4+
from .sc import SCPolarCodec
5+
from .sc_list import SCListPolarCodec
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .codec import GeneralizedFastSSCPolarCodec
2-
from .decoder import GeneralizedFastSSCDecoder
1+
from .codec import GFastSSCPolarCodec
2+
from .decoder import GFastSSCDecoder
33
from .node import GFastSSCNode

python_polar_coding/polar_codes/g_fast_ssc/codec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
from python_polar_coding.polar_codes.fast_ssc import FastSSCPolarCodec
44

5-
from .decoder import GeneralizedFastSSCDecoder
5+
from .decoder import GFastSSCDecoder
66

77

8-
class GeneralizedFastSSCPolarCodec(FastSSCPolarCodec):
8+
class GFastSSCPolarCodec(FastSSCPolarCodec):
99
"""Generalized Fast SSC code.
1010
1111
Based on: https://arxiv.org/pdf/1804.09508.pdf
1212
1313
"""
14-
decoder_class = GeneralizedFastSSCDecoder
14+
decoder_class = GFastSSCDecoder
1515

1616
def __init__(
1717
self,

python_polar_coding/polar_codes/g_fast_ssc/decoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
from .node import GFastSSCNode
66

77

8-
class GeneralizedFastSSCDecoder(FastSSCDecoder):
8+
class GFastSSCDecoder(FastSSCDecoder):
99
node_class = GFastSSCNode
1010

11-
def __init__(self, n: int, mask: np.array, AF: int = 1):
11+
def __init__(self, n: int, mask: np.array, AF: int = 0):
1212
self.AF = AF
1313
super().__init__(n=n, mask=mask)
1414

python_polar_coding/simulation/simulation.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
from ..channels import SimpleAWGNChannel
66
from ..modems import SimpleBPSKModem
77
from ..polar_codes import (
8-
FastSCANCodec,
98
FastSSCPolarCodec,
10-
GeneralizedFastSSCPolarCodec,
11-
GFastSCANCodec,
9+
GFastSSCPolarCodec,
1210
RCSCANPolarCodec,
1311
)
12+
from ..polar_codes.fast_scan import FastSCANCodec
13+
from ..polar_codes.g_fast_scan import GFastSCANCodec
1414
from . import functions, http
1515

1616

@@ -28,6 +28,15 @@ class CodeTypes:
2828
FAST_SCAN,
2929
G_FAST_SCAN,
3030
]
31+
SCAN = [
32+
RC_SCAN,
33+
FAST_SCAN,
34+
G_FAST_SCAN,
35+
]
36+
GENERALIZED = [
37+
G_FAST_SSC,
38+
G_FAST_SCAN,
39+
]
3140

3241

3342
class ChannelTypes:
@@ -37,7 +46,7 @@ class ChannelTypes:
3746
CODE_MAP = {
3847
CodeTypes.FAST_SSC: FastSSCPolarCodec,
3948
CodeTypes.RC_SCAN: RCSCANPolarCodec,
40-
CodeTypes.G_FAST_SSC: GeneralizedFastSSCPolarCodec,
49+
CodeTypes.G_FAST_SSC: GFastSSCPolarCodec,
4150
CodeTypes.FAST_SCAN: FastSCANCodec,
4251
CodeTypes.G_FAST_SCAN: GFastSCANCodec,
4352
}
@@ -101,10 +110,14 @@ def simulate_from_params(url: str):
101110
code_params=experiment,
102111
)
103112

104-
result_log = (f'Result: {result}\n'
105-
f'{code_type.upper()} ({experiment["N"]},{experiment["K"]})')
106-
if code_type == CodeTypes.RC_SCAN:
113+
result_log = (
114+
f'Result: {result}\n'
115+
f'{code_type.upper()} ({experiment["N"]},{experiment["K"]})'
116+
)
117+
if code_type in CodeTypes.SCAN:
107118
result_log += f', I = {experiment["I"]}'
119+
if code_type in CodeTypes.GENERALIZED:
120+
result_log += f', AF = {experiment["AF"]}'
108121
print(result_log)
109122

110123
resp = http.save_result(
@@ -115,7 +128,7 @@ def simulate_from_params(url: str):
115128
channel_type=channel_type,
116129
cls=cls,
117130
)
118-
print(f'Status: {resp.status_code}: {resp.json()}')
131+
print(f'Status {resp.status_code}: {resp.json()}')
119132

120133

121134
def simulate_multi_core(experiments: int, url: str):
@@ -124,8 +137,10 @@ def simulate_multi_core(experiments: int, url: str):
124137
print(f'Workers: {workers}; Number of experiments: {experiments}')
125138

126139
with futures.ProcessPoolExecutor(max_workers=workers) as ex:
127-
run_tasks = {ex.submit(simulate_from_params, *(url, )): (url, )
128-
for _ in range(experiments)}
140+
run_tasks = {
141+
ex.submit(simulate_from_params, *(url, )): (url, )
142+
for _ in range(experiments)
143+
}
129144
for future in futures.as_completed(run_tasks):
130145
try:
131146
future.result()

python_polar_coding/tests/test_fast_scan/test_codec.py

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,6 @@ class TestFastSCANCodec_1024_768(BasicVerifyPolarCode, TestCase):
3131
}
3232

3333

34-
class TestFastSCANCodec_2048_512(BasicVerifyPolarCode, TestCase):
35-
polar_code_class = FastSCANCodec
36-
code_parameters = {
37-
'N': 2048,
38-
'K': 512,
39-
'I': 1,
40-
}
41-
42-
43-
class TestFastSCANCodec_2048_1024(BasicVerifyPolarCode, TestCase):
44-
polar_code_class = FastSCANCodec
45-
code_parameters = {
46-
'N': 2048,
47-
'K': 1024,
48-
'I': 1,
49-
}
50-
51-
52-
class TestFastSCANCodec_2048_1536(BasicVerifyPolarCode, TestCase):
53-
polar_code_class = FastSCANCodec
54-
code_parameters = {
55-
'N': 2048,
56-
'K': 1536,
57-
'I': 1,
58-
}
59-
60-
6134
# Iterations 2
6235

6336

@@ -88,33 +61,6 @@ class TestFastSCANCodec_1024_768_iter_2(BasicVerifyPolarCode, TestCase):
8861
}
8962

9063

91-
class TestFastSCANCodec_2048_512_iter_2(BasicVerifyPolarCode, TestCase):
92-
polar_code_class = FastSCANCodec
93-
code_parameters = {
94-
'N': 2048,
95-
'K': 512,
96-
'I': 2,
97-
}
98-
99-
100-
class TestFastSCANCodec_2048_1024_iter_2(BasicVerifyPolarCode, TestCase):
101-
polar_code_class = FastSCANCodec
102-
code_parameters = {
103-
'N': 2048,
104-
'K': 1024,
105-
'I': 2,
106-
}
107-
108-
109-
class TestFastSCANCodec_2048_1536_iter_2(BasicVerifyPolarCode, TestCase):
110-
polar_code_class = FastSCANCodec
111-
code_parameters = {
112-
'N': 2048,
113-
'K': 1536,
114-
'I': 2,
115-
}
116-
117-
11864
# Iterations 4
11965

12066

@@ -143,30 +89,3 @@ class TestFastSCANCodec_1024_768_iter_4(BasicVerifyPolarCode, TestCase):
14389
'K': 768,
14490
'I': 4,
14591
}
146-
147-
148-
class TestFastSCANCodec_2048_512_iter_4(BasicVerifyPolarCode, TestCase):
149-
polar_code_class = FastSCANCodec
150-
code_parameters = {
151-
'N': 2048,
152-
'K': 512,
153-
'I': 4,
154-
}
155-
156-
157-
class TestFastSCANCodec_2048_1024_iter_4(BasicVerifyPolarCode, TestCase):
158-
polar_code_class = FastSCANCodec
159-
code_parameters = {
160-
'N': 2048,
161-
'K': 1024,
162-
'I': 4,
163-
}
164-
165-
166-
class TestFastSCANCodec_2048_1536_iter_4(BasicVerifyPolarCode, TestCase):
167-
polar_code_class = FastSCANCodec
168-
code_parameters = {
169-
'N': 2048,
170-
'K': 1536,
171-
'I': 4,
172-
}

python_polar_coding/tests/test_fast_ssc/test_codec.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,3 @@ class TestFastSSCCode_1024_768(BasicVerifyPolarCode, TestCase):
2626
'N': 1024,
2727
'K': 768,
2828
}
29-
30-
31-
class TestFastSSCCode_2048_512(BasicVerifyPolarCode, TestCase):
32-
polar_code_class = FastSSCPolarCodec
33-
code_parameters = {
34-
'N': 2048,
35-
'K': 512,
36-
}
37-
38-
39-
class TestFastSSCCode_2048_1024(BasicVerifyPolarCode, TestCase):
40-
polar_code_class = FastSSCPolarCodec
41-
code_parameters = {
42-
'N': 2048,
43-
'K': 1024,
44-
}
45-
46-
47-
class TestFastSSCCode_2048_1536(BasicVerifyPolarCode, TestCase):
48-
polar_code_class = FastSSCPolarCodec
49-
code_parameters = {
50-
'N': 2048,
51-
'K': 1536,
52-
}

0 commit comments

Comments
 (0)