feat: improve
This commit is contained in:
parent
371afdbd0e
commit
f6a38c5eb0
2 changed files with 10 additions and 26 deletions
32
README.md
32
README.md
|
@ -77,36 +77,20 @@ python3 encoder.py "message_40_characters"
|
|||
```bash
|
||||
python3 channel.py
|
||||
```
|
||||
### 6. Decode the output.tct
|
||||
|
||||
### 6. Decode the output.txt
|
||||
|
||||
```bash
|
||||
python3 decoder.py
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Manual decoding of server output
|
||||
|
||||
If you want to decode `output.txt` yourself:
|
||||
### 7. send input.txt to the server and get output.txt
|
||||
|
||||
```bash
|
||||
python3 - << 'EOF'
|
||||
import numpy as np
|
||||
import encoder, decoder
|
||||
|
||||
# Load noisy samples
|
||||
Y = np.loadtxt("output.txt")
|
||||
|
||||
# Rebuild codebook
|
||||
C = encoder.make_codebook(r=5, num_blocks=40)
|
||||
|
||||
# Decode
|
||||
msg = decoder.decode_blocks(Y, C)
|
||||
print("Decoded message:", msg)
|
||||
EOF
|
||||
python3 client.py \
|
||||
--input_file input.txt \
|
||||
--output_file output.txt \
|
||||
--hostname iscsrv72.epfl.ch \
|
||||
--port 80
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Feel free to adjust `--trials` or swap between `local` and `server` modes as needed.
|
||||
|
|
|
@ -5,12 +5,12 @@ ALPHABET = "abcdefghijklmnopqrstuvwxyz" \
|
|||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||
"0123456789 ."
|
||||
|
||||
CHAR_TO_IDX = {c: i for i, c in enumerate(ALPHABET)}
|
||||
|
||||
G = 10.0
|
||||
ENERGY_LIMIT = 2000.0
|
||||
TEXT_LENGTH = 40
|
||||
ALPHABET_LENGTH = len(ALPHABET)
|
||||
CHAR_TO_IDX = {c: i for i, c in enumerate(ALPHABET)}
|
||||
|
||||
|
||||
assert ALPHABET_LENGTH == 64
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue