[Bugfix] Multiple small bugfixxes keeping NLL from working in python3.+
This commit is contained in:
parent
5ef427ec12
commit
2d33a60421
6
PyLoT.py
6
PyLoT.py
@ -734,7 +734,6 @@ class MainWindow(QMainWindow):
|
|||||||
if use_logwidget:
|
if use_logwidget:
|
||||||
self.logwidget = LogWidget(parent=None)
|
self.logwidget = LogWidget(parent=None)
|
||||||
self.logwidget.show()
|
self.logwidget.show()
|
||||||
|
|
||||||
sys.stdout = self.logwidget.stdout
|
sys.stdout = self.logwidget.stdout
|
||||||
sys.stderr = self.logwidget.stderr
|
sys.stderr = self.logwidget.stderr
|
||||||
|
|
||||||
@ -3086,7 +3085,7 @@ class MainWindow(QMainWindow):
|
|||||||
phasefile = os.path.join(obsdir, filename + '.obs')
|
phasefile = os.path.join(obsdir, filename + '.obs')
|
||||||
lt.modify_inputs(ctrfile, locroot, filename, phasefile, ttt)
|
lt.modify_inputs(ctrfile, locroot, filename, phasefile, ttt)
|
||||||
try:
|
try:
|
||||||
lt.locate(ctrfile)
|
lt.locate(ctrfile, self._inputs)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
print(e.message)
|
print(e.message)
|
||||||
# finally:
|
# finally:
|
||||||
@ -3488,10 +3487,9 @@ class MainWindow(QMainWindow):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
wf_copy = self.get_data().getWFData().copy()
|
wf_copy = self.get_data().getWFData().copy()
|
||||||
|
|
||||||
wf_select = Stream()
|
wf_select = Stream()
|
||||||
# restitute only picked traces
|
# restitute only picked traces
|
||||||
for station in np.unique(self.getPicks('manual').keys() + self.getPicks('auto').keys()):
|
for station in np.unique(list(self.getPicks('manual').keys()) + list(self.getPicks('auto').keys())):
|
||||||
wf_select += wf_copy.select(station=station)
|
wf_select += wf_copy.select(station=station)
|
||||||
|
|
||||||
corr_wf = restitute_data(wf_select, self.metadata)
|
corr_wf = restitute_data(wf_select, self.metadata)
|
||||||
|
@ -144,6 +144,10 @@ class Magnitude(object):
|
|||||||
azimuthal_gap=self.origin_id.get_referred_object().quality.azimuthal_gap)
|
azimuthal_gap=self.origin_id.get_referred_object().quality.azimuthal_gap)
|
||||||
else:
|
else:
|
||||||
# no scaling necessary
|
# no scaling necessary
|
||||||
|
# Temporary fix needs rework
|
||||||
|
if (len(self.magnitudes.keys()) == 0 ):
|
||||||
|
print ( "Error in local magnitude calculation " )
|
||||||
|
return None
|
||||||
mag = ope.Magnitude(
|
mag = ope.Magnitude(
|
||||||
mag=np.median([M.mag for M in self.magnitudes.values()]),
|
mag=np.median([M.mag for M in self.magnitudes.values()]),
|
||||||
magnitude_type=self.type,
|
magnitude_type=self.type,
|
||||||
@ -602,7 +606,7 @@ def calcsourcespec(wfstream, onset, vp, delta, azimuth, incidence,
|
|||||||
N = min(int(np.power(m, 2)), 16384)
|
N = min(int(np.power(m, 2)), 16384)
|
||||||
# N = int(np.power(m, 2))
|
# N = int(np.power(m, 2))
|
||||||
y = dt * np.fft.fft(xdat, N)
|
y = dt * np.fft.fft(xdat, N)
|
||||||
Y = abs(y[: N / 2])
|
Y = abs(y[: int( N / 2)])
|
||||||
L = (N - 1) / freq
|
L = (N - 1) / freq
|
||||||
f = np.arange(0, fny, 1 / L)
|
f = np.arange(0, fny, 1 / L)
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ def locate(fnin, parameter=None):
|
|||||||
:param fnin: external program name
|
:param fnin: external program name
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
exe_path = which('NLLoc', parameter)
|
exe_path = parameter['nllocbin'] + '/bin/NLLoc'
|
||||||
if exe_path is None:
|
if exe_path is None:
|
||||||
raise NLLocError('NonLinLoc executable not found; check your '
|
raise NLLocError('NonLinLoc executable not found; check your '
|
||||||
'environment variables')
|
'environment variables')
|
||||||
|
@ -56,7 +56,7 @@ def which(program, parameter):
|
|||||||
nllocpath = ":" + parameter.get('nllocbin')
|
nllocpath = ":" + parameter.get('nllocbin')
|
||||||
os.environ['PATH'] += nllocpath
|
os.environ['PATH'] += nllocpath
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e.message)
|
print(e)
|
||||||
|
|
||||||
def is_exe(fpath):
|
def is_exe(fpath):
|
||||||
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
|
return os.path.exists(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user