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
|
```bash
|
||||||
python3 channel.py
|
python3 channel.py
|
||||||
```
|
```
|
||||||
### 6. Decode the output.tct
|
|
||||||
|
### 6. Decode the output.txt
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 decoder.py
|
python3 decoder.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 7. send input.txt to the server and get output.txt
|
||||||
---
|
|
||||||
|
|
||||||
## Manual decoding of server output
|
|
||||||
|
|
||||||
If you want to decode `output.txt` yourself:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 - << 'EOF'
|
python3 client.py \
|
||||||
import numpy as np
|
--input_file input.txt \
|
||||||
import encoder, decoder
|
--output_file output.txt \
|
||||||
|
--hostname iscsrv72.epfl.ch \
|
||||||
# Load noisy samples
|
--port 80
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Feel free to adjust `--trials` or swap between `local` and `server` modes as needed.
|
|
||||||
|
|
|
@ -5,12 +5,12 @@ ALPHABET = "abcdefghijklmnopqrstuvwxyz" \
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||||
"0123456789 ."
|
"0123456789 ."
|
||||||
|
|
||||||
CHAR_TO_IDX = {c: i for i, c in enumerate(ALPHABET)}
|
|
||||||
|
|
||||||
G = 10.0
|
G = 10.0
|
||||||
ENERGY_LIMIT = 2000.0
|
ENERGY_LIMIT = 2000.0
|
||||||
TEXT_LENGTH = 40
|
TEXT_LENGTH = 40
|
||||||
ALPHABET_LENGTH = len(ALPHABET)
|
ALPHABET_LENGTH = len(ALPHABET)
|
||||||
|
CHAR_TO_IDX = {c: i for i, c in enumerate(ALPHABET)}
|
||||||
|
|
||||||
|
|
||||||
assert ALPHABET_LENGTH == 64
|
assert ALPHABET_LENGTH == 64
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue