Skip to main content

Polar coding implementation in Python

Project description

Python-polar-coding

A package for Polar codes simulation.

Installation

pip install python-polar-coding

Example

Here is a simple example of simulation using python_polar_coding.

Binary messages encoded with Polar code, modulated using BPSK, transmitted over channel with AWGN and decoded using Fast SSC algorithm.

from python_polar_coding.channels import SimpleBPSKModulationAWGN
from python_polar_coding.polar_codes import FastSSCPolarCodec
from python_polar_coding.simulation.functions import (
    compute_fails,
    generate_binary_message,
)

N = 128
K = 64
design_snr = 2.0
messages = 10000
# SNR in [.0, .5, ..., 4.5, 5]
snr_range = [i / 2 for i in range(11)]

codec = FastSSCPolarCodec(N=N, K=K, design_snr=design_snr)
bpsk = SimpleBPSKModulationAWGN(fec_rate=K/N)

result_ber = dict()
result_fer = dict()

for snr in snr_range:
    ber = 0
    fer = 0

    for _ in range(messages):
        msg = generate_binary_message(size=K)
        encoded = codec.encode(msg)
        transmitted = bpsk.transmit(message=encoded, snr_db=snr)
        decoded = codec.decode(transmitted)

        bit_errors, frame_error = compute_fails(msg, decoded)
        ber += bit_errors
        fer += frame_error

    result_ber[snr] = ber
    result_fer[snr] = fer

Current progress

Polar code construction

Decoding

Modulation

  • BPSK

TODO

Polar code construction

Decoding

Modulation

  • Q-PSK
  • 4-QAM

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-polar-coding-0.0.1.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

python_polar_coding-0.0.1-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

Details for the file python-polar-coding-0.0.1.tar.gz.

File metadata

  • Download URL: python-polar-coding-0.0.1.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for python-polar-coding-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8d94c00d1b5af468176bbe5c71231e283cae5bbc60f1df3306406766a674cccd
MD5 56e50301cf23e3f85337f3367d84d13e
BLAKE2b-256 68d3ec04d6e06eb95d431111b9add20c6b707e01f40240033f8788139ba9a6ef

See more details on using hashes here.

File details

Details for the file python_polar_coding-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: python_polar_coding-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 59.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for python_polar_coding-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2202156c995d4abf0ff8f2143543e4793ed5039ba2243fea11437afe367e8ad6
MD5 5661b1e91caa54fa39c3e37dceeecd3f
BLAKE2b-256 fc62b666c7c702d71db3f373f015c31990e308aa3a5998e4346c22fe83c256fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page