def main(): raw_data = prt.InputLayer(gen_dummy_data, rate=1, name="dummy input") reader, writer = prt.make_tcp_server() writer.set_input(raw_data) prt.PrintLayer(reader) prt.LayerManager.session().run()
def main(): concat = prt.MergeLayer(None, trigger=prt.LayerTrigger.LAYER, trigger_source='in2', discard_old=False) concat.set_input(prt.InputLayer(rate=.5), 'in1') concat.set_input(prt.InputLayer(rate=2), 'in2') prt.PrintLayer(concat) prt.LayerManager.session().run()
def main(): # Send out frame count, print response reader, writer = prt.make_udp_layers(local_port=56789, remote_port=56788) prt.PrintLayer(reader, label="reader: ") writer.set_input(prt.InputLayer()) # Loopback layer reader2, writer2 = prt.make_udp_layers(local_port=56788, remote_port=56789) writer2.set_input(prt.TransformLayer(reader2, lambda x: int(x) * 2)) prt.LayerManager.session().run()
def main(): raw_data = prt.CustomInputLayer(name="custom input") prt.PrintLayer(raw_data) prt.LayerManager.session().start() while True: data = input("enter data:") if data == 'stop': break raw_data.supply_input(data) prt.LayerManager.session().stop() prt.LayerManager.session().join()
def main(): process = prt.SubprocessLayer(None, 'python subproc_utils/subproc_datagen.py') # Sets up server and sends data _, writer = prt.make_tcp_server() writer.set_input(process) # Reads data client_reader, _ = prt.make_tcp_client_layers('127.0.0.1', 9000) prt.PrintLayer(client_reader) prt.LayerManager.session().run()
def main(): raw_data = prt.InputLayer(gen_dummy_data, rate=1, name="dummy input") process = prt.SubprocessLayer(raw_data, 'python subproc_utils/subproc_echo.py') prt.PrintLayer(process) prt.LayerManager.session().run()
def main(): for target in [20, 40, 60]: in_layer = CounterLayer(target=target) prt.PrintLayer(in_layer) prt.TimePlotLayer(in_layer, buffer_size=10, ylim=(0, 100)) prt.LayerManager.session().run()
def main(): serial_layer = prt.InputLayer(gen_dummy_data) prt.PrintLayer(serial_layer) prt.TimePlotLayer(serial_layer, buffer_size=10, ylim=(0, 1000)) prt.LayerManager.session().run()