96 lines
1.9 KiB
Markdown
96 lines
1.9 KiB
Markdown
# Communication System README
|
|
|
|
This repository contains a Python-based transmitter/receiver system for sending 40-character text messages over a simulated noisy channel (local or remote server).
|
|
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
* Python 3.7+
|
|
* NumPy
|
|
|
|
Install dependencies:
|
|
|
|
```bash
|
|
pip install numpy
|
|
```
|
|
|
|
---
|
|
|
|
## Files
|
|
|
|
* `encoder.py` — builds codebook and encodes messages.
|
|
* `decoder.py` — decodes received samples back into text.
|
|
* `channel.py` — local channel simulator.
|
|
* `client.py` — client stub to send samples to the remote server.
|
|
* `main.py` — main driver: wraps encode → channel → decode, plus performance testing.
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
All commands assume you are in the project root directory.
|
|
|
|
### 1. Test locally for 1 trial
|
|
|
|
```bash
|
|
python3 main_backup.py \
|
|
--message "Lorem ipsum dolor sit amet. consectetuer" \
|
|
--trials 1 \
|
|
--mode local
|
|
```
|
|
|
|
### 2. Test locally for 500 trials
|
|
|
|
```bash
|
|
python3 main_backup.py \
|
|
--message "Lorem ipsum dolor sit amet. consectetuer" \
|
|
--trials 500 \
|
|
--mode local
|
|
```
|
|
|
|
### 3. Test on the remote server (1 trial)
|
|
|
|
This will write `input.txt` and `output.txt` in your working directory.
|
|
|
|
```bash
|
|
python3 main_backup.py \
|
|
--message "Lorem ipsum dolor sit amet. consectetuer" \
|
|
--trials 1 \
|
|
--mode server \
|
|
--input_file input.txt \
|
|
--output_file output.txt \
|
|
--hostname iscsrv72.epfl.ch \
|
|
--port 80
|
|
```
|
|
|
|
> After running, `input.txt` contains your transmitted samples, and `output.txt` contains the noisy output from the server.
|
|
|
|
### 4. Create input.txt
|
|
|
|
```bash
|
|
python3 encoder.py "message_40_characters"
|
|
```
|
|
|
|
### 5. Create output.txt throught the channel
|
|
|
|
```bash
|
|
python3 channel.py
|
|
```
|
|
|
|
### 6. Decode the output.txt
|
|
|
|
```bash
|
|
python3 decoder.py
|
|
```
|
|
|
|
### 7. send input.txt to the server and get output.txt
|
|
|
|
```bash
|
|
python3 client.py \
|
|
--input_file input.txt \
|
|
--output_file output.txt \
|
|
--hostname iscsrv72.epfl.ch \
|
|
--port 80
|
|
```
|
|
|