Merge branch 'develop' of ariadne.geophysik.ruhr-uni-bochum.de:/data/git/pylot into develop

This commit is contained in:
Marcel Paffrath 2017-08-11 16:07:43 +02:00
commit b3b3dca41a
4 changed files with 66 additions and 9 deletions

View File

@ -64,7 +64,7 @@ from pylot.core.io.data import Data
from pylot.core.io.inputs import FilterOptions, PylotParameter
from autoPyLoT import autoPyLoT
from pylot.core.pick.compare import Comparison
from pylot.core.pick.utils import symmetrize_error
from pylot.core.pick.utils import symmetrize_error, getQualityfromUncertainty
from pylot.core.io.phases import picksdict_from_picks
import pylot.core.loc.nll as nll
from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents
@ -1951,13 +1951,19 @@ class MainWindow(QMainWindow):
}
stat_picks = self.getPicks(type=picktype)[station]
stime = self.getStime()
for phase in stat_picks:
picks = stat_picks[phase]
if type(stat_picks[phase]) is not dict and type(stat_picks[phase]) is not AttribDict:
return
# get quality classes
if phase[0] == 'P':
quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsP'])
elif phase[0] == 'S':
quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsS'])
colors = phase_col[phase[0].upper()]
mpp = picks['mpp'] - stime
@ -1994,6 +2000,7 @@ class MainWindow(QMainWindow):
else:
pw.plot([mpp, mpp], ylims, pen=colors[0], name='{}-Pick (NO PICKERROR)'.format(phase))
elif picktype == 'auto':
if quality < 4:
pw.plot([mpp, mpp], ylims, pen=colors[3])
else:
raise TypeError('Unknown picktype {0}'.format(picktype))
@ -2009,6 +2016,7 @@ class MainWindow(QMainWindow):
else:
ax.plot([mpp, mpp], ylims, colors[6], label='{}-Pick (NO PICKERROR)'.format(phase))
elif picktype == 'auto':
if quality < 4:
ax.plot(mpp, ylims[1], colors[3],
mpp, ylims[0], colors[4])
ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dotted')

View File

@ -192,6 +192,14 @@ class LocalMagnitude(Magnitude):
def peak_to_peak(self, st, t0):
try:
iplot = int(self.plot_flag)
except:
if self.plot_flag == True or self.plot_flag == 'True':
iplot = 2
else:
iplot = 0
# simulate Wood-Anderson response
st.simulate(paz_remove=None, paz_simulate=self._paz)
@ -224,7 +232,7 @@ class LocalMagnitude(Magnitude):
# check for plot flag (for debugging only)
fig = None
if self.plot_flag > 1:
if iplot > 1:
st.plot()
fig = plt.figure()
ax = fig.add_subplot(111)
@ -455,6 +463,14 @@ def calcsourcespec(wfstream, onset, vp, delta, azimuth, incidence,
if verbosity:
print("Calculating source spectrum for station %s ...." % wfstream[0].stats.station)
try:
iplot = int(iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
# get Q value
Q, A = qp
@ -651,6 +667,14 @@ def fitSourceModel(f, S, fc0, iplot, verbosity=False):
:type: float
'''
try:
iplot = int(iplot)
except:
if iplot == True or iplot == 'True':
iplot = 2
else:
iplot = 0
w0 = []
stdw0 = []
fc = []

View File

@ -205,6 +205,8 @@ def picksdict_from_picks(evt):
station = pick.waveform_id.station_code
channel = pick.waveform_id.channel_code
network = pick.waveform_id.network_code
mpp = pick.time
spe = pick.time_errors.uncertainty
try:
picker = str(pick.method_id)
if picker.startswith('smi:local/'):
@ -216,8 +218,6 @@ def picksdict_from_picks(evt):
except KeyError as e:
# print(e)
onsets = {}
mpp = pick.time
spe = pick.time_errors.uncertainty
try:
lpp = mpp + pick.time_errors.upper_uncertainty
epp = mpp - pick.time_errors.lower_uncertainty

View File

@ -1073,6 +1073,31 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None):
ax.set_xlabel('Time [s] since %s' % zdat[0].stats.starttime)
return returnflag
def getQualityfromUncertainty(uncertainty, Errors):
'''Script to transform uncertainty into quality classes 0-4
regarding adjusted time errors Errors.
'''
if uncertainty == None or uncertainty == 'None':
quality = 4
else:
if uncertainty <= Errors[0]:
quality = 0
elif (uncertainty > Errors[0]) and \
(uncertainty < Errors[1]):
quality = 1
elif (uncertainty > Errors[1]) and \
(uncertainty < Errors[2]):
quality = 2
elif (uncertainty > Errors[2]) and \
(uncertainty < Errors[3]):
quality = 3
elif uncertainty > Errors[3]:
quality = 4
else:
pass
return quality
if __name__ == '__main__':
import doctest