Surface NMR processing and inversion GUI
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

plotKernel.py 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 lemma_yaml import *
  13. import cmocean
  14. def catLayers(K0):
  15. K = np.zeros( (len(K0.keys()), len(K0["layer-0"].data)) , dtype=complex )
  16. for lay in range(len(K0.keys())):
  17. #print(K0["layer-"+str(lay)].data) # print (lay)
  18. K[lay] = K0["layer-"+str(lay)].data # print (lay)
  19. return K
  20. if __name__ == "__main__":
  21. with open(sys.argv[1]) as f:
  22. # use safe_load instead load
  23. K0 = yaml.load(f, Loader=yaml.Loader)
  24. K = 1e9*catLayers(K0.K0)
  25. q = np.array(K0.PulseI.data)* (float)(K0.Taup)
  26. #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
  27. #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
  28. #plt.contourf(q, K0.Interfaces.data[0:-1], np.abs(K), cmap=cmocean.cm.tempo)
  29. plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.tempo)
  30. plt.colorbar()
  31. ax1 = plt.gca()
  32. ax1.set_ylim( ax1.get_ylim()[1], ax1.get_ylim()[0] )
  33. #ax1.set_xscale('log')
  34. #ax1.set_yscale('log')
  35. #ax1.xaxis.set_major_formatter(ScalarFormatter())
  36. ax1.set_xticks([ax1.get_xlim()[0], 1, ax1.get_xlim()[1],])
  37. ax1.xaxis.set_major_formatter(FormatStrFormatter('%.1f'))
  38. #print(yaml.dump(K0.K0))
  39. #print( K0.K0["layer-0"].data )
  40. #print( type( np.array(K0.K0["layer-0"].data) ) )
  41. #plt.plot( np.real( K0.K0["layer-0"].data ) )
  42. #plt.plot( K0.K0["layer-0"].data )
  43. plt.gca().set_xlabel("q (A $\cdot$ s)")
  44. plt.gca().set_ylabel("depth (m)")
  45. plt.savefig("kernel.pdf")
  46. sound = np.sum(K, axis=0)
  47. plt.figure()
  48. plt.plot(q, np.abs(sound))
  49. plt.savefig("sound.pdf")
  50. plt.show()
  51. #print(yaml.dump(K0))