mirror of
https://github.com/romanz/amodem.git
synced 2026-02-08 02:18:00 +08:00
add error handler to sigproc.modulator.decode()
This commit is contained in:
@@ -53,10 +53,12 @@ class QAM(object):
|
||||
s = self._enc[bits_tuple]
|
||||
yield s
|
||||
|
||||
def decode(self, symbols):
|
||||
def decode(self, symbols, error_handler=None):
|
||||
for s in symbols:
|
||||
index = np.argmin(np.abs(s - self.symbols))
|
||||
S = self.symbols[index]
|
||||
if error_handler:
|
||||
error_handler(received=s, decoded=S)
|
||||
yield self._dec[S]
|
||||
|
||||
modulator = QAM(common.symbols)
|
||||
|
||||
Reference in New Issue
Block a user