Skip to content

Commit

Permalink
add mapping function with hard mapping to Modem class
Browse files Browse the repository at this point in the history
  • Loading branch information
noc0lour committed Apr 5, 2016
1 parent 4488c19 commit 81d037c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions commpy/modulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. """
Expand Down

0 comments on commit 81d037c

Please sign in to comment.