Esempio n. 1
0
 def create_rectangle(proto_bits, pulse_len=100):
     """
     :type proto_bits: list of str
     """
     ones = np.ones(pulse_len, dtype=np.float32) * 1
     zeros = np.ones(pulse_len, dtype=np.float32) * -1
     n = 0
     y = []
     for msg in proto_bits:
         for bit in msg:
             n += pulse_len
             if bit == "0":
                 y.extend(zeros)
             else:
                 y.extend(ones)
     x = np.arange(0, n).astype(np.int64)
     scene = ZoomableScene()
     scene.setSceneRect(0, -1, n, 2)
     scene.setBackgroundBrush(constants.BGCOLOR)
     scene.addLine(0, 0, n, 0, QPen(constants.AXISCOLOR, Qt.FlatCap))
     if len(y) > 0:
         y = np.array(y)
     else:
         y = np.array(y).astype(np.float32)
     path = path_creator.array_to_QPath(x, y)
     scene.addPath(path, QPen(constants.LINECOLOR, Qt.FlatCap))
     return scene, n
Esempio n. 2
0
 def create_rectangle(proto_bits, pulse_len=100):
     """
     :type proto_bits: list of str
     """
     ones = np.ones(pulse_len, dtype=np.float32) * 1
     zeros = np.ones(pulse_len, dtype=np.float32) * -1
     n = 0
     y = []
     for msg in proto_bits:
         for bit in msg:
             n += pulse_len
             if bit == "0":
                 y.extend(zeros)
             else:
                 y.extend(ones)
     x = np.arange(0, n).astype(np.int64)
     scene = ZoomableScene()
     scene.setSceneRect(0, -1, n, 2)
     scene.setBackgroundBrush(constants.BGCOLOR)
     scene.addLine(0, 0, n, 0, QPen(constants.AXISCOLOR, 0))
     if len(y) > 0:
         y = np.array(y)
     else:
         y = np.array(y).astype(np.float32)
     path = path_creator.array_to_QPath(x, y)
     scene.addPath(path, QPen(constants.LINECOLOR, 0))
     return scene, n
Esempio n. 3
0
    def data_scene(self) -> QGraphicsScene:
        n = self.samples_per_symbol * len(self.display_bits)
        y = np.ones(n, dtype=np.float32)

        for i, bit in enumerate(self.display_bits):
            if bit == "0":
                y[i*self.samples_per_symbol:(i + 1) * self.samples_per_symbol] = -1.0

        x = np.arange(0, n).astype(np.int64)

        scene = ZoomableScene()
        scene.setSceneRect(0, -1.25, n, 2.5)
        scene.setBackgroundBrush(settings.BGCOLOR)
        scene.addLine(0, 0, n, 0, QPen(settings.AXISCOLOR, 0))

        path = path_creator.array_to_QPath(x, y)
        scene.addPath(path, QPen(settings.LINECOLOR, 0))

        return scene
Esempio n. 4
0
    def data_scene(self) -> QGraphicsScene:
        n = self.samples_per_bit * len(self.display_bits)
        y = np.ones(n, dtype=np.float32)

        for i, bit in enumerate(self.display_bits):
            if bit == "0":
                y[i*self.samples_per_bit:(i+1)*self.samples_per_bit] = -1.0

        x = np.arange(0, n).astype(np.int64)

        scene = ZoomableScene()
        scene.setSceneRect(0, -1.25, n, 2.5)
        scene.setBackgroundBrush(constants.BGCOLOR)
        scene.addLine(0, 0, n, 0, QPen(constants.AXISCOLOR, 0))

        path = path_creator.array_to_QPath(x, y)
        scene.addPath(path, QPen(constants.LINECOLOR, 0))

        return scene
Esempio n. 5
0
 def data_scene(self) -> QGraphicsScene:
     ones = np.ones(self.samples_per_bit, dtype=np.float32) * 1
     zeros = np.ones(self.samples_per_bit, dtype=np.float32) * -1
     n = self.samples_per_bit * len(self.display_bits)
     y = []
     for bit in self.display_bits:
         if bit == "0":
             y.extend(zeros)
         elif bit == "1":
             y.extend(ones)
     x = np.arange(0, n).astype(np.int64)
     scene = ZoomableScene()
     scene.setSceneRect(0, -1, n, 2)
     scene.setBackgroundBrush(constants.BGCOLOR)
     scene.addLine(0, 0, n, 0, QPen(constants.AXISCOLOR, Qt.FlatCap))
     y = np.array(y) if len(y) > 0 else np.array(y).astype(np.float32)
     path = path_creator.array_to_QPath(x, y)
     scene.addPath(path, QPen(constants.LINECOLOR, Qt.FlatCap))
     return scene
Esempio n. 6
0
 def data_scene(self) -> QGraphicsScene:
     ones = np.ones(self.samples_per_bit, dtype=np.float32) * 1
     zeros = np.ones(self.samples_per_bit, dtype=np.float32) * -1
     n = self.samples_per_bit * len(self.display_bits)
     y = []
     for bit in self.display_bits:
         if bit == "0":
             y.extend(zeros)
         elif bit == "1":
             y.extend(ones)
     x = np.arange(0, n).astype(np.int64)
     scene = ZoomableScene()
     scene.setSceneRect(0, -1, n, 2)
     scene.setBackgroundBrush(constants.BGCOLOR)
     scene.addLine(0, 0, n, 0, QPen(constants.AXISCOLOR, Qt.FlatCap))
     y = np.array(y) if len(y) > 0 else np.array(y).astype(np.float32)
     path = path_creator.array_to_QPath(x, y)
     scene.addPath(path, QPen(constants.LINECOLOR, Qt.FlatCap))
     return scene