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