forked from simpeg/simpeg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_waveforms.py
49 lines (40 loc) · 1.11 KB
/
plot_waveforms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
TDEM: Waveforms
===============
In this example, we plot the waveforms available in the TDEM module in addition
to the `StepOffWaveform`
"""
import numpy as np
import matplotlib.pyplot as plt
from SimPEG.Utils import mkvc
from SimPEG.EM import TDEM
nT = 1000
max_t = 5e-3
times = max_t * np.arange(0, nT) / float(nT)
# create the waveforms
ramp_off = TDEM.Src.RampOffWaveform(offTime=max_t)
vtem = TDEM.Src.VTEMWaveform()
trapezoid = TDEM.Src.TrapezoidWaveform(
ramp_on=np.r_[0., 1.5e-3], ramp_off=max_t-np.r_[1.5e-3, 0]
)
quarter_sine = TDEM.Src.QuarterSineRampOnWaveform(
ramp_on=np.r_[0., 1.5e-3], ramp_off=max_t-np.r_[1.5e-3, 0]
)
waveforms = dict(zip(
[
'RampOffWaveform', 'VTEMWaveform', 'TrapezoidWaveform',
'QuarterSineRampOnWaveform'
],
[ramp_off, vtem, trapezoid, quarter_sine]
))
# plot the waveforms
fig, ax = plt.subplots(2, 2, figsize=(7, 7))
ax = mkvc(ax)
for a, key in zip(ax, waveforms):
wave = waveforms[key]
wave_plt = [wave.eval(t) for t in times]
a.plot(times, wave_plt)
a.set_title(key)
a.set_xlabel('time (s)')
plt.tight_layout()
plt.show()