# 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_time`float`, default: 0.0

time at which the transmitter is turned off in units of seconds (default is 0s)

waveform_function: function

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()
```

Attributes

 `waveFct` waveform_function.waveFct has been deprecated. `waveform_function` Function handle for a custom waveform

Methods

 `eval`(time) Evaluate current waveform at a given time

## Galleries and Tutorials using `SimPEG.electromagnetics.time_domain.sources.RawWaveform`# EM: TDEM: 1D: Inversion with VTEM waveform

EM: TDEM: 1D: Inversion with VTEM waveform