diff --git a/commpy/modulation.py b/commpy/modulation.py index d3873ed..b85ce98 100644 --- a/commpy/modulation.py +++ b/commpy/modulation.py @@ -93,6 +93,14 @@ def demodulate(self, input_symbols, demod_type, noise_var = 0): return demod_bits + def mapping(self, input_symbols, map_type, noise_var = 0): + if map_type == 'hard': + index_list = map(lambda i: self.constellation[argmin(abs(input_symbols[i] - self.constellation))], \ + xrange(0, len(input_symbols))) + else: + pass + return index_list + class PSKModem(Modem): """ Creates a Phase Shift Keying (PSK) Modem object. """