How can I plot the source spectrum?

How can I plot the source spectrum?#



2023-12-11 18:47:30


When defining a source, you must specify a source time profile, typically Gaussian. For example, we can define a plane wave as

plane_wave = td.PlaneWave(
  source_time=td.GaussianPulse(freq0=freq0, fwidth=0.5 * freqw),
  size=(td.inf, td.inf, 0),
  center=(0, 0, 0.3 * lda0),

Here, the source time is a Gaussian pulse with central frequency freq0 and frequency width 0.5 * freqw. To visualize the spectrum it gives, we can use the plot_spectrum method by

  times=np.linspace(0, sim.run_time, 2000), val="abs"

Here, we need to specify the sampled time instances. To ensure the source spectrum is plotted correctly, we need to ensure the time sampling is sufficiently fine and the end time is sufficiently long compared to the pulse width.