[merge] merged changes in QtPyLoT manually
This commit is contained in:
commit
7f0ab4dd94
532
QtPyLoT.py
532
QtPyLoT.py
File diff suppressed because it is too large
Load Diff
24
autoPyLoT.py
24
autoPyLoT.py
@ -369,18 +369,18 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
|||||||
# HYPOSAT
|
# HYPOSAT
|
||||||
hyposatfile = '%s/PyLoT_%s_HYPOSAT_phases' % (event, evID)
|
hyposatfile = '%s/PyLoT_%s_HYPOSAT_phases' % (event, evID)
|
||||||
hyposat.export(picks, hyposatfile, parameter)
|
hyposat.export(picks, hyposatfile, parameter)
|
||||||
# VELEST
|
# VELEST
|
||||||
velestfile = '%s/PyLoT_%s_VELEST_phases.cnv' % (event, evID)
|
velestfile = '%s/PyLoT_%s_VELEST_phases.cnv' % (event, evID)
|
||||||
velest.export(picks, velestfile, parameter, evt)
|
velest.export(picks, velestfile, parameter, evt)
|
||||||
# hypoDD
|
# hypoDD
|
||||||
hypoddfile = '%s/PyLoT_%s_hypoDD_phases.pha' % (event, evID)
|
hypoddfile = '%s/PyLoT_%s_hypoDD_phases.pha' % (event, evID)
|
||||||
hypodd.export(picks, hypoddfile, parameter, evt)
|
hypodd.export(picks, hypoddfile, parameter, evt)
|
||||||
# FOCMEC
|
# FOCMEC
|
||||||
focmecfile = '%s/PyLoT_%s_FOCMEC.in' % (event, evID)
|
focmecfile = '%s/PyLoT_%s_FOCMEC.in' % (event, evID)
|
||||||
focmec.export(picks, focmecfile, parameter, evt)
|
focmec.export(picks, focmecfile, parameter, evt)
|
||||||
# HASH
|
# HASH
|
||||||
hashfile = '%s/PyLoT_%s_HASH' % (event, evID)
|
hashfile = '%s/PyLoT_%s_HASH' % (event, evID)
|
||||||
hash.export(picks, hashfile, parameter, evt)
|
hash.export(picks, hashfile, parameter, evt)
|
||||||
|
|
||||||
endsplash = '''------------------------------------------\n'
|
endsplash = '''------------------------------------------\n'
|
||||||
-----Finished event %s!-----\n'
|
-----Finished event %s!-----\n'
|
||||||
|
196194
icons_rc.py → icons_rc_2.py
196194
icons_rc.py → icons_rc_2.py
File diff suppressed because it is too large
Load Diff
98097
icons_rc_3.py
Normal file
98097
icons_rc_3.py
Normal file
File diff suppressed because it is too large
Load Diff
1
pylot/RELEASE-VERSION
Normal file
1
pylot/RELEASE-VERSION
Normal file
@ -0,0 +1 @@
|
|||||||
|
b286-dirty
|
@ -39,7 +39,7 @@ class Data(object):
|
|||||||
elif isinstance(evtdata, dict):
|
elif isinstance(evtdata, dict):
|
||||||
evt = readPILOTEvent(**evtdata)
|
evt = readPILOTEvent(**evtdata)
|
||||||
evtdata = evt
|
evtdata = evt
|
||||||
elif isinstance(evtdata, basestring):
|
elif isinstance(evtdata, str):
|
||||||
try:
|
try:
|
||||||
cat = read_events(evtdata)
|
cat = read_events(evtdata)
|
||||||
if len(cat) is not 1:
|
if len(cat) is not 1:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from pylot.core.util.errors import ParameterError
|
from pylot.core.util.errors import ParameterError
|
||||||
import default_parameters
|
from pylot.core.io import default_parameters
|
||||||
|
|
||||||
class PylotParameter(object):
|
class PylotParameter(object):
|
||||||
'''
|
'''
|
||||||
|
@ -253,8 +253,8 @@ def picks_from_picksdict(picks, creation_info=None):
|
|||||||
lpp = phase['lpp']
|
lpp = phase['lpp']
|
||||||
pick.time_errors.lower_uncertainty = onset - epp
|
pick.time_errors.lower_uncertainty = onset - epp
|
||||||
pick.time_errors.upper_uncertainty = lpp - onset
|
pick.time_errors.upper_uncertainty = lpp - onset
|
||||||
except KeyError as e:
|
except (KeyError, TypeError) as e:
|
||||||
warnings.warn(e.message, RuntimeWarning)
|
warnings.warn(str(e), RuntimeWarning)
|
||||||
try:
|
try:
|
||||||
picker = phase['picker']
|
picker = phase['picker']
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
@ -274,7 +274,7 @@ def picks_from_picksdict(picks, creation_info=None):
|
|||||||
else:
|
else:
|
||||||
pick.polarity = 'undecidable'
|
pick.polarity = 'undecidable'
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
if 'fm' in e.message: # no polarity information found for this phase
|
if 'fm' in str(e): # no polarity information found for this phase
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
@ -360,7 +360,7 @@ def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None
|
|||||||
default.get('nfac{0}'.format(phase)),
|
default.get('nfac{0}'.format(phase)),
|
||||||
default.get('tsnrz' if phase == 'P' else 'tsnrh'),
|
default.get('tsnrz' if phase == 'P' else 'tsnrh'),
|
||||||
Pick1=rel_pick,
|
Pick1=rel_pick,
|
||||||
iplot=None,
|
iplot=0,
|
||||||
verbosity=0)
|
verbosity=0)
|
||||||
if epp is None or lpp is None:
|
if epp is None or lpp is None:
|
||||||
continue
|
continue
|
||||||
|
@ -307,7 +307,7 @@ class HOScf(CharacteristicFunction):
|
|||||||
class ARZcf(CharacteristicFunction):
|
class ARZcf(CharacteristicFunction):
|
||||||
def calcCF(self, data):
|
def calcCF(self, data):
|
||||||
|
|
||||||
print 'Calculating AR-prediction error from single trace ...'
|
print('Calculating AR-prediction error from single trace ...')
|
||||||
x = self.getDataArray(self.getCut())
|
x = self.getDataArray(self.getCut())
|
||||||
xnp = x[0].data
|
xnp = x[0].data
|
||||||
nn = np.isnan(xnp)
|
nn = np.isnan(xnp)
|
||||||
@ -430,7 +430,7 @@ class ARZcf(CharacteristicFunction):
|
|||||||
class ARHcf(CharacteristicFunction):
|
class ARHcf(CharacteristicFunction):
|
||||||
def calcCF(self, data):
|
def calcCF(self, data):
|
||||||
|
|
||||||
print 'Calculating AR-prediction error from both horizontal traces ...'
|
print('Calculating AR-prediction error from both horizontal traces ...')
|
||||||
|
|
||||||
xnp = self.getDataArray(self.getCut())
|
xnp = self.getDataArray(self.getCut())
|
||||||
n0 = np.isnan(xnp[0].data)
|
n0 = np.isnan(xnp[0].data)
|
||||||
@ -567,7 +567,7 @@ class ARHcf(CharacteristicFunction):
|
|||||||
class AR3Ccf(CharacteristicFunction):
|
class AR3Ccf(CharacteristicFunction):
|
||||||
def calcCF(self, data):
|
def calcCF(self, data):
|
||||||
|
|
||||||
print 'Calculating AR-prediction error from all 3 components ...'
|
print('Calculating AR-prediction error from all 3 components ...')
|
||||||
|
|
||||||
xnp = self.getDataArray(self.getCut())
|
xnp = self.getDataArray(self.getCut())
|
||||||
n0 = np.isnan(xnp[0].data)
|
n0 = np.isnan(xnp[0].data)
|
||||||
|
@ -480,7 +480,7 @@ def main():
|
|||||||
Insheim = PDFstatistics(root_dir)
|
Insheim = PDFstatistics(root_dir)
|
||||||
Insheim.curphase = 'p'
|
Insheim.curphase = 'p'
|
||||||
qdlist = Insheim.get('qdf', 0.2)
|
qdlist = Insheim.get('qdf', 0.2)
|
||||||
print qdlist
|
print(qdlist)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -34,7 +34,7 @@ class AutoPicker(object):
|
|||||||
|
|
||||||
warnings.simplefilter('ignore')
|
warnings.simplefilter('ignore')
|
||||||
|
|
||||||
def __init__(self, cf, TSNR, PickWindow, iplot=None, aus=None, Tsmooth=None, Pick1=None, fig=None):
|
def __init__(self, cf, TSNR, PickWindow, iplot=0, aus=None, Tsmooth=None, Pick1=None, fig=None):
|
||||||
'''
|
'''
|
||||||
:param: cf, characteristic function, on which the picking algorithm is applied
|
:param: cf, characteristic function, on which the picking algorithm is applied
|
||||||
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
|
:type: `~pylot.core.pick.CharFuns.CharacteristicFunction` object
|
||||||
|
@ -14,7 +14,7 @@ import numpy as np
|
|||||||
from obspy.core import Stream, UTCDateTime
|
from obspy.core import Stream, UTCDateTime
|
||||||
|
|
||||||
|
|
||||||
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, verbosity=1, fig=None):
|
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, verbosity=1, fig=None):
|
||||||
'''
|
'''
|
||||||
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
|
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
|
||||||
as reasonable uncertainties. Latest possible pick is based on noise level,
|
as reasonable uncertainties. Latest possible pick is based on noise level,
|
||||||
@ -144,7 +144,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, verbosity=1, fig=None):
|
|||||||
return EPick, LPick, PickError
|
return EPick, LPick, PickError
|
||||||
|
|
||||||
|
|
||||||
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None, fig=None):
|
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
|
||||||
'''
|
'''
|
||||||
Function to derive first motion (polarity) of given phase onset Pick.
|
Function to derive first motion (polarity) of given phase onset Pick.
|
||||||
Calculation is based on zero crossings determined within time window pickwin
|
Calculation is based on zero crossings determined within time window pickwin
|
||||||
@ -357,7 +357,7 @@ def getSNR(X, TSNR, t1, tracenum=0):
|
|||||||
assert isinstance(X, Stream), "%s is not a stream object" % str(X)
|
assert isinstance(X, Stream), "%s is not a stream object" % str(X)
|
||||||
|
|
||||||
SNR = None
|
SNR = None
|
||||||
SNRdb = None
|
SNRdB = None
|
||||||
noiselevel = None
|
noiselevel = None
|
||||||
|
|
||||||
x = X[tracenum].data
|
x = X[tracenum].data
|
||||||
@ -480,14 +480,15 @@ def getResolutionWindow(snr, extent):
|
|||||||
'global': {'HRW': 40., 'MRW': 100., 'LRW': 200., 'VLRW': 300.}
|
'global': {'HRW': 40., 'MRW': 100., 'LRW': 200., 'VLRW': 300.}
|
||||||
}
|
}
|
||||||
|
|
||||||
if snr < 1.5:
|
if snr:
|
||||||
time_resolution = res_wins[extent]['VLRW']
|
if snr < 1.5:
|
||||||
elif snr < 2.:
|
time_resolution = res_wins[extent]['VLRW']
|
||||||
time_resolution = res_wins[extent]['LRW']
|
elif snr < 2.:
|
||||||
elif snr < 3.:
|
time_resolution = res_wins[extent]['LRW']
|
||||||
time_resolution = res_wins[extent]['MRW']
|
elif snr < 3.:
|
||||||
elif snr >3.:
|
time_resolution = res_wins[extent]['MRW']
|
||||||
time_resolution = res_wins[extent]['HRW']
|
elif snr >3.:
|
||||||
|
time_resolution = res_wins[extent]['HRW']
|
||||||
else:
|
else:
|
||||||
time_resolution = res_wins[extent]['VLRW']
|
time_resolution = res_wins[extent]['VLRW']
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ from obspy.core import Stream, UTCDateTime
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode = False):
|
def earllatepicker(X, nfac, TSNR, Pick1, iplot=0, stealthMode = False):
|
||||||
'''
|
'''
|
||||||
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
|
Function to derive earliest and latest possible pick after Diehl & Kissling (2009)
|
||||||
as reasonable uncertainties. Latest possible pick is based on noise level,
|
as reasonable uncertainties. Latest possible pick is based on noise level,
|
||||||
@ -136,7 +136,7 @@ def earllatepicker(X, nfac, TSNR, Pick1, iplot=None, stealthMode = False):
|
|||||||
return EPick, LPick, PickError
|
return EPick, LPick, PickError
|
||||||
|
|
||||||
|
|
||||||
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=None):
|
def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0):
|
||||||
'''
|
'''
|
||||||
Function to derive first motion (polarity) of given phase onset Pick.
|
Function to derive first motion (polarity) of given phase onset Pick.
|
||||||
Calculation is based on zero crossings determined within time window pickwin
|
Calculation is based on zero crossings determined within time window pickwin
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import urllib2
|
try:
|
||||||
|
from urllib2 import urlopen
|
||||||
|
except:
|
||||||
|
from urllib.request import urlopen
|
||||||
|
|
||||||
|
|
||||||
def checkurl(url='https://ariadne.geophysik.rub.de/trac/PyLoT'):
|
def checkurl(url='https://ariadne.geophysik.rub.de/trac/PyLoT'):
|
||||||
try:
|
try:
|
||||||
urllib2.urlopen(url, timeout=1)
|
urlopen(url, timeout=1)
|
||||||
return True
|
return True
|
||||||
except urllib2.URLError:
|
except:
|
||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import sys
|
import sys
|
||||||
from obspy.io.xseed import Parser
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@ -170,7 +169,7 @@ def read_metadata(path_to_inventory):
|
|||||||
invfile = list()
|
invfile = list()
|
||||||
respfile = list()
|
respfile = list()
|
||||||
# possible file extensions specified here:
|
# possible file extensions specified here:
|
||||||
inv = dict(dless=dlfile, xml=invfile, resp=respfile, dseed=dlfile)
|
inv = dict(dless=dlfile, xml=invfile, resp=respfile, dseed=dlfile[:])
|
||||||
if os.path.isfile(path_to_inventory):
|
if os.path.isfile(path_to_inventory):
|
||||||
ext = os.path.splitext(path_to_inventory)[1].split('.')[1]
|
ext = os.path.splitext(path_to_inventory)[1].split('.')[1]
|
||||||
inv[ext] += [path_to_inventory]
|
inv[ext] += [path_to_inventory]
|
||||||
|
@ -19,6 +19,7 @@ class map_projection(QtGui.QWidget):
|
|||||||
'''
|
'''
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self)
|
||||||
self._parent = parent
|
self._parent = parent
|
||||||
|
self.metadata = parent.metadata
|
||||||
self.parser = parent.metadata[1]
|
self.parser = parent.metadata[1]
|
||||||
self.picks = None
|
self.picks = None
|
||||||
self.picks_dict = None
|
self.picks_dict = None
|
||||||
|
@ -59,7 +59,7 @@ def exp_parameter(te, tm, tl, eta):
|
|||||||
return tm, sig1, sig2, a
|
return tm, sig1, sig2, a
|
||||||
|
|
||||||
|
|
||||||
def gauss_branches(k, (mu, sig1, sig2, a1, a2)):
|
def gauss_branches(k, param_tuple):
|
||||||
'''
|
'''
|
||||||
function gauss_branches takes an axes x, a center value mu, two sigma
|
function gauss_branches takes an axes x, a center value mu, two sigma
|
||||||
values sig1 and sig2 and two scaling factors a1 and a2 and return a
|
values sig1 and sig2 and two scaling factors a1 and a2 and return a
|
||||||
@ -79,6 +79,9 @@ def gauss_branches(k, (mu, sig1, sig2, a1, a2)):
|
|||||||
:returns fun_vals: list with function values along axes x
|
:returns fun_vals: list with function values along axes x
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
#python 3 workaround
|
||||||
|
mu, sig1, sig2, a1, a2 = param_tuple
|
||||||
|
|
||||||
def _func(k, mu, sig1, sig2, a1, a2):
|
def _func(k, mu, sig1, sig2, a1, a2):
|
||||||
if k < mu:
|
if k < mu:
|
||||||
rval = a1 * 1 / (np.sqrt(2 * np.pi) * sig1) * np.exp(-((k - mu) / sig1) ** 2 / 2)
|
rval = a1 * 1 / (np.sqrt(2 * np.pi) * sig1) * np.exp(-((k - mu) / sig1) ** 2 / 2)
|
||||||
@ -93,7 +96,7 @@ def gauss_branches(k, (mu, sig1, sig2, a1, a2)):
|
|||||||
return _func(k, mu, sig1, sig2, a1, a2)
|
return _func(k, mu, sig1, sig2, a1, a2)
|
||||||
|
|
||||||
|
|
||||||
def exp_branches(k, (mu, sig1, sig2, a)):
|
def exp_branches(k, param_tuple):
|
||||||
'''
|
'''
|
||||||
function exp_branches takes an axes x, a center value mu, two sigma
|
function exp_branches takes an axes x, a center value mu, two sigma
|
||||||
values sig1 and sig2 and a scaling factor a and return a
|
values sig1 and sig2 and a scaling factor a and return a
|
||||||
@ -107,6 +110,9 @@ def exp_branches(k, (mu, sig1, sig2, a)):
|
|||||||
:returns fun_vals: list with function values along axes x:
|
:returns fun_vals: list with function values along axes x:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
#python 3 workaround
|
||||||
|
mu, sig1, sig2, a = param_tuple
|
||||||
|
|
||||||
def _func(k, mu, sig1, sig2, a):
|
def _func(k, mu, sig1, sig2, a):
|
||||||
mu = float(mu)
|
mu = float(mu)
|
||||||
if k < mu:
|
if k < mu:
|
||||||
|
@ -5,7 +5,7 @@ import hashlib
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.interpolate import splrep, splev
|
from scipy.interpolate import splrep, splev
|
||||||
import os
|
import os
|
||||||
import pwd
|
import platform
|
||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -258,7 +258,7 @@ def getLogin():
|
|||||||
returns the actual user's login ID
|
returns the actual user's login ID
|
||||||
:return: login ID
|
:return: login ID
|
||||||
'''
|
'''
|
||||||
return pwd.getpwuid(os.getuid())[0]
|
return os.getlogin()
|
||||||
|
|
||||||
|
|
||||||
def getOwner(fn):
|
def getOwner(fn):
|
||||||
@ -268,7 +268,15 @@ def getOwner(fn):
|
|||||||
:type fn: str
|
:type fn: str
|
||||||
:return: login ID of the file's owner
|
:return: login ID of the file's owner
|
||||||
'''
|
'''
|
||||||
return pwd.getpwuid(os.stat(fn).st_uid).pw_name
|
system_name = platform.system()
|
||||||
|
if system_name in ["Linux", "Darwin"]:
|
||||||
|
import pwd
|
||||||
|
return pwd.getpwuid(os.stat(fn).st_uid).pw_name
|
||||||
|
elif system_name == "Windows":
|
||||||
|
import win32security
|
||||||
|
f = win32security.GetFileSecurity(fn, win32security.OWNER_SECURITY_INFORMATION)
|
||||||
|
(username, domain, sid_name_use) = win32security.LookupAccountSid(None, f.GetSecurityDescriptorOwner())
|
||||||
|
return username
|
||||||
|
|
||||||
|
|
||||||
def getPatternLine(fn, pattern):
|
def getPatternLine(fn, pattern):
|
||||||
|
@ -6,6 +6,7 @@ Created on Wed Mar 19 11:27:35 2014
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import getpass
|
import getpass
|
||||||
import warnings
|
import warnings
|
||||||
import copy
|
import copy
|
||||||
@ -47,7 +48,12 @@ from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \
|
|||||||
demeanTrace, isSorted, findComboBoxIndex, clims
|
demeanTrace, isSorted, findComboBoxIndex, clims
|
||||||
from autoPyLoT import autoPyLoT
|
from autoPyLoT import autoPyLoT
|
||||||
from pylot.core.util.thread import Thread
|
from pylot.core.util.thread import Thread
|
||||||
import icons_rc
|
if sys.version_info.major == 3:
|
||||||
|
import icons_rc_3 as icons_rc
|
||||||
|
elif sys.version_info.major == 2:
|
||||||
|
import icons_rc_2 as icons_rc
|
||||||
|
else:
|
||||||
|
raise ImportError('Could not determine python version.')
|
||||||
|
|
||||||
if pg:
|
if pg:
|
||||||
pg.setConfigOption('background', 'w')
|
pg.setConfigOption('background', 'w')
|
||||||
@ -70,9 +76,9 @@ def plot_pdf(_axes, x, y, annotation, bbox_props, xlabel=None, ylabel=None,
|
|||||||
title=None):
|
title=None):
|
||||||
# try method or data
|
# try method or data
|
||||||
try:
|
try:
|
||||||
_axes.plot(x, y()) # y provided as method
|
_axes.plot(x, y()) # y provided as method
|
||||||
except:
|
except:
|
||||||
_axes.plot(x, y) # y provided as data
|
_axes.plot(x, y) # y provided as data
|
||||||
|
|
||||||
if title:
|
if title:
|
||||||
_axes.set_title(title)
|
_axes.set_title(title)
|
||||||
@ -462,7 +468,7 @@ class WaveformWidgetPG(QtGui.QWidget):
|
|||||||
|
|
||||||
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
|
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
|
||||||
noiselevel=None, scaleddata=False, mapping=True,
|
noiselevel=None, scaleddata=False, mapping=True,
|
||||||
component='*', nth_sample=1, iniPick=None):
|
component='*', nth_sample=1, iniPick=None, verbosity=0):
|
||||||
self.title = title
|
self.title = title
|
||||||
self.clearPlotDict()
|
self.clearPlotDict()
|
||||||
wfstart, wfend = full_range(wfdata)
|
wfstart, wfend = full_range(wfdata)
|
||||||
@ -509,11 +515,12 @@ class WaveformWidgetPG(QtGui.QWidget):
|
|||||||
if n > nmax:
|
if n > nmax:
|
||||||
nmax = n
|
nmax = n
|
||||||
msg = 'plotting %s channel of station %s' % (channel, station)
|
msg = 'plotting %s channel of station %s' % (channel, station)
|
||||||
print(msg)
|
if verbosity:
|
||||||
|
print(msg)
|
||||||
stime = trace.stats.starttime - wfstart
|
stime = trace.stats.starttime - wfstart
|
||||||
time_ax = prepTimeAxis(stime, trace)
|
time_ax = prepTimeAxis(stime, trace)
|
||||||
if time_ax is not None:
|
if time_ax is not None:
|
||||||
if not scaleddata:
|
if not scaleddata:
|
||||||
trace.detrend('constant')
|
trace.detrend('constant')
|
||||||
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
||||||
times = [time for index, time in enumerate(time_ax) if not index%nth_sample]
|
times = [time for index, time in enumerate(time_ax) if not index%nth_sample]
|
||||||
@ -653,7 +660,7 @@ class WaveformWidget(FigureCanvas):
|
|||||||
stime = trace.stats.starttime - wfstart
|
stime = trace.stats.starttime - wfstart
|
||||||
time_ax = prepTimeAxis(stime, trace)
|
time_ax = prepTimeAxis(stime, trace)
|
||||||
if time_ax is not None:
|
if time_ax is not None:
|
||||||
if not scaleddata:
|
if not scaleddata:
|
||||||
trace.detrend('constant')
|
trace.detrend('constant')
|
||||||
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
trace.normalize(np.max(np.abs(trace.data)) * 2)
|
||||||
times = [time for index, time in enumerate(time_ax) if not index%nth_sample]
|
times = [time for index, time in enumerate(time_ax) if not index%nth_sample]
|
||||||
@ -696,7 +703,7 @@ class WaveformWidget(FigureCanvas):
|
|||||||
self.getAxes().set_ylim(lims)
|
self.getAxes().set_ylim(lims)
|
||||||
|
|
||||||
def setYTickLabels(self, pos, labels):
|
def setYTickLabels(self, pos, labels):
|
||||||
self.getAxes().set_yticks(pos)
|
self.getAxes().set_yticks(list(pos))
|
||||||
self.getAxes().set_yticklabels(labels)
|
self.getAxes().set_yticklabels(labels)
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
@ -822,7 +829,7 @@ class PickDlg(QDialog):
|
|||||||
self.drawArrivals()
|
self.drawArrivals()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Warning: Could not init expected picks from taup: {}'.format(e))
|
print('Warning: Could not init expected picks from taup: {}'.format(e))
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
menuBar = QtGui.QMenuBar(self)
|
menuBar = QtGui.QMenuBar(self)
|
||||||
if not self._embedded:
|
if not self._embedded:
|
||||||
@ -865,7 +872,7 @@ class PickDlg(QDialog):
|
|||||||
tip='Delete current picks.')
|
tip='Delete current picks.')
|
||||||
|
|
||||||
# create other widget elements
|
# create other widget elements
|
||||||
phaseitems = [None] + FILTERDEFAULTS.keys()
|
phaseitems = [None] + list(FILTERDEFAULTS.keys())
|
||||||
|
|
||||||
# create buttons for P and S filter and picking
|
# create buttons for P and S filter and picking
|
||||||
self.p_button = QPushButton('P', self)
|
self.p_button = QPushButton('P', self)
|
||||||
@ -945,7 +952,11 @@ class PickDlg(QDialog):
|
|||||||
station_id = self.data.traces[0].get_id()
|
station_id = self.data.traces[0].get_id()
|
||||||
parser = self.parent().metadata[1]
|
parser = self.parent().metadata[1]
|
||||||
station_coords = parser.get_coordinates(station_id)
|
station_coords = parser.get_coordinates(station_id)
|
||||||
source_origin = self.parent().get_current_event().origins[0]
|
origins = self.parent().get_current_event().origins
|
||||||
|
if origins:
|
||||||
|
source_origin = origins[0]
|
||||||
|
else:
|
||||||
|
raise ValueError('No source origin given.')
|
||||||
arrivals = self.model.get_travel_times_geo(source_origin.depth,
|
arrivals = self.model.get_travel_times_geo(source_origin.depth,
|
||||||
source_origin.latitude,
|
source_origin.latitude,
|
||||||
source_origin.longitude,
|
source_origin.longitude,
|
||||||
@ -1348,8 +1359,13 @@ class PickDlg(QDialog):
|
|||||||
phase = self.currentPhase
|
phase = self.currentPhase
|
||||||
filteroptions = self.getFilterOptions(phase[0]).parseFilterOptions()
|
filteroptions = self.getFilterOptions(phase[0]).parseFilterOptions()
|
||||||
if filteroptions:
|
if filteroptions:
|
||||||
data.filter(**filteroptions)
|
try:
|
||||||
wfdata.filter(**filteroptions)
|
data.filter(**filteroptions)
|
||||||
|
wfdata.filter(**filteroptions)
|
||||||
|
except ValueError as e:
|
||||||
|
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
||||||
|
'Denied', 'setIniPickP: Could not filter waveform: {}'.format(e))
|
||||||
|
self.qmb.show()
|
||||||
|
|
||||||
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick-stime_diff, itrace)
|
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick-stime_diff, itrace)
|
||||||
|
|
||||||
@ -1401,8 +1417,13 @@ class PickDlg(QDialog):
|
|||||||
phase = self.currentPhase
|
phase = self.currentPhase
|
||||||
filteroptions = self.getFilterOptions(phase).parseFilterOptions()
|
filteroptions = self.getFilterOptions(phase).parseFilterOptions()
|
||||||
if filteroptions:
|
if filteroptions:
|
||||||
data.filter(**filteroptions)
|
try:
|
||||||
wfdata.filter(**filteroptions)
|
data.filter(**filteroptions)
|
||||||
|
wfdata.filter(**filteroptions)
|
||||||
|
except ValueError as e:
|
||||||
|
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
||||||
|
'Denied', 'setIniPickS: Could not filter waveform: {}'.format(e))
|
||||||
|
self.qmb.show()
|
||||||
|
|
||||||
# determine SNR and noiselevel
|
# determine SNR and noiselevel
|
||||||
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick-stime_diff)
|
result = getSNR(wfdata, (noise_win, gap_win, signal_win), ini_pick-stime_diff)
|
||||||
@ -1463,7 +1484,14 @@ class PickDlg(QDialog):
|
|||||||
# copy and filter data for earliest and latest possible picks
|
# copy and filter data for earliest and latest possible picks
|
||||||
wfdata = self.getWFData().copy().select(channel=channel)
|
wfdata = self.getWFData().copy().select(channel=channel)
|
||||||
if filteroptions:
|
if filteroptions:
|
||||||
wfdata.filter(**filteroptions)
|
try:
|
||||||
|
wfdata.filter(**filteroptions)
|
||||||
|
except ValueError as e:
|
||||||
|
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Information,
|
||||||
|
'Denied', 'setPick: Could not filter waveform: {}'.format(e))
|
||||||
|
self.qmb.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# get earliest and latest possible pick and symmetric pick error
|
# get earliest and latest possible pick and symmetric pick error
|
||||||
if wfdata[0].stats.channel[2] == 'Z' or wfdata[0].stats.channel[2] == '3':
|
if wfdata[0].stats.channel[2] == 'Z' or wfdata[0].stats.channel[2] == '3':
|
||||||
@ -2736,7 +2764,7 @@ class InputsTab(PropTab):
|
|||||||
|
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
|
|
||||||
self.structureSelect.addItems(DATASTRUCTURE.keys())
|
self.structureSelect.addItems(list(DATASTRUCTURE.keys()))
|
||||||
|
|
||||||
dsind = findComboBoxIndex(self.structureSelect, curstructure)
|
dsind = findComboBoxIndex(self.structureSelect, curstructure)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user