Guest User

Untitled

a guest
Apr 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. BoardID: 31
  2.  
  3. Channel: 1
  4.  
  5. Event Number: 3123
  6.  
  7. Pattern: 0x0000
  8.  
  9. 2627.000000
  10.  
  11. 2627.000000
  12.  
  13. 2626.009033
  14.  
  15. 2629.000000
  16. .
  17. .
  18. .(up to 1024 data)
  19.  
  20. BoardID: 31
  21.  
  22. Channel: 1
  23.  
  24. Event Number: 3124
  25.  
  26. Pattern: 0x0000
  27.  
  28. 2627.000000
  29.  
  30. 2627.000000
  31.  
  32. 2628.949707
  33.  
  34. 2626.099365
  35. .
  36. .
  37. ....(up to 1024 data)
  38. .
  39. ..1000 number of events
  40.  
  41. with open("data.txt") as f:
  42.  
  43. for i in range(1000): #I have 1000 number of events
  44. all_lines = f.readlines()
  45. def plot_event(start = 4, all_lines= 'all_lines'):
  46. lines = all_lines[start : 1029 - 4 + start]
  47.  
  48. return (plot_event(4*i, all_lines))
  49.  
  50. x = np.array(range(1,1025)) #for all the events x has same range
  51. y2 = float(lines.split()[0])
  52. y2_=list(y2)
  53. y22 = [((j / 4096)-0.5) for j in y2_]
  54.  
  55. fig = plt.figure()
  56. ax = fig.add_subplot(111)
  57. ax.set_xlabel('Time (ns)')
  58. ax.set_ylabel('counts')
  59. ax.plot(x,y22, 'k-', color= 'b', label='data')
  60. fig=plt.gcf()
  61. plt.show()
  62. plt.draw()
Add Comment
Please, Sign In to add comment