SimPEG.electromagnetics.time_domain.sources.RawWaveform#
- class SimPEG.electromagnetics.time_domain.sources.RawWaveform(off_time=0.0, waveform_function=None, **kwargs)[source]#
- Bases: - BaseWaveform- A waveform you can define. You need to provide a waveform_function that returns the waveform evaluated at a given time. This can be used, for example if you would like to interpolate between points specified in a waveform file. - Parameters:
- off_timefloat, default: 0.0
- time at which the transmitter is turned off in units of seconds (default is 0s) 
- waveform_function: function
 
- off_time
 - Examples - In this example, we define a saw-tooth waveform - >>> import matplotlib.pyplot as plt >>> import numpy as np >>> from SimPEG.electromagnetics import time_domain as tdem - >>> def my_waveform(t): >>> period = 1e-2 >>> quarter_period = period / 4 >>> t_cycle = np.mod(t, period) >>> if t_cycle <= quarter_period: >>> return t_cycle / quarter_period >>> elif (t_cycle > quarter_period) & (t_cycle <= 3*quarter_period): >>> return -t_cycle / quarter_period + 2 >>> elif t_cycle > 3*quarter_period: >>> return t_cycle / quarter_period - 4 - >>> times = np.linspace(0, 1e-2, 1000) >>> waveform = tdem.sources.RawWaveform(waveform_function=my_waveform) >>> plt.plot(times, [waveform.eval(t) for t in times]) >>> plt.show() - ( - Source code,- png,- pdf)  - Attributes - Window of time within which the waveform is considered on - Whether the waveform has initial fields. - Off-time - Function handle for a custom waveform - Methods - eval(time)- Evaluate current waveform at a given time - eval_deriv(time)- Evaluate the time derivative of the linear ramp-off waveform at given times 
