-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot_out_Data.py
36 lines (30 loc) · 1.3 KB
/
plot_out_Data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#import argparse
import os
import numpy as np
import matplotlib.pyplot as plt
def out_plot(filename, outputdata, dt, rxnumber, rxcomponent):
"""Creates a plot (with matplotlib) of the B-scan.
Args:
filename (string): Filename (including path) of output file.
outputdata (array): Array of A-scans, i.e. B-scan data.
dt (float): Temporal resolution of the model.
rxnumber (int): Receiver output number.
rxcomponent (str): Receiver output field/current component.
Returns:
plt (object): matplotlib plot object.
"""
(path, filename) = os.path.split(filename)
fig = plt.figure(num=filename + ' - rx' + str(rxnumber), figsize=(20, 10), facecolor='w', edgecolor='w')
plt.imshow(outputdata, extent=[0, outputdata.shape[1], outputdata.shape[0] * 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]')
plt.grid()
cb = plt.colorbar()
if 'E' in rxcomponent:
cb.set_label('Field strength [V/m]')
elif 'H' in rxcomponent:
cb.set_label('Field strength [A/m]')
elif 'I' in rxcomponent:
cb.set_label('Current [A]')
fig.show()
# return fig