[bugfix] NLLoc: take nlloc bin explicitly from PylotParameter and not (randomly) from default pylot.in file!!
This commit is contained in:
parent
c3e8b2c03d
commit
27ea20fa47
@ -314,7 +314,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
ttpat)
|
||||
|
||||
# locate the event
|
||||
nll.locate(ctrfile, inputfile)
|
||||
nll.locate(ctrfile, parameter)
|
||||
|
||||
# !iterative picking if traces remained unpicked or occupied with bad picks!
|
||||
# get theoretical onset times for picks with weights >= 4
|
||||
@ -402,7 +402,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
# remove actual NLLoc-location file to keep only the last
|
||||
os.remove(nllocfile)
|
||||
# locate the event
|
||||
nll.locate(ctrfile, inputfile)
|
||||
nll.locate(ctrfile, parameter)
|
||||
print("autoPyLoT: Iteration No. %d finished." % nlloccounter)
|
||||
# get updated NLLoc-location file
|
||||
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||
|
@ -73,17 +73,14 @@ def modify_inputs(ctrfn, root, nllocoutn, phasefn, tttn):
|
||||
nllfile.close()
|
||||
|
||||
|
||||
def locate(fnin, infile=None):
|
||||
def locate(fnin, parameter=None):
|
||||
"""
|
||||
takes an external program name and tries to run it
|
||||
:param fnin: external program name
|
||||
:return: None
|
||||
"""
|
||||
|
||||
if infile is None:
|
||||
exe_path = which('NLLoc')
|
||||
else:
|
||||
exe_path = which('NLLoc', infile)
|
||||
exe_path = which('NLLoc', parameter)
|
||||
if exe_path is None:
|
||||
raise NLLocError('NonLinLoc executable not found; check your '
|
||||
'environment variables')
|
||||
|
@ -1094,7 +1094,7 @@ def runProgram(cmd, parameter=None):
|
||||
subprocess.check_output('{} | tee /dev/stderr'.format(cmd), shell=True)
|
||||
|
||||
|
||||
def which(program, infile=None):
|
||||
def which(program, parameter):
|
||||
"""
|
||||
takes a program name and returns the full path to the executable or None
|
||||
modified after: http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
|
||||
@ -1109,16 +1109,9 @@ def which(program, infile=None):
|
||||
for key in settings.allKeys():
|
||||
if 'binPath' in key:
|
||||
os.environ['PATH'] += ':{0}'.format(settings.value(key))
|
||||
if infile is None:
|
||||
# use default parameter-file name
|
||||
bpath = os.path.join(os.path.expanduser('~'), '.pylot', 'pylot.in')
|
||||
else:
|
||||
bpath = os.path.join(os.path.expanduser('~'), '.pylot', infile)
|
||||
|
||||
if os.path.exists(bpath):
|
||||
nllocpath = ":" + PylotParameter(bpath).get('nllocbin')
|
||||
nllocpath = ":" + parameter.get('nllocbin')
|
||||
os.environ['PATH'] += nllocpath
|
||||
except ImportError as e:
|
||||
except Exception as e:
|
||||
print(e.message)
|
||||
|
||||
def is_exe(fpath):
|
||||
|
Loading…
Reference in New Issue
Block a user