Surface NMR forward modelling
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import sys
  4. from pylab import meshgrid
  5. from matplotlib.colors import LightSource
  6. from matplotlib.ticker import ScalarFormatter
  7. from matplotlib.ticker import MaxNLocator
  8. from matplotlib.ticker import AutoMinorLocator
  9. from matplotlib.ticker import LogLocator
  10. kf = open(sys.argv[1])
  11. ifaces = np.array( kf.readline().split(), dtype=np.float )
  12. q = np.array( kf.readline().split(), dtype=np.float )
  13. q = np.append( q, (q[-1]+q[-2]) ) # for pcolor mesh
  14. Y,X = meshgrid( ifaces, q )
  15. K = 1e9*np.loadtxt(sys.argv[1], comments="#", skiprows=2)
  16. nx, ny = np.shape(K)
  17. fig = plt.figure( )
  18. ax1 = fig.add_axes( [.100,.125,.335,.775] )
  19. ax2 = fig.add_axes( [.465,.125,.335,.775] , sharex=ax1, sharey=ax1 )
  20. axcb = fig.add_axes( [.835,.125,.040,.775] )
  21. ccmap = "coolwarm" # RdBu
  22. # Real plot
  23. ax1.pcolormesh(X, Y, K[0:nx//2].T, cmap=ccmap, vmin=-np.max(np.abs(K)), vmax=np.max(np.abs(K)))
  24. ax1.set_ylim( ifaces[-1], ifaces[0] )
  25. ax1.set_xlim( q[-1], q[0] )
  26. ax1.set_xscale("log", nonposx='clip')
  27. ax1.minorticks_off()
  28. ax1.set_title(r"$\mathrm{Re} \left( \mathcal{K}_N^{1D} \right)$")
  29. ax1.xaxis.set_major_locator(LogLocator(base = 2.0))
  30. ax1.get_xaxis().set_major_formatter(ScalarFormatter())
  31. # imaginary
  32. im = ax2.pcolormesh(X, Y, K[nx//2:].T, cmap=ccmap, vmin=-np.max(np.abs(K)), vmax=np.max(np.abs(K)))
  33. plt.setp(ax2.get_yticklabels(), visible=False)
  34. cb = plt.colorbar(im, axcb)
  35. cb.set_label(r"$\overline{V}^{\left(0\right)}_N$ (nV)")
  36. ax1.set_ylabel("Depth (m)")
  37. ax1.set_xlabel(r"Pulse moment (A$\cdot$s)")
  38. ax2.set_xlabel(r"Pulse moment (A$\cdot$s)")
  39. ax2.set_title(r"$\mathrm{Im} \left( \mathcal{K}_N^{1D} \right)$")
  40. plt.suptitle("exp 0")
  41. plt.show()
  42. exit()