Surface NMR processing and inversion GUI
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.

plotKernelDiff.py 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. with open(sys.argv[2]) as f2:
  25. # use safe_load instead load
  26. K02 = yaml.load(f2, Loader=yaml.Loader)
  27. K = 1e9*catLayers(K0.K0)
  28. K2 = 1e9*catLayers(K02.K0)
  29. q = np.array(K0.PulseI.data)* (float)(K0.Taup)
  30. #plt.pcolor(K0.Interfaces.data, K0.PulseI.data, np.abs(K))
  31. plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.gray_r)
  32. #plt.contourf(q, K0.Interfaces.data[0:-1], np.abs(K), cmap=cmocean.cm.tempo)
  33. #plt.pcolor(q, K0.Interfaces.data, np.abs(K), cmap=cmocean.cm.tempo)
  34. plt.pcolor(q, K0.Interfaces.data, np.abs(K - K2), cmap=cmocean.cm.gray_r)
  35. plt.colorbar()
  36. ax1 = plt.gca()
  37. ax1.set_ylim( ax1.get_ylim()[1], ax1.get_ylim()[0] )
  38. #ax1.set_xscale('log')
  39. #ax1.xaxis.set_major_formatter(ScalarFormatter())
  40. ax1.set_xticks([ax1.get_xlim()[0], 1, ax1.get_xlim()[1],])
  41. ax1.xaxis.set_major_formatter(FormatStrFormatter('%.1f'))
  42. #print(yaml.dump(K0.K0))
  43. #print( K0.K0["layer-0"].data )
  44. #print( type( np.array(K0.K0["layer-0"].data) ) )
  45. #plt.plot( np.real( K0.K0["layer-0"].data ) )
  46. #plt.plot( K0.K0["layer-0"].data )
  47. plt.show()
  48. #print(yaml.dump(K0))