Skip to content

Commit

Permalink
Merge branch 'feature/fix-installation'
Browse files Browse the repository at this point in the history
  • Loading branch information
grigory committed Aug 6, 2020
2 parents d6b4dcc + 05fd31b commit cdd1a8a
Show file tree
Hide file tree
Showing 52 changed files with 345 additions and 837 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: python
python:
- "3.6"
- "3.7"
- "3.8"
install:
- pip install -r requirements.txt
script:
- make test
File renamed without changes.
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include pyproject.toml

# Include the README
include README.md

# Include the license file
include LICENSE.txt
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -----------------------------------------------------------------------------
# Run tests
# -----------------------------------------------------------------------------

test:
python -m unittest discover
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,25 @@ for snr in snr_range:

## TODO

[TODO List](TODO.md)
### General

- [ ] Fix CRC-aided SC List decoder

### Polar code construction

- [ ] Arikan’s Monte-Carlo estimation [Section V.B](https://arxiv.org/pdf/1501.02473.pdf)
- [ ] Trifonov’s Gaussian approximation [Section V.D](https://arxiv.org/pdf/1501.02473.pdf)

### Decoding
- [ ] [SC STACK Decoding](https://ieeexplore.ieee.org/document/6215306)
- [ ] [Fast SSC List Decoding](https://arxiv.org/pdf/1703.08208.pdf)
- [ ] [Generalized Fast SSC LIST Decoding](https://arxiv.org/pdf/1804.09508.pdf)

### Modulation

- [ ] Q-PSK
- [ ] 4-QAM

## License

[MIT License](LICENSE.MD)
[MIT License](LICENSE.txt)
21 changes: 0 additions & 21 deletions TODO.md

This file was deleted.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build-system]
# These are the assumed default build requirements from pip:
# https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
requires = ["setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
5 changes: 5 additions & 0 deletions python_polar_coding/polar_codes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .fast_ssc import FastSSCPolarCodec
from .g_fast_ssc import GFastSSCPolarCodec
from .rc_scan import RCSCANPolarCodec
from .sc import SCPolarCodec
from .sc_list import SCListPolarCodec
4 changes: 2 additions & 2 deletions python_polar_coding/polar_codes/g_fast_ssc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .codec import GeneralizedFastSSCPolarCodec
from .decoder import GeneralizedFastSSCDecoder
from .codec import GFastSSCPolarCodec
from .decoder import GFastSSCDecoder
from .node import GFastSSCNode
6 changes: 3 additions & 3 deletions python_polar_coding/polar_codes/g_fast_ssc/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

from python_polar_coding.polar_codes.fast_ssc import FastSSCPolarCodec

from .decoder import GeneralizedFastSSCDecoder
from .decoder import GFastSSCDecoder


class GeneralizedFastSSCPolarCodec(FastSSCPolarCodec):
class GFastSSCPolarCodec(FastSSCPolarCodec):
"""Generalized Fast SSC code.
Based on: https://arxiv.org/pdf/1804.09508.pdf
"""
decoder_class = GeneralizedFastSSCDecoder
decoder_class = GFastSSCDecoder

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions python_polar_coding/polar_codes/g_fast_ssc/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from .node import GFastSSCNode


class GeneralizedFastSSCDecoder(FastSSCDecoder):
class GFastSSCDecoder(FastSSCDecoder):
node_class = GFastSSCNode

def __init__(self, n: int, mask: np.array, AF: int = 1):
def __init__(self, n: int, mask: np.array, AF: int = 0):
self.AF = AF
super().__init__(n=n, mask=mask)

Expand Down
35 changes: 25 additions & 10 deletions python_polar_coding/simulation/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from ..channels import SimpleAWGNChannel
from ..modems import SimpleBPSKModem
from ..polar_codes import (
FastSCANCodec,
FastSSCPolarCodec,
GeneralizedFastSSCPolarCodec,
GFastSCANCodec,
GFastSSCPolarCodec,
RCSCANPolarCodec,
)
from ..polar_codes.fast_scan import FastSCANCodec
from ..polar_codes.g_fast_scan import GFastSCANCodec
from . import functions, http


Expand All @@ -28,6 +28,15 @@ class CodeTypes:
FAST_SCAN,
G_FAST_SCAN,
]
SCAN = [
RC_SCAN,
FAST_SCAN,
G_FAST_SCAN,
]
GENERALIZED = [
G_FAST_SSC,
G_FAST_SCAN,
]


class ChannelTypes:
Expand All @@ -37,7 +46,7 @@ class ChannelTypes:
CODE_MAP = {
CodeTypes.FAST_SSC: FastSSCPolarCodec,
CodeTypes.RC_SCAN: RCSCANPolarCodec,
CodeTypes.G_FAST_SSC: GeneralizedFastSSCPolarCodec,
CodeTypes.G_FAST_SSC: GFastSSCPolarCodec,
CodeTypes.FAST_SCAN: FastSCANCodec,
CodeTypes.G_FAST_SCAN: GFastSCANCodec,
}
Expand Down Expand Up @@ -101,10 +110,14 @@ def simulate_from_params(url: str):
code_params=experiment,
)

result_log = (f'Result: {result}\n'
f'{code_type.upper()} ({experiment["N"]},{experiment["K"]})')
if code_type == CodeTypes.RC_SCAN:
result_log = (
f'Result: {result}\n'
f'{code_type.upper()} ({experiment["N"]},{experiment["K"]})'
)
if code_type in CodeTypes.SCAN:
result_log += f', I = {experiment["I"]}'
if code_type in CodeTypes.GENERALIZED:
result_log += f', AF = {experiment["AF"]}'
print(result_log)

resp = http.save_result(
Expand All @@ -115,7 +128,7 @@ def simulate_from_params(url: str):
channel_type=channel_type,
cls=cls,
)
print(f'Status: {resp.status_code}: {resp.json()}')
print(f'Status {resp.status_code}: {resp.json()}')


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

with futures.ProcessPoolExecutor(max_workers=workers) as ex:
run_tasks = {ex.submit(simulate_from_params, *(url, )): (url, )
for _ in range(experiments)}
run_tasks = {
ex.submit(simulate_from_params, *(url, )): (url, )
for _ in range(experiments)
}
for future in futures.as_completed(run_tasks):
try:
future.result()
Expand Down
168 changes: 0 additions & 168 deletions python_polar_coding/tests/test_g_fast_ssc/test_codec.py

This file was deleted.

Empty file.
Loading

0 comments on commit cdd1a8a

Please sign in to comment.