Updated to merge and plot (in separate figure windows) multiple receiver points.

这个提交包含在:
Craig Warren
2016-02-19 14:27:31 +00:00
父节点 45123401c4
当前提交 bbc8a101ec
共有 2 个文件被更改,包括 46 次插入33 次删除

查看文件

@@ -30,8 +30,7 @@ args = parser.parse_args()
basefilename = args.basefilename
modelruns = args.modelruns
outputfile = basefilename + '_merge.out'
path = '/rxs/rx1'
outputfile = basefilename + '_merged.out'
# Combined output file
fout = h5py.File(outputfile, 'w')
@@ -39,16 +38,27 @@ fout = h5py.File(outputfile, 'w')
# Add positional data for rxs
for model in range(modelruns):
fin = h5py.File(basefilename + str(model + 1) + '.out', 'r')
availableoutputs = list(fin[path].keys())
nrx = fin.attrs['nrx']
# Write properties for merged file on first iteration
if model == 0:
fout.attrs['Iterations'] = fin.attrs['Iterations']
fout.attrs['dt'] = fin.attrs['dt']
fields = fout.create_group(path)
fout.attrs['nrx'] = fin.attrs['nrx']
for rx in range(1, nrx + 1):
path = '/rxs/rx' + str(rx)
grp = fout.create_group(path)
availableoutputs = list(fin[path].keys())
for output in availableoutputs:
fields[output] = np.zeros((fout.attrs['Iterations'], modelruns), dtype=fin[path + '/' + output].dtype)
grp.create_dataset(output, (fout.attrs['Iterations'], modelruns), dtype=fin[path + '/' + output].dtype)
# For all receivers
for rx in range(1, nrx + 1):
path = '/rxs/rx' + str(rx) + '/'
availableoutputs = list(fin[path].keys())
# For all receiver outputs
for output in availableoutputs:
fields[path + '/' + output][:,model] = fin[path + '/' + output][:]
fout[path + '/' + output][:,model] = fin[path + '/' + output][:]
fin.close()

查看文件

@@ -33,7 +33,10 @@ args = parser.parse_args()
# Open output file and read some attributes
f = h5py.File(args.outputfile, 'r')
path = '/rxs/rx1'
nrx = f.attrs['nrx']
for rx in range(1, nrx + 1):
path = '/rxs/rx' + str(rx) + '/'
availableoutputs = list(f[path].keys())
# Check if requested output is in file
@@ -47,7 +50,7 @@ if outputdata.shape[1] == 1:
raise CmdInputError('{} contains only a single A-scan.'.format(args.outputfile))
# Plot B-scan image
fig = plt.figure(num=args.outputfile, figsize=(20, 10), facecolor='w', edgecolor='w')
fig = plt.figure(num='rx' + str(rx), figsize=(20, 10), facecolor='w', edgecolor='w')
plt.imshow(outputdata, extent=[0, outputdata.shape[1], outputdata.shape[0]*f.attrs['dt'], 0], interpolation='nearest', aspect='auto', cmap='seismic', vmin=-np.amax(np.abs(outputdata)), vmax=np.amax(np.abs(outputdata)))
plt.xlabel('Trace number')
plt.ylabel('Time [s]')