Skip to content

Commit b48b852

Browse files
committed
improve plot.py documentation
1 parent 78094c4 commit b48b852

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

simwave/plots/plot.py

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,32 @@
66

77

88
def plot_wavefield(wavefield, file_name="wavefield", colorbar=True,
9-
cmap="gray", extent=None, show=False, clim=[-5, 5],):
9+
cmap="gray", extent=None, show=False, clim=[-5, 5]):
10+
"""
11+
Plot the wavefield.
12+
13+
Parameters
14+
----------
15+
wavefield : ndarray
16+
Wavefield data.
17+
file_name : str, optional
18+
Name of the image to be saved.
19+
Default is wavefield.
20+
colorbar : bool, optional
21+
If True, show a colorbar. Default is True.
22+
cmap : str, optional
23+
The Colormap instance or registered colormap name
24+
used to map scalar data to colors.
25+
Default is gray.
26+
extent : floats(left, right, bottom, top), optional
27+
The bounding box in data coordinates that the image will fill.
28+
show : bool, optional
29+
If True, show the image on a pop up window.
30+
Default is False.
31+
clim : list
32+
Set the color limits of the current image.
33+
Default is (vmin=-5, vmax=5).
34+
"""
1035

1136
# create the destination dir
1237
os.makedirs("plots", exist_ok=True)
@@ -44,8 +69,16 @@ def plot_shotrecord(rec, file_name="shotrecord", colorbar=True, show=False):
4469
4570
Parameters
4671
----------
47-
rec :
72+
rec : ndarray
4873
Receiver data with shape (time, points).
74+
file_name : str, optional
75+
Name of the image to be saved.
76+
Default is wavelet.
77+
colorbar : bool, optional
78+
If True, show a colorbar. Default is True.
79+
show : bool, optional
80+
If True, show the image on a pop up window.
81+
Default is False.
4982
"""
5083
scale = np.max(rec) / 10.0
5184
plot = plt.imshow(rec, vmin=-scale, vmax=scale, cmap=cm.gray)
@@ -73,6 +106,28 @@ def plot_shotrecord(rec, file_name="shotrecord", colorbar=True, show=False):
73106

74107
def plot_velocity_model(model, file_name="velocity_model", colorbar=True,
75108
extent=None, cmap="jet", show=False):
109+
"""
110+
Plot the velocity model.
111+
112+
Parameters
113+
----------
114+
model : ndarray
115+
Velocity model data.
116+
file_name : str, optional
117+
Name of the image to be saved.
118+
Default is velocity_model.
119+
colorbar : bool, optional
120+
If True, show a colorbar. Default is True.
121+
cmap : str, optional
122+
The Colormap instance or registered colormap name
123+
used to map scalar data to colors.
124+
Default is jet.
125+
extent : floats(left, right, bottom, top), optional
126+
The bounding box in data coordinates that the image will fill.
127+
show : bool, optional
128+
If True, show the image on a pop up window.
129+
Default is False.
130+
"""
76131

77132
# create the destination dir
78133
os.makedirs("plots", exist_ok=True)
@@ -114,6 +169,12 @@ def plot_wavelet(time_values, wavelet_values,
114169
Discretized values of time in seconds.
115170
wavelet_values : list
116171
Pulse of the wavelet.
172+
file_name : str, optional
173+
Name of the image to be saved.
174+
Default is wavelet.
175+
show : bool, optional
176+
If True, show the image on a pop up window.
177+
Default is False.
117178
"""
118179
plt.plot(time_values, wavelet_values)
119180
plt.xlabel("Time (s)")

0 commit comments

Comments
 (0)