Compare commits
9 Commits
f8f4e6789c
...
49c747b638
Author | SHA1 | Date | |
---|---|---|---|
49c747b638 | |||
08c2d7556f | |||
7d77cb0b2f | |||
6f70b2c0e2 | |||
8f1ab87045 | |||
5351043493 | |||
dccbaa357a | |||
37c8858096 | |||
f93499da7d |
53
PyLoT.py
53
PyLoT.py
@ -173,7 +173,7 @@ class MainWindow(QMainWindow):
|
||||
self.deleted_picks = {}
|
||||
|
||||
# headers for event table
|
||||
self.table_headers = ['', 'Event', 'Time', 'Lat', 'Lon', 'Depth', 'Mag', '[N] MP', '[N] AP', 'Tuning Set',
|
||||
self.table_headers = ['', 'Event', 'Time', 'Lat', 'Lon', 'Depth', 'Ml', 'Mw', '[N] MP', '[N] AP', 'Tuning Set',
|
||||
'Test Set', 'Notes']
|
||||
|
||||
while True:
|
||||
@ -1380,9 +1380,11 @@ class MainWindow(QMainWindow):
|
||||
lat = origin.latitude
|
||||
lon = origin.longitude
|
||||
depth = origin.depth
|
||||
if len(event.magnitudes) == 1:
|
||||
magnitude = event.magnitudes[0]
|
||||
mag = magnitude.mag
|
||||
if len(event.magnitudes) >= 1:
|
||||
moment_magnitude = event.magnitudes[0]
|
||||
local_magnitude = event.magnitudes[1]
|
||||
localmag = '%4.1f' % local_magnitude.mag
|
||||
momentmag = '%4.1f'% moment_magnitude.mag
|
||||
|
||||
# text = '{path:{plen}} | manual: [{p:3d}] | auto: [{a:3d}]'
|
||||
# text = text.format(path=event_path,
|
||||
@ -1398,7 +1400,8 @@ class MainWindow(QMainWindow):
|
||||
item_lat = QtGui.QStandardItem('{}'.format(lat))
|
||||
item_lon = QtGui.QStandardItem('{}'.format(lon))
|
||||
item_depth = QtGui.QStandardItem('{}'.format(depth))
|
||||
item_mag = QtGui.QStandardItem('{}'.format(mag))
|
||||
item_localmag = QtGui.QStandardItem('{}'.format(localmag))
|
||||
item_momentmag = QtGui.QStandardItem('{}'.format(momentmag))
|
||||
item_nmp = QtGui.QStandardItem('{}({})'.format(ma_count['manual'], ma_count_total['manual']))
|
||||
item_nmp.setIcon(self.manupicksicon_small)
|
||||
item_nap = QtGui.QStandardItem('{}({})'.format(ma_count['auto'], ma_count_total['auto']))
|
||||
@ -1425,7 +1428,7 @@ class MainWindow(QMainWindow):
|
||||
# item2.setForeground(QtGui.QColor('black'))
|
||||
# item2.setFont(font)
|
||||
itemlist = [item_path, item_time, item_lat, item_lon, item_depth,
|
||||
item_mag, item_nmp, item_nap, item_ref, item_test, item_notes]
|
||||
item_localmag, item_momentmag, item_nmp, item_nap, item_ref, item_test, item_notes]
|
||||
for item in itemlist:
|
||||
item.setTextAlignment(Qt.AlignCenter)
|
||||
if event_test and select_events == 'ref' or self.isEmpty(event_path):
|
||||
@ -2468,8 +2471,10 @@ class MainWindow(QMainWindow):
|
||||
def pickDialog(self, wfID, seed_id=None):
|
||||
if not seed_id:
|
||||
seed_id = self.getTraceID(wfID)
|
||||
network, station, location = seed_id.split('.')[:3]
|
||||
if not station or not network:
|
||||
try:
|
||||
network, station, location = seed_id.split('.')[:3]
|
||||
except:
|
||||
print("Warning! No network, station, and location info available!")
|
||||
return
|
||||
self.update_status('picking on station {0}'.format(station))
|
||||
data = self.get_data().getOriginalWFData().copy()
|
||||
@ -3234,7 +3239,8 @@ class MainWindow(QMainWindow):
|
||||
item_lat = QtGui.QTableWidgetItem()
|
||||
item_lon = QtGui.QTableWidgetItem()
|
||||
item_depth = QtGui.QTableWidgetItem()
|
||||
item_mag = QtGui.QTableWidgetItem()
|
||||
item_momentmag = QtGui.QTableWidgetItem()
|
||||
item_localmag = QtGui.QTableWidgetItem()
|
||||
item_nmp = QtGui.QTableWidgetItem('{}({})'.format(ma_count['manual'], ma_count_total['manual']))
|
||||
item_nmp.setIcon(self.manupicksicon_small)
|
||||
item_nap = QtGui.QTableWidgetItem('{}({})'.format(ma_count['auto'], ma_count_total['auto']))
|
||||
@ -3257,8 +3263,12 @@ class MainWindow(QMainWindow):
|
||||
item_depth.setText(str(origin.depth))
|
||||
if hasattr(event, 'magnitudes'):
|
||||
if event.magnitudes:
|
||||
magnitude = event.magnitudes[0]
|
||||
item_mag.setText(str(magnitude.mag))
|
||||
moment_magnitude = event.magnitudes[0]
|
||||
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
|
||||
local_magnitude = event.magnitudes[1]
|
||||
local_magnitude.mag = '%4.1f' % local_magnitude.mag
|
||||
item_momentmag.setText(str(moment_magnitude.mag))
|
||||
item_localmag.setText(str(local_magnitude.mag))
|
||||
item_notes.setText(event.notes)
|
||||
|
||||
set_enabled(item_path, True, False)
|
||||
@ -3281,8 +3291,8 @@ class MainWindow(QMainWindow):
|
||||
else:
|
||||
item_test.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
row = [item_delete, item_path, item_time, item_lat, item_lon, item_depth, item_mag,
|
||||
item_nmp, item_nap, item_ref, item_test, item_notes]
|
||||
row = [item_delete, item_path, item_time, item_lat, item_lon, item_depth, item_localmag,
|
||||
item_momentmag, item_nmp, item_nap, item_ref, item_test, item_notes]
|
||||
self.project._table.append(row)
|
||||
|
||||
self.setItemColor(row, index, event, current_event)
|
||||
@ -3805,13 +3815,16 @@ class Project(object):
|
||||
datapaths.append(event.datapath)
|
||||
for datapath in datapaths:
|
||||
datapath = os.path.join(self.rootpath, datapath)
|
||||
for filename in os.listdir(datapath):
|
||||
filename = os.path.join(datapath, filename)
|
||||
if os.path.isfile(filename) and filename.endswith(fext):
|
||||
try:
|
||||
self.read_eventfile_info(filename)
|
||||
except Exception as e:
|
||||
print('Failed on reading eventfile info from file {}: {}'.format(filename, e))
|
||||
if os.path.isdir(datapath):
|
||||
for filename in os.listdir(datapath):
|
||||
filename = os.path.join(datapath, filename)
|
||||
if os.path.isfile(filename) and filename.endswith(fext):
|
||||
try:
|
||||
self.read_eventfile_info(filename)
|
||||
except Exception as e:
|
||||
print('Failed on reading eventfile info from file {}: {}'.format(filename, e))
|
||||
else:
|
||||
print("Directory %s does not exist!" % datapath)
|
||||
|
||||
def getPaths(self):
|
||||
'''
|
||||
|
@ -522,7 +522,6 @@ def calcsourcespec(wfstream, onset, vp, delta, azimuth, incidence,
|
||||
|
||||
Fc = None
|
||||
w0 = None
|
||||
|
||||
zdat = select_for_phase(wfstream, "P")
|
||||
|
||||
if len(zdat) == 0:
|
||||
@ -537,7 +536,6 @@ def calcsourcespec(wfstream, onset, vp, delta, azimuth, incidence,
|
||||
# trim traces to common range (for rotation)
|
||||
trstart, trend = common_range(wfstream)
|
||||
wfstream.trim(trstart, trend)
|
||||
|
||||
# rotate into LQT (ray-coordindate-) system using Obspy's rotate
|
||||
# L: P-wave direction
|
||||
# Q: SV-wave direction
|
||||
@ -591,7 +589,8 @@ def calcsourcespec(wfstream, onset, vp, delta, azimuth, incidence,
|
||||
#n = freq * l
|
||||
# find next power of 2 of data length
|
||||
m = pow(2, np.ceil(np.log(len(xdat)) / np.log(2)))
|
||||
N = int(np.power(m, 2))
|
||||
N = min(int(np.power(m, 2)), 16384)
|
||||
#N = int(np.power(m, 2))
|
||||
y = dt * np.fft.fft(xdat, N)
|
||||
Y = abs(y[: N / 2])
|
||||
L = (N - 1) / freq
|
||||
|
@ -290,7 +290,16 @@ def picksdict_from_picks(evt):
|
||||
phase['channel'] = channel
|
||||
phase['network'] = network
|
||||
phase['picker'] = picker
|
||||
phase['fm'] = 'N'
|
||||
try:
|
||||
if pick.polarity == 'positive':
|
||||
phase['fm'] = 'U'
|
||||
elif pick.polarity == 'negative':
|
||||
phase['fm'] = 'D'
|
||||
else:
|
||||
phase['fm'] = 'N'
|
||||
except:
|
||||
print("No FM info available!")
|
||||
phase['fm'] = 'N'
|
||||
phase['filter_id'] = filter_id if filter_id is not None else ''
|
||||
|
||||
onsets[pick.phase_hint] = phase.copy()
|
||||
@ -350,19 +359,18 @@ def picks_from_picksdict(picks, creation_info=None):
|
||||
warnings.warn(str(e), RuntimeWarning)
|
||||
filter_id = ''
|
||||
pick.filter_id = filter_id
|
||||
|
||||
try:
|
||||
polarity = phase['fm']
|
||||
if polarity == 'U' or '+':
|
||||
polarity = picks[station][label]['fm']
|
||||
if polarity == 'U' or polarity == '+':
|
||||
pick.polarity = 'positive'
|
||||
elif polarity == 'D' or '-':
|
||||
elif polarity == 'D' or polarity == '-':
|
||||
pick.polarity = 'negative'
|
||||
else:
|
||||
pick.polarity = 'undecidable'
|
||||
except KeyError as e:
|
||||
if 'fm' in str(e): # no polarity information found for this phase
|
||||
pass
|
||||
else:
|
||||
raise e
|
||||
except:
|
||||
pick.polarity = 'undecidable'
|
||||
print("No polarity information available!")
|
||||
picks_list.append(pick)
|
||||
return picks_list
|
||||
|
||||
|
@ -892,7 +892,7 @@ class AutopickStation(object):
|
||||
# weight P-onset using symmetric error
|
||||
self.p_results.weight = get_quality_class(self.p_results.spe, self.pickparams["timeerrorsP"])
|
||||
if self.p_results.weight <= self.pickparams["minfmweight"] and self.p_results.snr >= self.pickparams["minFMSNR"]:
|
||||
# if SNR is low enough, try to determine first motion of onset
|
||||
# if SNR is high enough, try to determine first motion of onset
|
||||
self.set_current_figure('fm_picker')
|
||||
self.p_results.fm = fmpicker(self.zstream, z_copy, self.pickparams["fmpickwin"], self.p_results.mpp,
|
||||
self.iplot, self.current_figure, self.current_linecolor)
|
||||
|
@ -46,6 +46,7 @@ from pylot.core.io.inputs import FilterOptions, PylotParameter
|
||||
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
|
||||
getResolutionWindow, get_quality_class
|
||||
from pylot.core.pick.compare import Comparison
|
||||
from pylot.core.pick.autopick import fmpicker
|
||||
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS
|
||||
from pylot.core.util.utils import prepTimeAxis, full_range, demeanTrace, isSorted, findComboBoxIndex, clims, \
|
||||
pick_linestyle_plt, pick_color_plt, \
|
||||
@ -2564,13 +2565,32 @@ class PickDlg(QDialog):
|
||||
pick - stime_diff, verbosity=1)
|
||||
|
||||
mpp = stime + pick
|
||||
|
||||
if epp:
|
||||
epp = stime + epp + stime_diff
|
||||
if lpp:
|
||||
lpp = stime + lpp + stime_diff
|
||||
|
||||
noise_win, gap_win, signal_win = self.getNoiseWin(phase)
|
||||
snr, snrDB, noiselevel = getSNR(wfdata, (noise_win, gap_win, signal_win), pick - stime_diff)
|
||||
print('SNR of final pick: {}'.format(snr))
|
||||
if snr < 1.5:
|
||||
QMessageBox.warning(self, 'SNR too low', 'WARNING! SNR of final pick below 1.5! SNR = {}'.format(snr))
|
||||
|
||||
# get first motion and quality classes
|
||||
FM = ''
|
||||
if self.getPhaseID(phase) == 'P':
|
||||
# get first motion quality of P onset is sufficeint
|
||||
minFMweight = parameter.get('minfmweight')
|
||||
minFMSNR = parameter.get('minFMSNR')
|
||||
quality = get_quality_class(spe, parameter.get('timeerrorsP'))
|
||||
if quality <= minFMweight and snr >= minFMSNR:
|
||||
FM = fmpicker(self.getWFData().select(channel=channel), wfdata, parameter.get('fmpickwin'),
|
||||
pick -stime_diff)
|
||||
|
||||
|
||||
# save pick times for actual phase
|
||||
phasepicks = dict(epp=epp, lpp=lpp, mpp=mpp, spe=spe,
|
||||
phasepicks = dict(epp=epp, lpp=lpp, mpp=mpp, spe=spe, fm=FM,
|
||||
picker='manual', channel=channel,
|
||||
network=wfdata[0].stats.network,
|
||||
filteroptions=transformFilteroptions2String(filteroptions))
|
||||
@ -2584,11 +2604,7 @@ class PickDlg(QDialog):
|
||||
self.zoomAction.setEnabled(True)
|
||||
# self.pick_block = self.togglPickBlocker()
|
||||
# self.resetZoom()
|
||||
noise_win, gap_win, signal_win = self.getNoiseWin(phase)
|
||||
snr, snrDB, noiselevel = getSNR(wfdata, (noise_win, gap_win, signal_win), pick - stime_diff)
|
||||
print('SNR of final pick: {}'.format(snr))
|
||||
if snr < 1.5:
|
||||
QMessageBox.warning(self, 'SNR too low', 'WARNING! SNR of final pick below 1.5! SNR = {}'.format(snr))
|
||||
|
||||
self.leave_picking_mode()
|
||||
|
||||
def savePick(self, phase, phasepicks):
|
||||
@ -2687,6 +2703,8 @@ class PickDlg(QDialog):
|
||||
ax.plot(mpp, ylims[0], color=color, marker='^', zorder=baseorder + 3)
|
||||
# append phase text (if textOnly: draw with current ylims)
|
||||
self.phaseText.append(ax.text(mpp, ylims[1], phase, color=color, zorder=baseorder + 10))
|
||||
# indicate first motion
|
||||
self.phaseText.append(ax.text(mpp - 0.03 * mpp, ylims[1] - ylims[1] / 12, picks['fm'], color=color, zorder=baseorder + 10))
|
||||
ax.legend(loc=1)
|
||||
|
||||
def connect_mouse_motion(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user