Added requirements.txt and instructions for running to README

This commit is contained in:
Andreas Tsouchlos 2022-11-04 21:30:02 +01:00
parent 6444914296
commit bf469afbd1
4 changed files with 29 additions and 4 deletions

View File

@ -2,4 +2,20 @@
## Software ## 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
```

View File

@ -6,7 +6,7 @@ class ProximalDecoder:
"""Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes" by Tadashi """Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes" by Tadashi
Wadayama, and Satoshi Takabe. 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. """Construct a new ProximalDecoder Object.
:param H: Parity Check Matrix :param H: Parity Check Matrix

View File

@ -1,6 +1,7 @@
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import seaborn as sns import seaborn as sns
import pandas as pd
from decoders import proximal from decoders import proximal
from decoders import utility from decoders import utility
@ -25,10 +26,13 @@ def main():
print(f"Simulating with c = {c}") 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) 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() plt.show()

5
sw/requirements.txt Normal file
View File

@ -0,0 +1,5 @@
matplotlib==3.6.2
numpy==1.23.4
pandas==1.5.1
seaborn==0.12.1
tqdm==4.64.1