def test1(): streamhandler = StreamHandler() # Configure and start dev = FakeDigital(streamhandler = streamhandler) dev.configure( name = 'Test dev', nb_channel = 10, sampling_rate =1000., buffer_length = 10., packet_size = 128, ) dev.initialize() dev.start() # Create and starts receiver with multuprocessing stream0 = dev.streams[0] stop_recv = mp.Value('i', 0) process = mp.Process(target= test_recv_loop, args = (stream0['port'],stop_recv)) process.start() time.sleep(10.) stop_recv.value = 1 process.join() # Stop and release the device dev.stop() dev.close()
def test1(): streamhandler = StreamHandler() # Configure and start dev = FakeDigital(streamhandler = streamhandler) dev.configure( nb_channel = 30, sampling_rate =1000000., buffer_length = 60., packet_size = 20, ) dev.initialize() dev.start() app = QtGui.QApplication([]) #~ w1=OscilloscopeDigital(stream = dev.streams[0]) #~ w1.show() #~ w1.set_params(xsize = 5., decimate= 500) w2=OscilloscopeDigital(stream = dev.streams[0]) w2.show() w2.set_params(xsize = 30, mode = 'scroll', decimate= 500, auto_decimate = True) app.exec_() # Stope and release the device dev.stop() dev.close()
def trigger_digital1(): streamhandler = StreamHandler() # Configure and start dev = FakeDigital(streamhandler = streamhandler) dev.configure( nb_channel = 32, sampling_rate =100000., buffer_length = 60., packet_size = 100, ) dev.initialize() dev.start() def print_pos(pos): print pos trigger = DigitalTrigger(stream = dev.streams[0], front = '-', channel = 0, #~ debounce_mode = 'no-debounce', debounce_mode = 'after-stable', #~ debounce_mode = 'before-stable', debounce_time = 0.05, callbacks = [ print_pos, ] ) app = QtGui.QApplication([]) w1=OscilloscopeDigital(stream = dev.streams[0]) w1.show() visibles = np.ones(dev.nb_channel, dtype = bool) visibles[1:] = False w1.set_params(xsize = 4.7, mode = 'scan', visibles = visibles, refresh_interval = .1) time.sleep(.5) #~ w1.auto_gain_and_offset(mode = 2) app.exec_() print 1 # Stope and release the device trigger.stop() print 2 dev.stop() print 3 dev.close() print 4