Advertisement
OreganoHauch

colormap x,y,lock_in_R

Apr 20th, 2020 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. %matplotlib inline
  2. import h5py
  3. import matplotlib.pyplot as plt
  4. import matplotlib.cm as cm
  5. import numpy as np
  6.  
  7. # Load file and relevant h5 groups
  8. positions = h5py.File("C:\\Users\\Jan\\Documents\\Physik & Mathe\\Bachelorarbeit\\h5 Dateien zum Ausprobieren\\positions.h5", 'r')
  9. counter = h5py.File("C:\\Users\\Jan\\Documents\\Physik & Mathe\\Bachelorarbeit\\h5 Dateien zum Ausprobieren\\counter.h5", 'r')
  10.  
  11. # Extract information out of h5:
  12. x_axis_h5 = positions["/data/encoder_fast/data"]
  13. y_axis_h5 = positions["/data/encoder_slow/data"]
  14. lock_in_R_h5 = counter["/data/lock_in_R_0-10V"]
  15. x = list(x_axis_h5)
  16. y = list(y_axis_h5)
  17. lock_in_R = list(lock_in_R_h5)
  18.  
  19. matrix_lock_in_R = np.asmatrix(lock_in_R)
  20.  
  21. """Plot raw map"""
  22.  
  23. fig2 = plt.figure(figsize=(10,8))
  24. ax2_1 = plt.subplot2grid((3,3), (0,0))
  25. ax2_1.plot(x,y)
  26.  
  27. im = ax2_1.pcolormesh(x, y, lock_in_R, cmap=cm.afmhot, vmin=0, vmax=matrix_lock_in_R.max())
  28. ax2_1.set_aspect(1)
  29. plt.xlabel("X position $(\mu m)$")
  30. plt.ylabel("Y position $(\mu m)$")
  31. ax2_1_divider = make_axes_locatable(ax2_1)
  32. cax2_1 = ax2_1_divider.append_axes("right", size="15%", pad="10%")
  33. cb0 = colorbar(im, cax=cax2_1)
  34. ylabel = "count rate (Hz)"
  35.  
  36. cax2_1.set_ylabel(ylabel, rotation=90)
  37. plt.tight_layout()
  38. plt.close()
  39. return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement