diff --git a/docs/source/examples_simple_2D.rst b/docs/source/examples_simple_2D.rst index af58f4f4..d5305a8f 100644 --- a/docs/source/examples_simple_2D.rst +++ b/docs/source/examples_simple_2D.rst @@ -110,7 +110,7 @@ You can now run the model: .. code-block:: none - python -m gprMax cylinder_Ascan_2D.in + python -m gprMax user_models/cylinder_Ascan_2D.in View the results ---------------- @@ -119,7 +119,7 @@ You should have produced an output file ``cylinder_Ascan_2D.out``. You can view .. code-block:: none - python -m tools.plot_Ascan cylinder_Ascan_2D.out + python -m tools.plot_Ascan user_models/cylinder_Ascan_2D.out :numref:`cylinder_Ascan_results` shows the time history of the electric and magnetic field components and currents at the receiver location. The :math:`E_z` field component can be converted to voltage which represents the A-scan (trace). The initial part of the signal (<1.5 ns) represents the direct wave from transmitter to receiver. Then comes the reflected wavelet from the metal cylinder. @@ -148,7 +148,7 @@ To run the model for a B-scan is slightly different than for a single A-scan. Yo .. code-block:: none - python -m gprMax cylinder_Bscan_2D.in -n 60 + python -m gprMax user_models/cylinder_Bscan_2D.in -n 60 Results @@ -158,7 +158,7 @@ You should have produced 60 output files, one for each A-scan, with names ``cyli .. code-block:: none - python -m tools.outputfiles_merge cylinder_Bscan_2D 60 + python -m tools.outputfiles_merge user_models/cylinder_Bscan_2D 60 You should see a combined output file ``cylinder_Bscan_2D_all.out``. The tool will ask you if you want to delete the original single A-scan output files or keep them. @@ -166,7 +166,7 @@ You can now view an image of the B-scan using the command: .. code-block:: none - python -m tools.plot_Bscan cylinder_Bscan_2D_all.out --field Ez + python -m tools.plot_Bscan user_models/cylinder_Bscan_2D_all.out Ez :numref:`cylinder_Bscan_results` shows the B-scan (image of the :math:`E_z` field component). As expected a hyperbolic response is present from the metal cylinder. diff --git a/setup.py b/setup.py index ab5706c1..be24bb11 100644 --- a/setup.py +++ b/setup.py @@ -107,7 +107,7 @@ elif sys.platform == 'darwin': if gccpath: os.environ['CC'] = gccpath[0].split(os.sep)[-1] else: - raise('Cannot find gcc in /usr/local/bin. gprMax requires gcc to be installed - easily done through the Homebrew package manager (http://brew.sh).') + raise('Cannot find gcc in /usr/local/bin. gprMax requires gcc to be installed - easily done through the Homebrew package manager (http://brew.sh). Note: gcc with OpenMP support must be installed') compile_args = ['-O3', '-fopenmp', '-w'] linker_args = ['-fopenmp'] # Linux diff --git a/tools/MATLAB scripts/plot_Ascan.m b/tools/MATLAB scripts/plot_Ascan.m index 0e48cbef..9b22b5ed 100644 --- a/tools/MATLAB scripts/plot_Ascan.m +++ b/tools/MATLAB scripts/plot_Ascan.m @@ -16,7 +16,7 @@ if filename ~= 0 header.dy = tmp(2); header.dz = tmp(3); header.dt = h5readatt(fullfilename, '/', 'dt'); - header.ntx = h5readatt(fullfilename, '/', 'ntx'); + header.nsrc = h5readatt(fullfilename, '/', 'nsrc'); header.nrx = h5readatt(fullfilename, '/', 'nrx'); % Time vector for plotting @@ -35,11 +35,12 @@ if filename ~= 0 % Save and plot fields from each receiver for n=1:header.nrx - path = strcat('/rxs/rx', num2str(n), '/'); - tmp = h5read(fullfilename, strcat(path, 'Position')); + path = strcat('/rxs/rx', num2str(n)); + tmp = h5readatt(fullfilename, path, 'Position'); header.rx(n) = tmp(1); header.ry(n) = tmp(2); header.rz(n) = tmp(3); + path = strcat(path, '/'); fields.ex(:,n) = h5read(fullfilename, strcat(path, 'Ex')); fields.ey(:,n) = h5read(fullfilename, strcat(path, 'Ey')); fields.ez(:,n) = h5read(fullfilename, strcat(path, 'Ez')); diff --git a/tools/plot_Bscan.py b/tools/plot_Bscan.py index 82db3440..b3f8bc42 100644 --- a/tools/plot_Bscan.py +++ b/tools/plot_Bscan.py @@ -26,22 +26,21 @@ from gprMax.exceptions import CmdInputError """Plots a B-scan image.""" # Parse command line arguments -parser = argparse.ArgumentParser(description='Plots a B-scan image.', usage='cd gprMax; python -m tools.plot_Bscan outputfile --field fieldcomponent') +parser = argparse.ArgumentParser(description='Plots a B-scan image.', usage='cd gprMax; python -m tools.plot_Bscan outputfile output') parser.add_argument('outputfile', help='name of output file including path') -parser.add_argument('--output', help='name of output to be plotted, i.e. Ex Ey Ez') +parser.add_argument('output', help='name of output to be plotted, i.e. Ex Ey Ez') args = parser.parse_args() # Open output file and read some attributes f = h5py.File(args.outputfile, 'r') path = '/rxs/rx1' availablecomponents = list(f[path].keys()) - + # Check if requested output is in file -if args.output[0] not in availablecomponents: - raise CmdInputError('{} output requested to plot, but the available output for receiver 1 is {}'.format(args.outputs[0], ', '.join(availablecomponents))) +if args.output not in availablecomponents: + raise CmdInputError('{} output requested to plot, but the available output for receiver 1 is {}'.format(args.output, ', '.join(availablecomponents))) outputdata = f[path + '/' + args.output] -f.close() # Check that there is more than one A-scan present if outputdata.shape[1] == 1: @@ -61,9 +60,10 @@ elif 'H' in args.output: elif 'I' in args.output: cb.set_label('Current [A]') -plt.show() - # Save a PDF/PNG of the figure #fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) #fig.savefig(os.path.splitext(os.path.abspath(file))[0] + '.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) +plt.show() +f.close() +