scan_gain_in.py 608 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """
  2. evaluation of the gains: measure the peak-to-peak of the input signal
  3. for the various gains
  4. It supposes an input pulse (and trigger signal)
  5. """
  6. from struct import*
  7. import ctypes
  8. import array
  9. import numpy as np
  10. import matplotlib.pyplot as plt
  11. import time
  12. from ADUCv2p0 import*
  13. chip1 = ADUCv2p0(0x50,True)
  14. chip1.set_channel(3) #ADC
  15. #chip1.set_remote_trigg(1)
  16. Vpp = np.zeros(7)
  17. chip1.set_pga_state(0x18)
  18. for g in range(1,8):
  19. chip1.set_pga_state(16*g+8)
  20. time.sleep(0.5)
  21. data = chip1.read_data()
  22. Vpp[g-1] = max(data)-min(data)
  23. plt.plot(Vpp,'o')
  24. plt.yscale("log")
  25. plt.show()