[cleanup] code cleanup by PyCharm
This commit is contained in:
@@ -17,6 +17,7 @@ from pylot.core.util.utils import common_range, fit_curve
|
||||
from scipy import integrate, signal
|
||||
from scipy.optimize import curve_fit
|
||||
|
||||
|
||||
def richter_magnitude_scaling(delta):
|
||||
distance = np.array([0, 10, 20, 25, 30, 35, 40, 45, 50, 60, 70, 75, 85, 90, 100, 110,
|
||||
120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 230, 240, 250,
|
||||
@@ -225,7 +226,7 @@ class LocalMagnitude(Magnitude):
|
||||
sqH = np.sqrt(power_sum)
|
||||
|
||||
# get time array
|
||||
th=np.arange(0, st[0].stats.npts/st[0].stats.sampling_rate, st[0].stats.delta)
|
||||
th = np.arange(0, st[0].stats.npts / st[0].stats.sampling_rate, st[0].stats.delta)
|
||||
# get maximum peak within pick window
|
||||
iwin = getsignalwin(th, t0 - stime, self.calc_win)
|
||||
ii = min([iwin[len(iwin) - 1], len(th)])
|
||||
@@ -245,9 +246,9 @@ class LocalMagnitude(Magnitude):
|
||||
ax.plot(th[iwin], sqH[iwin], 'g')
|
||||
ax.plot([t0 - stime, t0 - stime], [0, max(sqH)], 'r', linewidth=2)
|
||||
ax.set_title('Station %s, Channel %s, RMS Horizontal Trace, '
|
||||
'WA-peak-to-peak=%6.3f mm' % (st[0].stats.station,
|
||||
'WA-peak-to-peak=%6.3f mm' % (st[0].stats.station,
|
||||
st[0].stats.channel,
|
||||
wapp))
|
||||
wapp))
|
||||
ax.set_xlabel('Time [s]')
|
||||
ax.set_ylabel('Displacement [mm]')
|
||||
ax = fig.add_subplot(212)
|
||||
@@ -257,15 +258,16 @@ class LocalMagnitude(Magnitude):
|
||||
ax.plot([t0 - stime, t0 - stime], [0, max(sqH)], 'r', linewidth=2)
|
||||
ax.set_title('Channel %s, RMS Horizontal Trace, '
|
||||
'WA-peak-to-peak=%6.3f mm' % (st[1].stats.channel,
|
||||
wapp))
|
||||
wapp))
|
||||
ax.set_xlabel('Time [s]')
|
||||
ax.set_ylabel('Displacement [mm]')
|
||||
fig.show()
|
||||
try: input()
|
||||
except SyntaxError: pass
|
||||
try:
|
||||
input()
|
||||
except SyntaxError:
|
||||
pass
|
||||
plt.close(fig)
|
||||
|
||||
|
||||
return wapp, fig
|
||||
|
||||
def calc(self):
|
||||
@@ -309,7 +311,7 @@ class LocalMagnitude(Magnitude):
|
||||
a0 = a0 * 1e03 # mm to nm (see Havskov & Ottemöller, 2010)
|
||||
magnitude = ope.StationMagnitude(mag=np.log10(a0) \
|
||||
+ self.wascaling[0] * np.log10(delta) + self.wascaling[1]
|
||||
* delta + self.wascaling[
|
||||
* delta + self.wascaling[
|
||||
2])
|
||||
magnitude.origin_id = self.origin_id
|
||||
magnitude.waveform_id = pick.waveform_id
|
||||
@@ -372,7 +374,7 @@ class MomentMagnitude(Magnitude):
|
||||
|
||||
def calc(self):
|
||||
for a in self.arrivals:
|
||||
if a.phase not in 'pP':
|
||||
if a.phase not in 'pP':
|
||||
continue
|
||||
# make sure calculating Mo only from reliable onsets
|
||||
# NLLoc: time_weight = 0 => do not use onset!
|
||||
|
||||
Reference in New Issue
Block a user