你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Removed MATLAB scripts.
这个提交包含在:
@@ -1,56 +0,0 @@
|
||||
% outputfiles_merge.m
|
||||
% Script to merge gprMax output files of A-scans (traces) into a single
|
||||
% HDF5 file
|
||||
%
|
||||
% Craig Warren
|
||||
|
||||
clear all, clc
|
||||
|
||||
[filenames, pathname] = uigetfile('*.out', 'Select gprMax A-scan output files to merge', 'MultiSelect', 'on');
|
||||
|
||||
% Combine A-scans (traces) into a single HDF5 output file
|
||||
if filenames{1} ~= 0
|
||||
[pathstr, basefilename, ext] = fileparts(filenames{1});
|
||||
outputfile = strcat(fullfile(pathname, basefilename(1:end-1)), '_all.out');
|
||||
modelruns = length(filenames);
|
||||
filename = fullfile(pathname, filenames{1});
|
||||
iterations = double(h5readatt(filename, '/', 'Iterations'));
|
||||
dt = h5readatt(filename, '/', 'dt');
|
||||
h5create(outputfile, '/rxs/rx1/Ex', [modelruns iterations]);
|
||||
h5create(outputfile, '/rxs/rx1/Ey', [modelruns iterations]);
|
||||
h5create(outputfile, '/rxs/rx1/Ez', [modelruns iterations]);
|
||||
h5create(outputfile, '/rxs/rx1/Hx', [modelruns iterations]);
|
||||
h5create(outputfile, '/rxs/rx1/Hy', [modelruns iterations]);
|
||||
h5create(outputfile, '/rxs/rx1/Hz', [modelruns iterations]);
|
||||
h5writeatt(outputfile, '/', 'Iterations', iterations);
|
||||
h5writeatt(outputfile, '/', 'dt', dt);
|
||||
Ex = zeros(iterations, modelruns);
|
||||
Ey = zeros(iterations, modelruns);
|
||||
Ez = zeros(iterations, modelruns);
|
||||
Hx = zeros(iterations, modelruns);
|
||||
Hy = zeros(iterations, modelruns);
|
||||
Hz = zeros(iterations, modelruns);
|
||||
for rx=1:modelruns
|
||||
filename = fullfile(pathname, filenames{rx});
|
||||
Ex(:, rx) = h5read(filename, '/rxs/rx1/Ex');
|
||||
Ey(:, rx) = h5read(filename, '/rxs/rx1/Ey');
|
||||
Ez(:, rx) = h5read(filename, '/rxs/rx1/Ez');
|
||||
Hx(:, rx) = h5read(filename, '/rxs/rx1/Hx');
|
||||
Hy(:, rx) = h5read(filename, '/rxs/rx1/Hy');
|
||||
Hz(:, rx) = h5read(filename, '/rxs/rx1/Hz');
|
||||
end
|
||||
h5write(outputfile, '/rxs/rx1/Ex', Ex');
|
||||
h5write(outputfile, '/rxs/rx1/Ey', Ey');
|
||||
h5write(outputfile, '/rxs/rx1/Ez', Ez');
|
||||
h5write(outputfile, '/rxs/rx1/Hx', Hx');
|
||||
h5write(outputfile, '/rxs/rx1/Hy', Hy');
|
||||
h5write(outputfile, '/rxs/rx1/Hz', Hz');
|
||||
prompt = 'Do you want to remove the multiple individual output files? [y] or n: ';
|
||||
check = input(prompt,'s');
|
||||
if isempty(check) || check == 'y'
|
||||
for f=1:length(filenames)
|
||||
filename = fullfile(pathname, filenames{f});
|
||||
delete(filename);
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,89 +0,0 @@
|
||||
% plot_Ascan.m
|
||||
% Script to save and plot EM fields from a gprMax A-scan
|
||||
%
|
||||
% Craig Warren
|
||||
|
||||
clear all, clc
|
||||
|
||||
[filename, pathname] = uigetfile('*.out', 'Select gprMax A-scan output file to plot');
|
||||
fullfilename = strcat(pathname, filename);
|
||||
|
||||
if filename ~= 0
|
||||
header.title = h5readatt(fullfilename, '/', 'Title');
|
||||
header.iterations = double(h5readatt(fullfilename,'/', 'Iterations'));
|
||||
tmp = h5readatt(fullfilename, '/', 'dx, dy, dz');
|
||||
header.dx = tmp(1);
|
||||
header.dy = tmp(2);
|
||||
header.dz = tmp(3);
|
||||
header.dt = h5readatt(fullfilename, '/', 'dt');
|
||||
header.nsrc = h5readatt(fullfilename, '/', 'nsrc');
|
||||
header.nrx = h5readatt(fullfilename, '/', 'nrx');
|
||||
|
||||
% Time vector for plotting
|
||||
time = linspace(0, (header.iterations)*(header.dt)*1E9, header.iterations);
|
||||
|
||||
% Initialise structure for field arrays
|
||||
fields.ex = zeros(header.iterations, header.nrx);
|
||||
fields.ey = zeros(header.iterations, header.nrx);
|
||||
fields.ez = zeros(header.iterations, header.nrx);
|
||||
fields.hx = zeros(header.iterations, header.nrx);
|
||||
fields.hy = zeros(header.iterations, header.nrx);
|
||||
fields.hz = zeros(header.iterations, header.nrx);
|
||||
|
||||
prompt = 'Would you like to save a PDF of the plot(s)? y or [n]: ';
|
||||
pdf = input(prompt,'s');
|
||||
|
||||
% Save and plot fields from each receiver
|
||||
for n=1:header.nrx
|
||||
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'));
|
||||
fields.hx(:,n) = h5read(fullfilename, strcat(path, 'Hx'));
|
||||
fields.hy(:,n) = h5read(fullfilename, strcat(path, 'Hy'));
|
||||
fields.hz(:,n) = h5read(fullfilename, strcat(path, 'Hz'));
|
||||
|
||||
fh1=figure('Name', strcat('rx', num2str(n)));
|
||||
ax1 = subplot(2,3,1); plot(time, fields.ex(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [V/m]'), title('E_x')
|
||||
ax2 = subplot(2,3,2); plot(time, fields.ey(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [V/m]'), title('E_y')
|
||||
ax3 = subplot(2,3,3); plot(time, fields.ez(:,n), 'r', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [V/m]'), title('E_z')
|
||||
ax4 = subplot(2,3,4); plot(time, fields.hx(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [A/m]'), title('H_x')
|
||||
ax5 = subplot(2,3,5); plot(time, fields.hy(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [A/m]'), title('H_y')
|
||||
ax6 = subplot(2,3,6); plot(time, fields.hz(:,n), 'b', 'LineWidth', 2), grid on, xlabel('Time [ns]'), ylabel('Field strength [A/m]'), title('H_z')
|
||||
ax1.FontSize = 16;
|
||||
ax2.FontSize = ax1.FontSize;
|
||||
ax3.FontSize = ax1.FontSize;
|
||||
ax4.FontSize = ax1.FontSize;
|
||||
ax5.FontSize = ax1.FontSize;
|
||||
ax6.FontSize = ax1.FontSize;
|
||||
|
||||
% Options to create a nice looking figure for display and printing
|
||||
set(fh1,'Color','white','Menubar','none');
|
||||
X = 60; % Paper size
|
||||
Y = 30; % Paper size
|
||||
xMargin = 0; % Left/right margins from page borders
|
||||
yMargin = 0; % Bottom/top margins from page borders
|
||||
xSize = X - 2*xMargin; % Figure size on paper (width & height)
|
||||
ySize = Y - 2*yMargin; % Figure size on paper (width & height)
|
||||
|
||||
% Figure size displayed on screen
|
||||
set(fh1, 'Units','centimeters', 'Position', [0 0 xSize ySize])
|
||||
movegui(fh1, 'center')
|
||||
|
||||
% Figure size printed on paper
|
||||
set(fh1,'PaperUnits', 'centimeters')
|
||||
set(fh1,'PaperSize', [X Y])
|
||||
set(fh1,'PaperPosition', [xMargin yMargin xSize ySize])
|
||||
set(fh1,'PaperOrientation', 'portrait')
|
||||
|
||||
% Export to PDF
|
||||
if pdf == 'y'
|
||||
print(fh1, '-dpdf', '-r0', strcat(fullfilename(1:end-4), '_rx', num2str(n), '.pdf'));
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,65 +0,0 @@
|
||||
% plot_Bscan.m
|
||||
% Script to plot EM fields from a gprMax B-scan
|
||||
%
|
||||
% Craig Warren
|
||||
|
||||
clear all, clc
|
||||
|
||||
[filename, pathname] = uigetfile('*.out', 'Select gprMax output file to plot B-scan', 'MultiSelect', 'on');
|
||||
filename = fullfile(pathname, filename);
|
||||
|
||||
% Open file and read fields
|
||||
if filename ~= 0
|
||||
iterations = double(h5readatt(filename, '/', 'Iterations'));
|
||||
dt = h5readatt(filename, '/', 'dt');
|
||||
Ex = h5read(filename, '/rxs/rx1/Ex')';
|
||||
Ey = h5read(filename, '/rxs/rx1/Ey')';
|
||||
Ez = h5read(filename, '/rxs/rx1/Ez')';
|
||||
Hx = h5read(filename, '/rxs/rx1/Hx')';
|
||||
Hy = h5read(filename, '/rxs/rx1/Hy')';
|
||||
Hz = h5read(filename, '/rxs/rx1/Hz')';
|
||||
end
|
||||
|
||||
prompt = 'Would you like to save a PDF of the plot? y or [n]: ';
|
||||
pdf = input(prompt,'s');
|
||||
|
||||
prompt = 'Which field do you want to view? Ex, Ey, or Ez: ';
|
||||
field = input(prompt,'s');
|
||||
field = eval(field);
|
||||
time = 0:dt:iterations * dt;
|
||||
traces = 0:size(field,2);
|
||||
|
||||
fh1=figure('Name', filename);
|
||||
clims = [-max(max(abs(field))) max(max(abs(field)))];
|
||||
im = imagesc(traces, time, field, clims);
|
||||
xlabel('Trace number');
|
||||
ylabel('Time [s]');
|
||||
c = colorbar;
|
||||
c.Label.String = 'Field strength [V/m]';
|
||||
ax = gca;
|
||||
ax.FontSize = 16;
|
||||
xlim([0 traces(end)]);
|
||||
|
||||
% Options to create a nice looking figure for display and printing
|
||||
set(fh1,'Color','white','Menubar','none');
|
||||
X = 60; % Paper size
|
||||
Y = 30; % Paper size
|
||||
xMargin = 0; % Left/right margins from page borders
|
||||
yMargin = 0; % Bottom/top margins from page borders
|
||||
xSize = X - 2*xMargin; % Figure size on paper (width & height)
|
||||
ySize = Y - 2*yMargin; % Figure size on paper (width & height)
|
||||
|
||||
% Figure size displayed on screen
|
||||
set(fh1, 'Units','centimeters', 'Position', [0 0 xSize ySize])
|
||||
movegui(fh1, 'center')
|
||||
|
||||
% Figure size printed on paper
|
||||
set(fh1,'PaperUnits', 'centimeters')
|
||||
set(fh1,'PaperSize', [X Y])
|
||||
set(fh1,'PaperPosition', [xMargin yMargin xSize ySize])
|
||||
set(fh1,'PaperOrientation', 'portrait')
|
||||
|
||||
% Export to PDF
|
||||
if pdf == 'y'
|
||||
print(fh1, '-dpdf', '-r0', strcat(filename(1:end-4), '.pdf'));
|
||||
end
|
在新工单中引用
屏蔽一个用户