[refs #200] finished magnitude calculation (to be tested)

This commit is contained in:
Sebastian Wehling-Benatelli 2016-09-02 09:03:51 +02:00
parent d98ecea18a
commit 9f13f8db49

View File

@ -39,6 +39,7 @@ from PySide.QtGui import QMainWindow, QInputDialog, QIcon, QFileDialog, \
import numpy as np import numpy as np
import subprocess import subprocess
from obspy import UTCDateTime from obspy import UTCDateTime
from obspy.core.event import Magnitude
from pylot.core.analysis.magnitude import calcsourcespec, calcMoMw from pylot.core.analysis.magnitude import calcsourcespec, calcMoMw
from pylot.core.io.data import Data from pylot.core.io.data import Data
@ -946,7 +947,7 @@ class MainWindow(QMainWindow):
os.remove(phasepath) os.remove(phasepath)
self.getData().applyEVTData(lt.read_location(locpath), type='event') self.getData().applyEVTData(lt.read_location(locpath), type='event')
self.calc_magnitude() self.getData().getEvtData().magnitudes.append(self.calc_magnitude())
def calc_magnitude(self): def calc_magnitude(self):
e = self.getData().getEvtData() e = self.getData().getEvtData()
@ -967,14 +968,16 @@ class MainWindow(QMainWindow):
"Do you want to make it the default value?"), "Do you want to make it the default value?"),
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes | QMessageBox.No,
QMessageBox.No) QMessageBox.No)
print(ans) if ans == QMessageBox.Yes:
settings.setValue("inventoryFile", fninv) settings.setValue("inventoryFile", fninv)
#w0, fc = calcsourcespec(wf, onset, ) settings.sync()
#mags[station] = w0, fc = calcsourcespec(wf, onset, fninv, 3000., a.distance, a.azimuth, a.takeoff_angle, 60., 0)
mag = None stat_mags = calcMoMw(wf, w0, 2700., 3000., a.distance, fninv)
return mag mags[station] = stat_mags
mag = np.median([M[1] for M in mags.values()])
return Magnitude(mag=mag, magnitude_type='Mw')
else: else:
return return None
def check4Loc(self): def check4Loc(self):
return self.picksNum() > 4 return self.picksNum() > 4