Surface NMR forward modelling
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

plotkernel.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import sys
  4. from pylab import meshgrid
  5. kf = open(sys.argv[1])
  6. ifaces = np.array( kf.readline().split(), dtype=np.float )
  7. q = np.array( kf.readline().split(), dtype=np.float )
  8. q = np.append( q, (q[-1]+q[-2]) ) # for pcolor mesh
  9. Y,X = meshgrid( ifaces, q )
  10. K = np.loadtxt(sys.argv[1], comments="#", skiprows=2)
  11. nx, ny = np.shape(K)
  12. fig = plt.figure( )
  13. ax1 = fig.add_axes( [.10,.10,.35,.80] )
  14. ax2 = fig.add_axes( [.5,.10,.35,.80], sharex=ax1, sharey=ax1 )
  15. axcb = fig.add_axes( [.9,.10,.05,.80] )
  16. # Real plot
  17. ax1.pcolormesh(X, Y, K[0:nx//2].T , cmap="RdBu", vmin=-np.max(np.abs(K)), vmax=np.max(np.abs(K)) )
  18. ax1.set_ylim( ifaces[-1], ifaces[0] )
  19. ax1.set_xlim( q[-1], q[0] )
  20. ax1.set_xscale("log", nonposx='clip')
  21. #plt.colorbar()
  22. # imaginary
  23. im = ax2.pcolormesh(X, Y, K[nx//2:].T , cmap="RdBu", vmin=-np.max(np.abs(K)), vmax=np.max(np.abs(K)) )
  24. plt.setp(ax2.get_yticklabels(), visible=False)
  25. plt.colorbar(im, axcb)
  26. ax1.set_ylabel("Depth (m)")
  27. ax1.set_xlabel("Pulse moment (A$\cdot$s)")
  28. ax2.set_xlabel("Pulse moment (A$\cdot$s)")
  29. plt.show()
  30. exit()
  31. plt.matshow(K[0:nx//2])
  32. plt.colorbar()
  33. plt.matshow(K[nx//2:])
  34. plt.colorbar()
  35. KA = np.abs(K[0:nx//2] + 1j*K[nx//2:])
  36. plt.matshow(1e9*KA, cmap='viridis')
  37. plt.colorbar()
  38. plt.show()