Ejemplo n.º 1
0
def main():
    serial_layer = ByteSerialReadLayer(device_name='KitProg',
                                       baud_rate=115200,
                                       parser=parser)
    buffer = BufferLayer(serial_layer, buffer_size=100, name="buffer")
    SimplePlotLayer(buffer, plot_config=plot_config)
    LayerManager.start()
Ejemplo n.º 2
0
def main():
    raw_data = InputLayer(gen_dummy_data, rate=20, name="dummy input")
    buffer = BufferLayer(raw_data, buffer_size=10)
    offset = OffsetLayer(MeanLayer(buffer), offset=25)
    plotter = CirclePlotter(offset)
    offset.set_signal_in(plotter.get_port('click'))
    LayerManager.run()
Ejemplo n.º 3
0
 def __init__(self, parent_proc=None, *args, **kwargs):
     # print("thread layer init")
     super().__init__(*args, **kwargs)
     if parent_proc is not None:
         self.thread = parent_proc.register_child_thread(self)
     else:
         self.create_thread()
         LayerManager.add_layer(self)
Ejemplo n.º 4
0
def main():

    concat = MergeLayer(None,
                        trigger=LayerTrigger.LAYER,
                        trigger_source='in2',
                        discard_old=False)
    concat.set_input(DummyInputLayer(rate=.5), 'in1')
    concat.set_input(DummyInputLayer(rate=2), 'in2')
    PrintLayer(concat)

    LayerManager.run()
Ejemplo n.º 5
0
def main():

    # Send out frame count, print response
    reader, writer = make_udp_layers(local_port=56789, remote_port=56788)
    PrintLayer(reader, label="reader: ")
    writer.set_input(InputLayer())

    # Loopback layer
    reader2, writer2 = make_udp_layers(local_port=56788, remote_port=56789)
    writer2.set_input(TransformLayer(reader2, lambda x: int(x)*2))

    LayerManager.run()
Ejemplo n.º 6
0
def main():
    raw_data = InputLayer(gen_dummy_data, rate=50, name="dummy input")
    decode_layer = DecodeLayer(raw_data, decoder=decode)
    buffer = BufferLayer(decode_layer.get_port('x1'))
    # buffer2 = BufferLayer(decode_layer.get_port('x2'))

    fig_manager = FigureManager(create_fig=create_fig)
    SimplePlotLayer(buffer,
                    plot_key='x1',
                    plot_config=plot_config,
                    fig_manager=fig_manager)
    # SimplePlotLayer(buffer2, plot_key='x2', plot_config=plot_config, fig_manager=fig_manager)
    BarPlotLayer(decode_layer.get_port('x2'),
                 plot_key='x2',
                 plot_config=plot_config,
                 fig_manager=fig_manager)
    LayerManager.run()
Ejemplo n.º 7
0
def main():
    input_layer = InputLayer(gen_dummy_data, rate=30, name="dummy input")
    split_layer = DecodeLayer(input_layer, decoder=decoder, name="decoder")
    buffer_1 = BufferLayer(split_layer.get_port('x1'),
                           buffer_size=100,
                           name="buffer1")
    buffer_2 = BufferLayer(split_layer.get_port('x2'),
                           buffer_size=100,
                           name="buffer2")
    fig_manager = FigureManager(create_fig=create_fig)
    SimplePlotLayer(buffer_1,
                    plot_key='x1',
                    plot_config=plot_config,
                    fig_manager=fig_manager)
    SimplePlotLayer(buffer_2,
                    plot_key='x2',
                    plot_config=plot_config,
                    fig_manager=fig_manager)
    LayerManager.run()
Ejemplo n.º 8
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     ctx = multiprocessing.get_context('spawn')
     self.process = ctx.Process(target=self.run_proc)
     self.thread_layers = []
     LayerManager.add_layer(self)
Ejemplo n.º 9
0
def main():
    serial_layer = InputLayer(gen_dummy_data, name="dummy input")
    buffer = BufferLayer(serial_layer, buffer_size=10, name="buffer")
    PrintLayer(buffer)
    SimplePlotLayer(buffer, ylim=(0, 1000))
    LayerManager.run()
Ejemplo n.º 10
0
 def register_child_thread(self, *args, **kwargs):
     # threads can't have child threads. Pass along to parent proc.
     self.create_thread()
     LayerManager.session().add_layer(self)
Ejemplo n.º 11
0
def main():
    raw_data = InputLayer(gen_dummy_data, rate=5, name="dummy input")
    TextPlotLayer(raw_data)
    LayerManager.run()
Ejemplo n.º 12
0
def main():
    raw_data = UDPReadLayer(name="input")
    buffer = BufferLayer(raw_data, buffer_size=5, name="buffer")
    SimplePlotLayer(buffer, plot_config=plot_config)
    LayerManager.run()
Ejemplo n.º 13
0
def main():
    # serial_layer = InputLayer(gen_dummy_data, rate=30, name="dummy input")
    serial_layer = SerialReadLayer(device_name='KitProg', baud_rate=115200)
    buffer = BufferLayer(serial_layer, buffer_size=100, name="buffer")
    SimplePlotLayer(buffer, ylim=(0, 100))
    LayerManager.run()