Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fphammerle/python-manchester-code
Python library to encode & decode data as Manchester code
https://github.com/fphammerle/python-manchester-code
encoding phase-encoding radio-frequency telecommunication transmission
Last synced: about 2 months ago
JSON representation
Python library to encode & decode data as Manchester code
- Host: GitHub
- URL: https://github.com/fphammerle/python-manchester-code
- Owner: fphammerle
- License: gpl-3.0
- Created: 2020-09-04T14:44:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-13T04:18:36.000Z (4 months ago)
- Last Synced: 2024-09-13T16:11:52.670Z (4 months ago)
- Topics: encoding, phase-encoding, radio-frequency, telecommunication, transmission
- Language: Python
- Homepage: https://pypi.org/project/manchester-code/
- Size: 611 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: COPYING
Awesome Lists containing this project
README
# manchester-code
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![CI Pipeline Status](https://github.com/fphammerle/python-manchester-code/workflows/tests/badge.svg)](https://github.com/fphammerle/python-manchester-code/actions)
[![Last Release](https://img.shields.io/pypi/v/manchester-code.svg)](https://pypi.org/project/manchester-code/#history)
[![Compatible Python Versions](https://img.shields.io/pypi/pyversions/manchester-code.svg)](https://pypi.org/project/manchester-code/)
[![DOI](https://zenodo.org/badge/292872290.svg)](https://zenodo.org/badge/latestdoi/292872290)Python library to encode & decode data as [Manchester code](https://en.wikipedia.org/wiki/Manchester_code)
## Setup
```sh
$ pip3 install --user --upgrade manchester-code
```## Usage
0-bits translate to low-high, 1-bits to high-low (G. E. Thomas convention).
```python
from manchester_code import encode, decode, decode_bitsmanchester_code = encode([0b00001111, 0b01101001])
print(''.join(f'{m:08b}' for m in manchester_code))
# 01010101101010100110100110010110encode(b'msg')
# b'i\xa6jZij'decode([0b01010101, 0b10101010, 0b01101001, 0b10010110])
# 0000111101101001decode(b'ieiVjeiV')
# b'data'list(decode_bits([False, True, True, False]))
# [False, True]list(decode_bits([0, 1, 1, 0, 0, 1, 0, 1]))
# [False, True, False, False]
```