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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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