[cleanup] removed has_spe function, using dict.get method instead!

This commit is contained in:
Marcel Paffrath 2018-07-16 16:10:49 +02:00
parent 663d244f70
commit 469d91bfdc
2 changed files with 3 additions and 17 deletions

View File

@ -76,7 +76,7 @@ from pylot.core.util.connection import checkurl
from pylot.core.util.dataprocessing import read_metadata, restitute_data from pylot.core.util.dataprocessing import read_metadata, restitute_data
from pylot.core.util.utils import fnConstructor, getLogin, \ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \ full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \
pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, \ pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, \
check4rotated, transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \ check4rotated, transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
check_all_pylot, real_Bool check_all_pylot, real_Bool
from pylot.core.util.event import Event from pylot.core.util.event import Event
@ -1266,7 +1266,7 @@ class MainWindow(QMainWindow):
for phasename, pick in picks.items(): for phasename, pick in picks.items():
if not type(pick) in [dict, AttribDict]: if not type(pick) in [dict, AttribDict]:
continue continue
if getQualityFromUncertainty(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4: if getQualityFromUncertainty(pick.get('spe'), phaseErrors[self.getPhaseID(phasename)]) < 4:
ma_count[ma] += 1 ma_count[ma] += 1
ma_count_total[ma] += 1 ma_count_total[ma] += 1
@ -2998,7 +2998,7 @@ class MainWindow(QMainWindow):
for phasename, pick in picks.items(): for phasename, pick in picks.items():
if not type(pick) in [dict, AttribDict]: if not type(pick) in [dict, AttribDict]:
continue continue
if getQualityFromUncertainty(has_spe(pick), phaseErrors[self.getPhaseID(phasename)]) < 4: if getQualityFromUncertainty(pick.get('spe'), phaseErrors[self.getPhaseID(phasename)]) < 4:
ma_count[ma] += 1 ma_count[ma] += 1
ma_count_total[ma] += 1 ma_count_total[ma] += 1

View File

@ -1167,20 +1167,6 @@ def identifyPhaseID(phase):
return identifyPhase(loopIdentifyPhase(phase)) return identifyPhase(loopIdentifyPhase(phase))
def has_spe(pick):
"""
Check for 'spe' key (symmetric picking error) in dict and return its value if found, else return None
:param pick: pick dictionary
:type pick: dict
:return: value of 'spe' key
:rtype: float or None
"""
if not 'spe' in pick.keys():
return None
else:
return pick['spe']
def check_all_obspy(eventlist): def check_all_obspy(eventlist):
ev_type = 'obspydmt' ev_type = 'obspydmt'
return check_event_folders(eventlist, ev_type) return check_event_folders(eventlist, ev_type)