55from ..channels import SimpleAWGNChannel
66from ..modems import SimpleBPSKModem
77from ..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
1414from . 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
3342class ChannelTypes :
@@ -37,7 +46,7 @@ class ChannelTypes:
3746CODE_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
121134def 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 ()
0 commit comments