Plotting a B-scan

In the tools sub-package is a module called plot_Bscan which can be used to plot a B-scan (collection of A-scans) from models. The module takes an argument which is the name of the output file and a further argument which can be any field component or current, i.e. Ex, Ey, Ez, Hx, Hy, Hz, Ix, Iy, or Iz, so long as that component or current was specified in the output in the model.

For example (to use the module outside this notebook) to plot the B-scan of the Ez component of an output:

python -m tools.plot_Bscan user_models/cylinder_Bscan_2D_merged.out Ez

You can use the following code to experiment (in this notebook) with plotting different field/current components.


In [1]:
%matplotlib inline
import os
from tools.plot_Bscan import get_output_data, mpl_plot

filename = os.path.join(os.pardir, os.pardir, 'user_models', 'cylinder_Bscan_2D_merged.out')
rxnumber = 1
rxcomponent = 'Ez'
outputdata, dt = get_output_data(filename, rxnumber, rxcomponent)
plt = mpl_plot(outputdata, dt, rxnumber, rxcomponent)

# Change from the default 'seismic' colormap
#plt.set_cmap('gray')