Advertisement
Guest User

Untitled

a guest
May 9th, 2019
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. from __future__ import print_function
  2. from picosdk.discover import find_unit
  3. from picosdk.device import ChannelConfig, TimebaseOptions
  4. import matplotlib.pyplot as plt
  5.  
  6. with find_unit() as device:
  7.  
  8. print("found PicoScope: %s" % (device.info,))
  9.  
  10. channel_configs = [ChannelConfig('A', True, 'DC', 0.1)]
  11. #channel_configs = [ChannelConfig('A', True)]
  12. microsecond = 1.e-6
  13. # the entry-level scopes only have about 8k-samples of memory onboard for block mode, so only ask for 6k samples.
  14. timebase_options = TimebaseOptions(microsecond, None, 6000 * microsecond)
  15.  
  16. times, voltages, overflow_warnings = device.capture_block(timebase_options, channel_configs)
  17.  
  18. for channel, data in voltages.items():
  19. label = "Channel %s" % channel
  20. if channel in overflow_warnings:
  21. label += " (over range)"
  22. plt.plot(times, data, label=label)
  23.  
  24. plt.xlabel('Time / s')
  25. plt.ylabel('Amplitude / V')
  26. plt.legend()
  27. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement