Skip to content

Commit b20a8d0

Browse files
committed
TEST: add kernel_freq_response in example/, and add some figs in README
1 parent c890623 commit b20a8d0

File tree

7 files changed

+59
-3
lines changed

7 files changed

+59
-3
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
[**中文文档**](https://pygrt.readthedocs.io/zh-cn/)
1515

1616
# Overview
17-
**[PyGRT](https://github.com/Dengda98/PyGRT): An Efficient and Integrated C/Python Package for Computing Synthetic Seismograms, Strain and Stress in a Layered Half-Space Model (Dynamic & Static Cases)**
17+
**[PyGRT](https://github.com/Dengda98/PyGRT): An Efficient and Integrated C/Python Package for Computing Synthetic Seismograms, Strain, Rotation and Stress Tensor in a Layered Half-Space Model (Dynamic & Static Cases)**
1818

1919
+ **PyGRT** now can compute following properties in **both dynamic and static case.**
2020
- [x] **Displacements and its spatial derivatives**
21-
- [x] **Strain**
22-
- [x] **Stress**
21+
- [x] **Strain Tensor**
22+
- [x] **Rotation Tensor**
23+
- [x] **Stress Tensor**
2324

2425

2526
+ **At present, PyGRT can run on**
@@ -138,6 +139,16 @@ Then you can run the command like `grt` in terminal.
138139
<img alt="static_exp" src="example/static_disp/disp_exp.png" width="200">
139140
</p>
140141
142+
<p align='center'>
143+
<img alt="imag_G" src="example/view_integ_stats/view_stats.png" width="600">
144+
</p>
145+
146+
<p align='center'>
147+
<img alt="imag_G" src="example/kernel_freq_response/imag_G.png" width="500">
148+
</p>
149+
150+
151+
141152
# Contact
142153
If you have any questions or suggestions, feel free to reach out:
143154
- **Email**: [email protected]
62.4 KB
Loading

example/kernel_freq_response/mod1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.01 1.5 0.18 1.78 1e4 1e4
2+
0.01 1.7 0.35 1.85 1e4 1e4
3+
0.01 1.6 0.25 1.80 1e4 1e4
4+
0.01 2.0 0.6 1.94 1e4 1e4
5+
0.0 5.8 3.46 2.72 1e4 1e4
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -----------------------------------------------------------------
2+
# BEGIN GRN
3+
import numpy as np
4+
import matplotlib.pyplot as plt
5+
from typing import Union
6+
import pygrt
7+
8+
modarr = np.loadtxt("mod1")
9+
10+
pymod = pygrt.PyModel1D(modarr, depsrc=0.01, deprcv=0.0)
11+
12+
_ = pymod.compute_grn(distarr=[1], nt=500, dt=0.02, vmin_ref=0.1, Length=20, statsfile="pygrtstats")
13+
14+
vels = np.arange(0.1, 0.6, 0.001)
15+
16+
kerDct = pygrt.utils.read_kernels_freqs("pygrtstats", vels)
17+
18+
19+
Type = "HF_v1"
20+
vels = kerDct['_vels']
21+
freqs = kerDct['_freqs']
22+
data = kerDct[Type].copy()
23+
data[...] = data/np.max(np.abs(data), axis=1)[:,None]
24+
fig, ax = plt.subplots(1, 1)
25+
pcm = ax.pcolormesh(freqs, vels, np.abs(np.imag(data)).T, vmin=0, vmax=1, shading='nearest')
26+
fig.colorbar(pcm)
27+
28+
ax.set_xlim([0.5, 25])
29+
ax.set_ylim([0.1, 0.6])
30+
ax.set_xlabel("Frequency (km)")
31+
ax.set_ylabel("Velocity (m/s)")
32+
ax.set_title(f"Im[{Type}]")
33+
34+
fig.tight_layout()
35+
fig.savefig("imag_G.png", dpi=100)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
grt -Mmod1 -D0.01/0 -N500/0.02/0.8 -OGRN -R1 -V0.1 -S-1 -L20

example/view_integ_stats/view.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111

1212
data1, data2, ptamdata, dist = pygrt.utils.read_statsfile_ptam("stgrtstats/halfspace2_0.1_0/PTAM_0090_*/PTAM")
1313
fig, ax = pygrt.utils.plot_statsdata_ptam(data1, data2, ptamdata, dist, "DC", "2", "2")
14+
# fig.tight_layout()
15+
# fig.savefig("view_stats.png", dpi=100, bbox_inches='tight')
1416
plt.show()
92.3 KB
Loading

0 commit comments

Comments
 (0)