Re-implemented magnitude calculation within manual picking/location, yet on-going work

This commit is contained in:
Ludger Küperkoch 2019-06-04 12:29:53 +02:00
parent 102b7eafe3
commit bb313f0f49
3 changed files with 25 additions and 18 deletions

View File

@ -2974,7 +2974,7 @@ class MainWindow(QMainWindow):
# os.remove(phasefile)
self.get_data().applyEVTData(lt.read_location(locpath), typ='event')
# self.get_data().applyEVTData(self.calc_magnitude(), typ='event')
self.get_data().applyEVTData(self.calc_magnitude(), typ='event')
def init_array_tab(self):
'''
@ -3312,19 +3312,23 @@ class MainWindow(QMainWindow):
return None
wf_copy = self.get_data().getWFData().copy()
corr_wf = restitute_data(wf_copy, *self.metadata)
# if not rest_flag:
# raise ProcessingError('Restitution of waveform data failed!')
if type == 'ML':
local_mag = LocalMagnitude(corr_wf, self.get_data().get_evt_data(), self.inputs.get('sstop'),
self.inputs.get('WAScaling'), verbosity=True)
return local_mag.updated_event()
elif type == 'Mw':
moment_mag = MomentMagnitude(corr_wf, self.get_data().get_evt_data(), self.inputs.get('vp'),
self.inputs.get('Qp'), self.inputs.get('rho'), verbosity=True)
return moment_mag.updated_event()
else:
corr_wf, rest_flag = restitute_data(wf_copy, self.metadata)
if not rest_flag:
# raise ProcessingError('Restitution of waveform data failed!')
print('Restitution of waveform data failed!')
return None
else:
if type == 'ML':
local_mag = LocalMagnitude(corr_wf, self.get_data().get_evt_data(), self.inputs.get('sstop'),
self.inputs.get('WAScaling'), verbosity=True)
return local_mag.updated_event()
elif type == 'Mw':
moment_mag = MomentMagnitude(corr_wf, self.get_data().get_evt_data(), self.inputs.get('vp'),
self.inputs.get('Qp'), self.inputs.get('rho'), verbosity=True)
return moment_mag.updated_event()
else:
return None
def check4Loc(self):
return self.picksNum() >= 4

View File

@ -542,6 +542,9 @@ class Data(object):
information on the event to the actual data
:param event:
"""
if event is None:
print("applyEvent: Received None")
return
if self.isNew():
self.setEvtData(event)
else:

View File

@ -644,11 +644,11 @@ def restitute_data(data, metadata, unit='VEL', force=False, ncores=0):
# better try restitution for smaller subsets of data (e.g. station by
# station)
# if len(restflag) > 0:
# restflag = bool(np.all(restflag))
# else:
# restflag = False
return data
if len(restflag) > 0:
restflag = bool(np.all(restflag))
else:
restflag = False
return data, restflag
def get_prefilt(trace, tlow=(0.5, 0.9), thi=(5., 2.), verbosity=0):