summaryrefslogtreecommitdiff
path: root/gr-digital/python/digital/utils/mod_codes.py
blob: bafb85e18b1f4c33e21f481f798ee95063226d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python
#
# Copyright 2011 Free Software Foundation, Inc.
# 
# This file is part of GNU Radio
# 
# SPDX-License-Identifier: GPL-3.0-or-later
#
# 

# Constants used to represent what coding to use.
GRAY_CODE = 'gray'
SET_PARTITION_CODE = 'set-partition'
NO_CODE = 'none'

codes = (GRAY_CODE, SET_PARTITION_CODE, NO_CODE)

def invert_code(code):
    c = enumerate(code)
    ic = [(b, a) for (a, b) in c]
    ic.sort()
    return [a for (b, a) in ic]