.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "content/examples/06-tdem/plot_fwd_tdem_waveforms.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_content_examples_06-tdem_plot_fwd_tdem_waveforms.py: TDEM: Waveforms =============== In this example, we plot the waveforms available in the TDEM module in addition to the `StepOffWaveform` .. GENERATED FROM PYTHON SOURCE LINES 8-66 .. image-sg:: /content/examples/06-tdem/images/sphx_glr_plot_fwd_tdem_waveforms_001.png :alt: RampOffWaveform, TriangularWaveform, TrapezoidWaveform, HalfSineWaveform, QuarterSineRampOnWaveform, ExponentialWaveform, VTEMWaveform :srcset: /content/examples/06-tdem/images/sphx_glr_plot_fwd_tdem_waveforms_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from SimPEG.electromagnetics import time_domain as TDEM from SimPEG.utils import mkvc nT = 1000 max_t = 5e-3 times = max_t * np.arange(0, nT) / float(nT) # create the waveforms ramp_off = TDEM.Src.RampOffWaveform(off_time=max_t) vtem = TDEM.Src.VTEMWaveform() trapezoid = TDEM.Src.TrapezoidWaveform( ramp_on=np.r_[0.0, 1.5e-3], ramp_off=max_t - np.r_[1.5e-3, 0] ) triangular = TDEM.Src.TriangularWaveform( start_time=0.0, peak_time=max_t / 2, off_time=max_t ) quarter_sine = TDEM.Src.QuarterSineRampOnWaveform( ramp_on=np.r_[0.0, 1.5e-3], ramp_off=max_t - np.r_[1.5e-3, 0] ) half_sine = TDEM.Src.HalfSineWaveform( ramp_on=np.r_[0.0, 1.5e-3], ramp_off=max_t - np.r_[1.5e-3, 0] ) exponential = TDEM.Src.ExponentialWaveform( start_time=0.0, peak_time=0.003, off_time=0.005, ramp_on_tau=5e-4 ) waveforms = dict( zip( [ "RampOffWaveform", "TrapezoidWaveform", "QuarterSineRampOnWaveform", "VTEMWaveform", "TriangularWaveform", "HalfSineWaveform", "ExponentialWaveform", ], [ramp_off, trapezoid, quarter_sine, vtem, triangular, half_sine, exponential], ) ) # plot the waveforms fig, ax = plt.subplots(4, 2, figsize=(7, 10)) 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)") # deactivate last subplot as it is empty ax[-1].axis("off") plt.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.434 seconds) **Estimated memory usage:** 9 MB .. _sphx_glr_download_content_examples_06-tdem_plot_fwd_tdem_waveforms.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_fwd_tdem_waveforms.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_fwd_tdem_waveforms.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_