[add] remove picks with weight > 3 from pickdictionary after autopicking

This commit is contained in:
Darius Arnold 2017-08-26 01:53:38 +02:00
parent 1afc6bdcf1
commit c760ea394c
2 changed files with 26 additions and 1 deletions

View File

@ -64,7 +64,7 @@ from pylot.core.io.data import Data
from pylot.core.io.inputs import FilterOptions, PylotParameter from pylot.core.io.inputs import FilterOptions, PylotParameter
from autoPyLoT import autoPyLoT from autoPyLoT import autoPyLoT
from pylot.core.pick.compare import Comparison from pylot.core.pick.compare import Comparison
from pylot.core.pick.utils import symmetrize_error, getQualityFromUncertainty from pylot.core.pick.utils import symmetrize_error, getQualityFromUncertainty, removePicksAbove
from pylot.core.io.phases import picksdict_from_picks from pylot.core.io.phases import picksdict_from_picks
import pylot.core.loc.nll as nll import pylot.core.loc.nll as nll
from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents
@ -1999,6 +1999,7 @@ class MainWindow(QMainWindow):
def finalizeAutoPick(self, result): def finalizeAutoPick(self, result):
self.apw.enable(True) self.apw.enable(True)
if result: if result:
result = removePicksAbove(result, 3)
self.init_canvas_dict_wadatijack() self.init_canvas_dict_wadatijack()
for eventID in result.keys(): for eventID in result.keys():
event = self.get_event_from_id(eventID) event = self.get_event_from_id(eventID)

View File

@ -1146,6 +1146,30 @@ def getQualityFromUncertainty(uncertainty, Errors):
return quality return quality
def removePicksAbove(pickDic, minWeight):
'''remove picks from pick dicitonary with a weight > minweight'''
newdic = {}
for event in pickDic.keys():
newdic[event] = {}
for eventKey, eventDic in pickDic.items():
for station, phases in eventDic.items():
if phases['P']['weight'] < minWeight or phases['S']['weight'] < minWeight:
# dont append stations that will be empty to output dict
newdic[eventKey][station] = {}
if len(phases) > 2:
# copy over other values beside P/S information
additional_info = phases.copy()
if 'P' in phases.keys():
additional_info.pop('P')
if 'S' in phases.keys():
additional_info.pop('S')
newdic[eventKey][station].update(additional_info)
for phasename, phaseinfo in phases.items():
if phasename in ('P', 'S') and phaseinfo['weight'] < minWeight:
newdic[eventKey][station].update({phasename: phaseinfo})
return newdic
if __name__ == '__main__': if __name__ == '__main__':
import doctest import doctest