Browse Source

Added plotting utilities for viewing kernels

master
T-bone 7 years ago
parent
commit
9dc6e0e4b2
2 changed files with 39 additions and 0 deletions
  1. 17
    0
      examples/plotkernel.py
  2. 22
    0
      examples/plotkerneldiff.py

+ 17
- 0
examples/plotkernel.py View File

@@ -0,0 +1,17 @@
1
+import numpy as np
2
+import matplotlib.pyplot as plt
3
+import sys
4
+
5
+K = np.loadtxt(sys.argv[1], comments="#")
6
+nx, ny = np.shape(K)
7
+
8
+plt.matshow(K[0:nx//2])
9
+plt.colorbar()
10
+
11
+plt.matshow(K[nx//2:])
12
+plt.colorbar()
13
+
14
+KA = np.abs(K[0:nx//2] + 1j*K[nx//2:])
15
+plt.matshow(1e9*KA, cmap='viridis')
16
+plt.colorbar()
17
+plt.show()

+ 22
- 0
examples/plotkerneldiff.py View File

@@ -0,0 +1,22 @@
1
+import numpy as np
2
+import matplotlib.pyplot as plt
3
+import sys
4
+
5
+K1 = np.loadtxt(sys.argv[1], comments="#")
6
+K2 = np.loadtxt(sys.argv[2], comments="#")
7
+nx, ny = np.shape(K1)
8
+
9
+plt.matshow( K1[0:nx//2] - K2[0:nx//2] , cmap='inferno')
10
+plt.colorbar()
11
+
12
+plt.matshow( K1[nx//2:] - K2[nx//2] , cmap='inferno')
13
+plt.colorbar()
14
+
15
+KAc =   K1[0:nx//2]+1j*K1[nx//2:]
16
+KA2c =  K2[0:nx//2]+1j*K2[nx//2:]
17
+#              (K1[0:nx//2]+1j*K1[nx//2:]) )
18
+KD = np.abs(KAc) - np.abs(KA2c)
19
+
20
+plt.matshow(KD, cmap='RdBu', vmin=-np.max(np.abs(KD)), vmax=np.max(np.abs(KD)) )
21
+plt.colorbar()
22
+plt.show()

Loading…
Cancel
Save