From f8c7775a373425c8208a192f9547efdc657c4244 Mon Sep 17 00:00:00 2001 From: Cameron Neville Date: Thu, 26 Apr 2018 20:32:32 -0500 Subject: [PATCH] first commit --- ConvEncoder.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ConvEncoder.py diff --git a/ConvEncoder.py b/ConvEncoder.py new file mode 100644 index 0000000..7be1b01 --- /dev/null +++ b/ConvEncoder.py @@ -0,0 +1,23 @@ +import numpy as np + +class ConvEncoder: + #code is an array representing the code + #punctures where puncture is true + #code and puncture must have the same height + #if stream == False the encoder will flush after every call to feed() + # + def __init__(self, code, feedback=False, puncture=None, stream=True, block=2000): + validcode = False + self.code = np.array(code, dtype=np.bool_) + self.feedback = feedback + if puncture is not None: + self.puncture = np.array(puncture, dtype=np.bool_) + if self.node.shape[0] != self.puncture.shape[0]: + raise ValueError('code and feedback must have the same number of rows.') + if not isinstance(stream, bool): + raise TypeError('stream must be a boolean (received %s)' % str(type(stream))) + self.stream = stream + + def feed(data): + data = np.array(data, dtype=np.bool_) + \ No newline at end of file