1
0

accuracy_vs_noise.py 780 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """
  2. evaluation of the standard deviation for different numbers of point
  3. if the noise is such that we have sigma as a standard deviations
  4. then averaging N points should give a std of sigma/N**0.5
  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. chip1.set_pga_state(0x18)
  17. chip1.set_Vout(0,800)
  18. Nwf = 100
  19. dat1 = np.zeros(Nwf)
  20. dat10 = np.zeros(Nwf)
  21. dat100 = np.zeros(Nwf)
  22. for k in range(0,Nwf):
  23. data = chip1.read_data()
  24. dat1[k] = data[50]
  25. dat10[k] = np.mean(data[50:60])
  26. dat100[k] = np.mean(data[50:150])
  27. print(k)
  28. print(np.std(dat1))
  29. print(np.std(dat10))
  30. print(np.std(dat100))