timescan_plot.py 979 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import strip_data
  4. import os
  5. import os.path
  6. NUMBER_PIXELS = 1024
  7. def timescan_plot(filename, orbits, settings):
  8. data, orb = strip_data.strip_data(filename, NUMBER_PIXELS, 0)
  9. if os.path.isfile('temp_bg.bin'):
  10. bg_data , orb_bg = strip_data.strip_data('temp_bg.bin', NUMBER_PIXELS, 0)
  11. if (dc_bg):
  12. bg_avg = np.average(bg_data,axis = 0)
  13. data = bg_avg - data
  14. else:
  15. data = data
  16. data = np.reshape(data, (-1,orbits,NUMBER_PIXELS))
  17. data = np.average(data, axis=1)
  18. data = np.reshape(data, (-1,NUMBER_PIXELS))
  19. data = data[1::4,:]
  20. fig, ax = plt.subplots()
  21. im = ax.imshow(data, cmap=plt.cm.hot, aspect=0.5, interpolation='none', extent=[0,NUMBER_PIXELS,settings,0])
  22. fig.colorbar(im, ax=ax)
  23. plt.ylabel('Delay setting')
  24. plt.xlabel('Pixels')
  25. plt.tight_layout()
  26. plt.show(block=True)