In the tools
sub-package is a module called plot_Ascan
which can be used to plot A-scans or single traces from models. The module will plot electric and magnetic field components and currents from any outputs (defined using the #rx
command) in a model. When a single field component or current is specified, a FFT can also be plotted. The module takes an argument which is the name of the output file and several optional arguments:
--outputs
which can be any field component or current, i.e. Ex
, Ey
, Ez
, Hx
, Hy
, Hz
, Ix
, Iy
, or Iz
, so long as those components or currents were specified in the output in the model (default is for all electric and magnetic field components to be plotted)-fft
a switch to turn on the FFT plotting for a single field component or currentEach output (#rx
) from a model will be plotted in a separate figure window.
For example (to use the module outside this notebook) to plot the Ez
component of an output with its FFT:
python -m tools.plot_Ascan user_models/cylinder_Ascan_2D.out --outputs Ez -fft
You can use the following code to experiment (in this notebook) with plotting different field/current components and FFTs.
In [3]:
%matplotlib inline
import os
from gprMax.receivers import Rx
from tools.plot_Ascan import mpl_plot
filename = os.path.join(os.pardir, os.pardir, 'user_models', 'cylinder_Ascan_2D.out')
outputs = Rx.defaultoutputs
outputs = ['Ez']
plt = mpl_plot(filename, outputs, fft=False)