Skip to main content

A python package intended for visualizing digital data line coding, generating parity bits and detecting errors in parity encoded binary data

Project description

PyDigital

PyPI version PyPI - Python Version PyPI - Status License: MIT

This python package PyDigital provides visual representations of digital data line coding 📈 as well as generation of parity bits 🔢 and error detection for binary data.

The package can be used to prototype and visualize digital data transmission using the various line coding plots and the parity encoding and decoding functionalities.

If you like the package, feel free to 🌟 the repo and contribute to it! Also find us on Twitter @PyDigital.

Installation

Install using pip with the command

$ pip install pydigital

Usage

Line Coding

from pydigital import LineCoding

lc = LineCoding()

# Plots differential manchester line coding for the binary string
lc.diffmanchester('10010110')

❗ All line coding methods accept parameters in the form of strings, and arrays/tuples of integers/strings.

Different line coding techniques are available, all of which are listed below.

Method Return Type
unipolar_nrz (binary_string_literal) Plots input binary data in Unipolar NRZ
unipolar_rz (binary_string_literal) Plots input binary data in Unipolar RZ
polar_nrz (binary_string_literal) Plots input binary data in Polar NRZ
polar_nrzl (binary_string_literal) Plots input binary data in Polar NRZL
polar_nrzi (binary_string_literal) Plots input binary data in Polar NRZI
polar_rz (binary_string_literal) Plots input binary data in Polar RZ
bipolar_nrz (binary_string_literal) Plots input binary data in Bipolar NRZ
bipolar_rz (binary_string_literal) Plots input binary data in Bipolar RZ
pseudoternary (binary_string_literal) Plots input binary data in Pseudoternary
manchester_ieee (binary_string_literal) Plots input binary data in IEEE Manchester
manchester_gethomas (binary_string_literal) Plots input binary data in G.E.Thomas Manchester
diffmanchester (binary_string_literal) Plots input binary data in Differential Manchester

Parity Encoding and Decoding

from pydigital import ParityEncDec

pr = ParityEncDec()

vrc = pr.encode_vrc(['10110', '10100'])
print("VRC :", vrc[0])
print("DATA TRANSMITTED :", vrc[1])
# VRC : 10
# DATA TRANSMITTED : 101101 101000
        
vrc = pr.decode_vrc('101101 101000', 5, 2, 2)
print(vrc)
# THE DATA TRANSMITTED IS CORRECT

❗ Binary data are passed as string literals. Spaces are optional.

Encoding and decoding methods for four different types of parity techniques are given below.

Method Return Type
encode_lrc ([binary_string_literals]) Array [LRC Bits, LRC Encoded Data]
encode_vrc ([binary_string_literals]) Array [VRC Bits, VRC Encoded Data]
encode_crc (binary_string_literal, crc_key_string_literal) Array [CRC Bits, CRC Encoded Data]
encode_checksum ([binary_string_literals]) Array [Checksum Bits, Checksum Encoded Data]
decode_lrc (binary_string_literal, bits_per_data_string, number_of_data_strings, return_type) Boolean, Decoded Data, or Text
decode_vrc (binary_string_literal, bits_per_data_string, number_of_data_strings, return_type) Boolean, Decoded Data, or Text
decode_crc (binary_string_literal, crc_key_string_literal, return_type) Boolean, Decoded Data, or Text
decode_checksum (binary_string_literal, bits_per_data_string, number_of_data_strings, return_type) Boolean, Decoded Data, or Text

Development

To contribute to the package, first clone the repository and cd into it.

$ git clone https://github.com/RapidCompiler/pydigital.git
$ cd pydigital

Make changes inside the pydigital folder located in the src directory. You can then test this functionality either by creating a test file and importing the methods into it or by installing the package on your computer.

Create a virtual environment and activate it before you install the package locally.

$ python -m virtualenv env
$ env\Scripts\activate
$ pip install .

Run the pip install . command in the main project directory.

This project does not have a setup.py file and hence cannot be installed in the editable mode.

Issues

You can report bugs and suggest improvements on this repository's issue tracker

License

Designed and published with ♥ by Prathish K V (@prathishkv) and Sanjay S (@rapidcompiler) under MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyDigital-1.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyDigital-1.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file PyDigital-1.1.1.tar.gz.

File metadata

  • Download URL: PyDigital-1.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.1

File hashes

Hashes for PyDigital-1.1.1.tar.gz
Algorithm Hash digest
SHA256 27c2e8526eaf578c5876200f6338c4687967070de7ac6c9ae78efa9cccb7d6e7
MD5 c7e148b5a96c4cabb340c4806a44b1ea
BLAKE2b-256 fb37d05c586ad2a6e9d6a884cb0aede13a977031f870e0d5140a9a898d8ab809

See more details on using hashes here.

File details

Details for the file PyDigital-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: PyDigital-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.1

File hashes

Hashes for PyDigital-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dabf32e5668f943406899934c81938aea8cb47ec4ae6b99bd54be39bf38a9693
MD5 cec76ac93b24f3b2f40cc3e1665093ad
BLAKE2b-256 83e2ea687a30463c45879bb5e1305cefd83df540b348423799a529cd44456f30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page