The notebook main.ipynb
guides you through the project
Error detection and correction are fundamental concepts in the field of digital communications and computing, where Hamming codes play a significant role. Imagine transmitting a codeword
A codeword in Hamming codes is formed by adding
This formula ensures that the codeword has sufficient parity bits to handle the specified message length. The generator matrix $G ), in block matrix form, is represented as
where
The selection of parity bits in matrix
where
The final
Matrix
This matrix helps identify errors in the codeword through the computation of the error syndrome. The error syndrome is used to detect and (or) localize errors.
The code structure is displayed in the Figure below. The HammingCode
class relies on BinaryMessage
instances to represent the messages it operates on. The BinaryMessage
class is a subclass of np.ndarray
, ensuring that all array functions of numpy can be used while making sure that the array strictly contains binary values, either 0s or 1s. When a new BinaryMessage
is created, it goes through validation to ensure that all elements within the input array conform to binary values. If any element outside of the binary range is detected, the creation of the BinaryMessage
object is aborted, and a ValueError
is raised. This validation is critical to the integrity of the Hamming code system, as it guarantees that all messages and codewords used in the encoding and decoding processes are strictly binary, which is a fundamental requirement for the correct functioning of Hamming error-correction algorithms. The integration between these two classes enable the encapsulation and manipulation of binary data within the error correction system. The file transmission.py
includes some functions to simulate a real world transmission, explained in \ref{chap:transmission_simulation}.
Figure: Code structure of the Hamming code implementation. Source: own illustration.
[Label: chap:transmission_simulation]
Not part of this task, we added simulated message transmission to apply the code to a real-world example by sending a string message through a noisy channel where errors can occur. Messages are converted to binary using the Hamming code and then transmitted. This step simulates the addition of parity bits and preparation of the codeword. During transmission, the codeword may be subjected to errors, simulating real-world interferences. Upon receiving the codeword, the system decodes it back to the original message. It also checks and corrects any errors if in correct
mode or detects errors in detect
mode. This end-to-end simulation demonstrates the robustness of the Hamming code in maintaining data integrity in noisy transmission environments. The functions used in this process are part of the transmission.py
module.