Skip to content

Commit 91584f0

Browse files
authored
Merge pull request #45 from paudetseis/fixhk
fixed deprecated np.complex and np.float in hk
2 parents d63c561 + a26b04b commit 91584f0

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

docs/scripts.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -361,25 +361,25 @@ Usage
361361
Plot Settings:
362362
Options for plot format
363363
364-
--scale SCALE Specify the scaling factor for the amplitude of the
365-
receiver functions in the wiggle plots. [Default 100.
366-
for a back-azimuth plot, 0.02 for a slowness plot]
364+
--stack Set this option to plot a stack of all traces in top
365+
panel. [Default does not plot stacked traces]
367366
--normalize Set this option to produce receiver functions
368367
normalized by the max amplitude of stacked RFs.
369368
[Default False]
370-
--trange TRANGE Specify the time range for the x-axis (sec). Negative
371-
times are allowed [Default 0., 30.]
372-
--stacked Set this option to plot a stack of all traces in top
373-
panel. [Default does not plot stacked traces]
374-
--save Set this option if you wish to save the figure.
375-
[Default does not save figure]
376-
--title TITLEPLOT Specify title of figure. [Default None]
377-
--format FORM Specify format of figure. Can be any one of the
378-
validmatplotlib formats: 'png', 'jpg', 'eps', 'pdf'.
379-
[Default 'png']
380-
--plot-event-dist Plot distribution of events on map. Other Plotting
381-
Options will be applied to this figure (title, save,
382-
etc.). [Default no plot]
369+
--trange TRANGE Specify two floats that define the time range (in
370+
sec.) for the x-axis on the RF figure. Negative times
371+
are allowed [Default 0., 30.]
372+
--save-fig FIGNAME Specify figure filename if you wish to save the
373+
figure. By default, the station name will be pre-
374+
appended to the file name and saved to 'RF_PLOTS'
375+
unless --save-rfs is set. Valid figure formats are
376+
'png', 'jpg', 'eps', 'pdf'. [Default does not save
377+
figure]
378+
--save-rfs RF_FOLDER Specify folder name to save the plotted RFs. Lower
379+
case characters will be capitalized. [Default does not
380+
save RFs]
381+
--hide-fig Specify if you do not wish to show the figure upon
382+
execution. [Default shows the figure]
383383
384384
385385
``rfpy_hk``

rfpy/harmonics.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def dcomp_find_azim(self, xmin=None, xmax=None):
144144
nbin = len(self.radialRF)
145145
nz = len(self.radialRF[0].data)
146146
naz = 180
147-
daz = np.float(360/naz)
147+
daz = float(360/naz)
148148
deg2rad = np.pi/180.
149149

150150
# Define depth range over which to calculate azimuth
@@ -203,11 +203,11 @@ def dcomp_find_azim(self, xmin=None, xmax=None):
203203
CC = np.linalg.solve(s[:, None] * v, u.T.dot(OBS)[:5])
204204

205205
# Fill up arrays
206-
C0[iz, iaz] = np.float(CC[0])
207-
C1[iz, iaz] = np.float(CC[1])
208-
C2[iz, iaz] = np.float(CC[2])
209-
C3[iz, iaz] = np.float(CC[3])
210-
C4[iz, iaz] = np.float(CC[4])
206+
C0[iz, iaz] = float(CC[0])
207+
C1[iz, iaz] = float(CC[1])
208+
C2[iz, iaz] = float(CC[2])
209+
C3[iz, iaz] = float(CC[3])
210+
C4[iz, iaz] = float(CC[4])
211211

212212
# Minimize variance of third component over specific depth range to
213213
# find azim
@@ -312,11 +312,11 @@ def dcomp_fix_azim(self, azim=None):
312312
CC = np.linalg.solve(s[:, None] * v, u.T.dot(OBS)[:5])
313313

314314
# Fill up arrays
315-
C0[iz] = np.float(CC[0])
316-
C1[iz] = np.float(CC[1])
317-
C2[iz] = np.float(CC[2])
318-
C3[iz] = np.float(CC[3])
319-
C4[iz] = np.float(CC[4])
315+
C0[iz] = float(CC[0])
316+
C1[iz] = float(CC[1])
317+
C2[iz] = float(CC[2])
318+
C3[iz] = float(CC[3])
319+
C4[iz] = float(CC[4])
320320

321321
# Put back into traces
322322
A = Trace(data=C0, header=str_stats)

rfpy/hk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def stack(self, vp=None):
175175
k = np.arange(self.kbound[0], self.kbound[1] + self.dk, self.dk)
176176

177177
# Initialize arrays
178-
weight = np.complex(0.)
178+
weight = complex(0.)
179179
amp = np.zeros(len(self.rfV1))
180180
sig = np.zeros((len(H), len(k), len(self.phases)))
181181
pws = np.zeros((len(H), len(k), len(self.phases)))
@@ -275,7 +275,7 @@ def stack_dip(self, vp=None, strike=None, dip=None):
275275
k = np.arange(self.kbound[0], self.kbound[1] + self.dk, self.dk)
276276

277277
# Initialize arrays
278-
weight = np.complex(0.)
278+
weight = complex(0.)
279279
amp = np.zeros(len(self.rfV1))
280280
sig = np.zeros((len(H), len(k), len(self.phases)))
281281
pws = np.zeros((len(H), len(k), len(self.phases)))
@@ -300,7 +300,7 @@ def stack_dip(self, vp=None, strike=None, dip=None):
300300
weight += np.exp(1j*tphase[0])
301301
amp[i] = trace[0]
302302

303-
weight = abs(weight/np.float(len(self.rfV1)))**4
303+
weight = abs(weight/float(len(self.rfV1)))**4
304304
sig[ih, ik, ip] = np.var(amp)*np.real(weight)
305305
pws[ih, ik, ip] = np.median(amp)*np.real(weight)
306306

0 commit comments

Comments
 (0)