Surface NMR processing and inversion GUI
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

plotKernel.py 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import matplotlib.pyplot as plt
  2. import sys,os
  3. from pylab import meshgrid
  4. from matplotlib.colors import LightSource
  5. from matplotlib.ticker import ScalarFormatter
  6. from matplotlib.ticker import MaxNLocator
  7. from matplotlib.ticker import AutoMinorLocator
  8. from matplotlib.ticker import LogLocator
  9. from matplotlib.ticker import FormatStrFormatter
  10. import numpy as np
  11. import yaml
  12. from akvo.tressel.lemma_yaml import *
  13. from akvo.tressel.SlidesPlot import *
  14. import cmocean
  15. def catLayers(K0):
  16. K = np.zeros( (len(K0.keys()), len(K0["layer-0"].data)) , dtype=complex )
  17. for lay in range(len(K0.keys())):
  18. #print(K0["layer-"+str(lay)].data) # print (lay)
  19. K[lay] = K0["layer-"+str(lay)].data # print (lay)
  20. return K
  21. if __name__ == "__main__":
  22. with open(sys.argv[1]) as f:
  23. # use safe_load instead load
  24. K0 = yaml.load(f, Loader=yaml.Loader)
  25. K = 1e9*catLayers(K0.K0)
  26. q = np.array(K0.PulseI.data)* (float)(K0.Taup)
  27. fig = plt.figure( figsize=(pc2in(20),pc2in(20)) )
  28. fig.add_axes((.2,.2,.65,.7))
  29. #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
  30. #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
  31. #plt.contourf(q, K0.Interfaces.data[0:-1], np.abs(K), cmap=cmocean.cm.tempo)
  32. plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.tempo)
  33. plt.colorbar(label=r"$\left| \overline{\mathcal{V}_N}(0) \right|$ (nV)")
  34. ax1 = plt.gca()
  35. ax1.set_ylim( ax1.get_ylim()[1], ax1.get_ylim()[0] )
  36. #ax1.set_xscale('log')
  37. #ax1.set_yscale('log')
  38. #ax1.xaxis.set_major_formatter(ScalarFormatter())
  39. ax1.set_xticks([ax1.get_xlim()[0], 1, ax1.get_xlim()[1],])
  40. ax1.xaxis.set_major_formatter(FormatStrFormatter('%.1f'))
  41. #print(yaml.dump(K0.K0))
  42. #print( K0.K0["layer-0"].data )
  43. #print( type( np.array(K0.K0["layer-0"].data) ) )
  44. #plt.plot( np.real( K0.K0["layer-0"].data ) )
  45. #plt.plot( K0.K0["layer-0"].data )
  46. plt.gca().set_xlabel("q (A $\cdot$ s)")
  47. plt.gca().set_ylabel("depth (m)")
  48. plt.savefig("kernel.pdf")
  49. sound = np.sum(K, axis=0)
  50. plt.figure()
  51. plt.plot(q, np.abs(sound))
  52. plt.savefig("sound.pdf")
  53. plt.show()
  54. #print(yaml.dump(K0))