From 3cd64d09dec10b1fe018a06147ae26b38be88d2f Mon Sep 17 00:00:00 2001 From: marcel Date: Mon, 14 Aug 2017 13:30:27 +0200 Subject: [PATCH] [add] parameter savexml added to autoPyLoT --- autoPyLoT.py | 13 +++++++++---- pylot/core/pick/utils.py | 2 +- pylot/core/util/widgets.py | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/autoPyLoT.py b/autoPyLoT.py index 5cf942c7..141df077 100755 --- a/autoPyLoT.py +++ b/autoPyLoT.py @@ -32,8 +32,8 @@ from pylot.core.util.version import get_git_version as _getVersionString __version__ = _getVersionString() -def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, eventid=None, savepath=None, station='all', - iplot=0, ncores=0): +def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, eventid=None, savepath=None, + savexml=True, station='all', iplot=0, ncores=0): """ Determine phase onsets automatically utilizing the automatic picking algorithms by Kueperkoch et al. 2010/2012. @@ -93,6 +93,8 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even iplot = input_dict['iplot'] if 'locflag' in input_dict: locflag = input_dict['locflag'] + if 'savexml' in input_dict: + savexml = input_dict['savexml'] if not parameter: if inputfile: @@ -408,8 +410,11 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even event_id = eventpath.split('/')[-1] evt.resource_id = ResourceIdentifier('smi:local/' + event_id) data.applyEVTData(evt, 'event') - fnqml = '%s/PyLoT_%s' % (eventpath, evID) - data.exportEvent(fnqml, fnext='.xml', fcheck=['auto', 'magnitude', 'origin']) + if savexml: + if not savepath: + savepath = eventpath + fnqml = '%s/PyLoT_%s' % (savepath, evID) + data.exportEvent(fnqml, fnext='.xml', fcheck=['auto', 'magnitude', 'origin']) if locflag == 1: # HYPO71 hypo71file = '%s/PyLoT_%s_HYPO71_phases' % (eventpath, evID) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 1b796d7d..b1a0e940 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -1103,7 +1103,7 @@ def getQualityfromUncertainty(uncertainty, Errors): if uncertainty == None or uncertainty == 'None': return quality - + if uncertainty <= Errors[0]: quality = 0 elif (uncertainty > Errors[0]) and \ diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 7894312e..1d42ce7a 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -2325,7 +2325,8 @@ class TuneAutopicker(QWidget): 'eventid': self.get_current_event_fp(), 'iplot': 2, 'fig_dict': self.fig_dict, - 'locflag': 0} + 'locflag': 0, + 'savexml': False} for key in self.fig_dict.keys(): self.fig_dict[key].clear() self.ap_thread = Thread(self, autoPyLoT, arg=args,