diff --git a/sw/README.md b/sw/README.md index abf10aa..3f2111b 100644 --- a/sw/README.md +++ b/sw/README.md @@ -2,4 +2,20 @@ ## Software -`TODO` +### Create a python virtual environment + +In the root directory of this repository run + +```bash +$ python3 -m venv venv +$ source venv/bin/activate +$ pip3 install -r requirements.txt +``` + +### Run the unit tests + +In the root directory of this repository run + +```bash +$ python -m unittest discover test +``` diff --git a/sw/decoders/proximal.py b/sw/decoders/proximal.py index f943cd6..06abbf1 100644 --- a/sw/decoders/proximal.py +++ b/sw/decoders/proximal.py @@ -6,7 +6,7 @@ class ProximalDecoder: """Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes" by Tadashi Wadayama, and Satoshi Takabe. """ - def __init__(self, H: np.array, K: int = 10, step_size: float = 0.1, gamma: float = 0.05): + def __init__(self, H: np.array, K: int = 10, step_size: float = 0.01, gamma: float = 0.05): """Construct a new ProximalDecoder Object. :param H: Parity Check Matrix diff --git a/sw/main.py b/sw/main.py index 5c1019a..29f56e2 100644 --- a/sw/main.py +++ b/sw/main.py @@ -1,6 +1,7 @@ import numpy as np import matplotlib.pyplot as plt import seaborn as sns +import pandas as pd from decoders import proximal from decoders import utility @@ -25,10 +26,13 @@ def main(): print(f"Simulating with c = {c}") - decoder = proximal.ProximalDecoder(H, K=1000) + decoder = proximal.ProximalDecoder(H, K=100) SNRs, BERs = utility.test_decoder(decoder, c, N=100) - plt.stem(SNRs, BERs) + data = pd.DataFrame({"SNR": SNRs, "BER": BERs}) + + ax = sns.lineplot(data=data, x="SNR", y="BER") + ax.set_ylim([0, 1]) plt.show() diff --git a/sw/requirements.txt b/sw/requirements.txt new file mode 100644 index 0000000..641b174 --- /dev/null +++ b/sw/requirements.txt @@ -0,0 +1,5 @@ +matplotlib==3.6.2 +numpy==1.23.4 +pandas==1.5.1 +seaborn==0.12.1 +tqdm==4.64.1