main_turbo.py and main_bcc.py quick guide
=========================================

Scope
- This file documents both training entry scripts:
  - src/main_turbo.py
  - src/main_bcc.py

Common behavior
- Auto device selection: CUDA -> MPS -> CPU.
- Logs/checkpoints are written under results/... (auto-created by logger).
- Runtime records are appended to log_info.txt.
- Default flow is train first, then run test.

----------------------------------------------------------------
1) main_turbo.py (Turbo code)
----------------------------------------------------------------

Purpose
- Train/test a neural decoder for turbo code.
- Supports generated data test and optional MATLAB data test.

Default setup
- K: 120
- R: 1/3
- G: ['13', '15']
- Iterations: 3
- Model: iterative LSTM-based turbo decoder

Main modes
- Train + test (default):
  --test_mode False
- Test only:
  --test_mode True --test_model_path <path_to_model.pth>
- MATLAB test:
  --test_mode True --matlab_test True

Examples
- Train then test:
  python src/main_turbo.py

- Test with saved model:
  python src/main_turbo.py --test_mode True --test_model_path results/best_model/best_model.pth

- MATLAB test:
  python src/main_turbo.py --test_mode True --matlab_test True --test_model_path results/best_model/best_model.pth

Notes
- N is computed from K, code rate, filler bits, CRC length, and trellis termination bits.

----------------------------------------------------------------
2) main_bcc.py (Binary convolutional code)
----------------------------------------------------------------

Purpose
- Train/test a neural decoder for binary convolutional code (BCC).
- Supports puncturing for multiple code rates.

Default setup
- K: 120
- R: 1/2
- G: ['133', '171']
- Model: LSTM sequence decoder with optional puncture embedding

Supported code rates
- 1/2, 2/3, 3/4, 5/6
- Puncture pattern is selected automatically by args.R.

Main modes
- Train + test (default):
  --test_mode False
- Test only:
  --test_mode True --test_model_path <path_to_model.pth>
- MATLAB test:
  --test_mode True --matlab_test True

Examples
- Train then test:
  python src/main_bcc.py

- Test with saved model:
  python src/main_bcc.py --test_mode True --test_model_path results/best_model/best_model.pth

- MATLAB test:
  python src/main_bcc.py --test_mode True --matlab_test True --test_model_path results/best_model/best_model.pth

Notes
- K may be rounded to match the selected rate rule.
