Merge branch 'develop' of ariadne.geophysik.ruhr-uni-bochum.de:/data/git/pylot into develop
This commit is contained in:
commit
2395c12b26
54
QtPyLoT.py
54
QtPyLoT.py
@ -83,6 +83,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.recentfiles = settings.value("data/recentEvents", [])
|
self.recentfiles = settings.value("data/recentEvents", [])
|
||||||
self.fname = dict(manual=None, auto=None, loc=None)
|
self.fname = dict(manual=None, auto=None, loc=None)
|
||||||
self.fnames = None
|
self.fnames = None
|
||||||
|
self._stime = None
|
||||||
structure_setting = settings.value("data/Structure", "PILOT")
|
structure_setting = settings.value("data/Structure", "PILOT")
|
||||||
self.dataStructure = DATASTRUCTURE[structure_setting]()
|
self.dataStructure = DATASTRUCTURE[structure_setting]()
|
||||||
self.seismicPhase = str(settings.value("phase", "P"))
|
self.seismicPhase = str(settings.value("phase", "P"))
|
||||||
@ -108,6 +109,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.data = Data(self, lastEvent)
|
self.data = Data(self, lastEvent)
|
||||||
else:
|
else:
|
||||||
self.data = Data(self)
|
self.data = Data(self)
|
||||||
|
self.autodata = Data(self)
|
||||||
|
|
||||||
# load and display waveform data
|
# load and display waveform data
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
@ -387,6 +389,18 @@ class MainWindow(QMainWindow):
|
|||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
return settings.value("data/dataRoot")
|
return settings.value("data/dataRoot")
|
||||||
|
|
||||||
|
def getType(self):
|
||||||
|
type = QInputDialog().getItem(self, self.tr("Select phases type"),
|
||||||
|
self.tr("Type:"), [self.tr("manual"),
|
||||||
|
self.tr("automatic")])
|
||||||
|
|
||||||
|
if type[0].startswith('auto'):
|
||||||
|
type = 'auto'
|
||||||
|
else:
|
||||||
|
type = type[0]
|
||||||
|
|
||||||
|
return type
|
||||||
|
|
||||||
def load_autopicks(self, fname=None):
|
def load_autopicks(self, fname=None):
|
||||||
self.load_data(fname, type='auto')
|
self.load_data(fname, type='auto')
|
||||||
|
|
||||||
@ -395,7 +409,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def load_pilotevent(self):
|
def load_pilotevent(self):
|
||||||
filt = "PILOT location files (*.mat)"
|
filt = "PILOT location files (*.mat)"
|
||||||
caption = "Select PILOT loaction file"
|
caption = "Select PILOT location file"
|
||||||
fn_loc = QFileDialog().getOpenFileName(self, caption=caption,
|
fn_loc = QFileDialog().getOpenFileName(self, caption=caption,
|
||||||
filter=filt, dir=self.getRoot())
|
filter=filt, dir=self.getRoot())
|
||||||
fn_loc = fn_loc[0]
|
fn_loc = fn_loc[0]
|
||||||
@ -405,14 +419,8 @@ class MainWindow(QMainWindow):
|
|||||||
fn_phases = QFileDialog().getOpenFileName(self, caption=caption,
|
fn_phases = QFileDialog().getOpenFileName(self, caption=caption,
|
||||||
filter=filt, dir=loc_dir)
|
filter=filt, dir=loc_dir)
|
||||||
fn_phases = fn_phases[0]
|
fn_phases = fn_phases[0]
|
||||||
type = QInputDialog().getItem(self, self.tr("Select phases type"),
|
|
||||||
self.tr("Type:"), [self.tr("manual"),
|
|
||||||
self.tr("automatic")])
|
|
||||||
|
|
||||||
if type[0].startswith('auto'):
|
type = self.getType()
|
||||||
type = 'auto'
|
|
||||||
else:
|
|
||||||
type = type[0]
|
|
||||||
|
|
||||||
fname_dict = dict(phasfn=fn_phases, locfn=fn_loc)
|
fname_dict = dict(phasfn=fn_phases, locfn=fn_loc)
|
||||||
self.load_data(fname_dict, type=type)
|
self.load_data(fname_dict, type=type)
|
||||||
@ -425,10 +433,12 @@ class MainWindow(QMainWindow):
|
|||||||
if isinstance(action, QAction):
|
if isinstance(action, QAction):
|
||||||
fname = self.filename_from_action(action)
|
fname = self.filename_from_action(action)
|
||||||
self.set_fname(fname, type)
|
self.set_fname(fname, type)
|
||||||
self.data += Data(self, evtdata=fname)
|
data = dict(auto=self.autodata, manual=self.data)
|
||||||
|
data[type] += Data(self, evtdata=fname)
|
||||||
if 'loc' not in type:
|
if 'loc' not in type:
|
||||||
self.updatePicks(type=type)
|
self.updatePicks(type=type)
|
||||||
self.drawPicks()
|
self.drawPicks(picktype=type)
|
||||||
|
self.draw()
|
||||||
|
|
||||||
def getLastEvent(self):
|
def getLastEvent(self):
|
||||||
return self.recentfiles[0]
|
return self.recentfiles[0]
|
||||||
@ -577,7 +587,13 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
ycoord = gui_event.ydata
|
ycoord = gui_event.ydata
|
||||||
|
|
||||||
|
try:
|
||||||
statID = int(round(ycoord))
|
statID = int(round(ycoord))
|
||||||
|
except TypeError as e:
|
||||||
|
if 'a float is required' in e.message:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
||||||
return statID
|
return statID
|
||||||
|
|
||||||
@ -588,6 +604,9 @@ class MainWindow(QMainWindow):
|
|||||||
return wfID
|
return wfID
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def getStime(self):
|
||||||
|
return self._stime
|
||||||
|
|
||||||
def addActions(self, target, actions):
|
def addActions(self, target, actions):
|
||||||
for action in actions:
|
for action in actions:
|
||||||
if action is None:
|
if action is None:
|
||||||
@ -606,6 +625,7 @@ class MainWindow(QMainWindow):
|
|||||||
ans = self.data.setWFData(self.fnames)
|
ans = self.data.setWFData(self.fnames)
|
||||||
elif self.fnames is None and self.okToContinue():
|
elif self.fnames is None and self.okToContinue():
|
||||||
ans = self.data.setWFData(self.getWFFnames())
|
ans = self.data.setWFData(self.getWFFnames())
|
||||||
|
self._stime = getGlobalTimes(self.getData().getWFData())[0]
|
||||||
if ans:
|
if ans:
|
||||||
self.plotWaveformData()
|
self.plotWaveformData()
|
||||||
return ans
|
return ans
|
||||||
@ -630,16 +650,19 @@ class MainWindow(QMainWindow):
|
|||||||
self.setComponent('Z')
|
self.setComponent('Z')
|
||||||
self.plotWaveformData()
|
self.plotWaveformData()
|
||||||
self.drawPicks()
|
self.drawPicks()
|
||||||
|
self.draw()
|
||||||
|
|
||||||
def plotN(self):
|
def plotN(self):
|
||||||
self.setComponent('N')
|
self.setComponent('N')
|
||||||
self.plotWaveformData()
|
self.plotWaveformData()
|
||||||
self.drawPicks()
|
self.drawPicks()
|
||||||
|
self.draw()
|
||||||
|
|
||||||
def plotE(self):
|
def plotE(self):
|
||||||
self.setComponent('E')
|
self.setComponent('E')
|
||||||
self.plotWaveformData()
|
self.plotWaveformData()
|
||||||
self.drawPicks()
|
self.drawPicks()
|
||||||
|
self.draw()
|
||||||
|
|
||||||
def pushFilterWF(self, param_args):
|
def pushFilterWF(self, param_args):
|
||||||
self.getData().filterWFData(param_args)
|
self.getData().filterWFData(param_args)
|
||||||
@ -655,6 +678,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.getData().resetWFData()
|
self.getData().resetWFData()
|
||||||
self.plotWaveformData()
|
self.plotWaveformData()
|
||||||
self.drawPicks()
|
self.drawPicks()
|
||||||
|
self.draw()
|
||||||
|
|
||||||
def adjustFilterOptions(self):
|
def adjustFilterOptions(self):
|
||||||
fstring = "Filter Options ({0})".format(self.getSeismicPhase())
|
fstring = "Filter Options ({0})".format(self.getSeismicPhase())
|
||||||
@ -724,6 +748,8 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
wfID = self.getWFID(gui_event)
|
wfID = self.getWFID(gui_event)
|
||||||
|
|
||||||
|
if not wfID: return
|
||||||
|
|
||||||
station = self.getStationName(wfID)
|
station = self.getStationName(wfID)
|
||||||
self.updateStatus('picking on station {0}'.format(station))
|
self.updateStatus('picking on station {0}'.format(station))
|
||||||
data = self.getData().getWFData()
|
data = self.getData().getWFData()
|
||||||
@ -737,8 +763,10 @@ class MainWindow(QMainWindow):
|
|||||||
if replot:
|
if replot:
|
||||||
self.plotWaveformData()
|
self.plotWaveformData()
|
||||||
self.drawPicks()
|
self.drawPicks()
|
||||||
|
self.draw()
|
||||||
else:
|
else:
|
||||||
self.drawPicks(station)
|
self.drawPicks(station)
|
||||||
|
self.draw()
|
||||||
else:
|
else:
|
||||||
self.updateStatus('picks discarded ({0})'.format(station))
|
self.updateStatus('picks discarded ({0})'.format(station))
|
||||||
if not self.getLocflag() and self.check4Loc():
|
if not self.getLocflag() and self.check4Loc():
|
||||||
@ -774,6 +802,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def finalizeAutoPick(self):
|
def finalizeAutoPick(self):
|
||||||
self.drawPicks(picktype='auto')
|
self.drawPicks(picktype='auto')
|
||||||
|
self.draw()
|
||||||
self.thread.quit()
|
self.thread.quit()
|
||||||
|
|
||||||
def addPicks(self, station, picks, type='manual'):
|
def addPicks(self, station, picks, type='manual'):
|
||||||
@ -828,14 +857,14 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
stat_picks = self.getPicks(type=picktype)[station]
|
stat_picks = self.getPicks(type=picktype)[station]
|
||||||
|
|
||||||
|
stime = self.getStime()
|
||||||
|
|
||||||
for phase in stat_picks:
|
for phase in stat_picks:
|
||||||
picks = stat_picks[phase]
|
picks = stat_picks[phase]
|
||||||
if type(stat_picks[phase]) is not dict:
|
if type(stat_picks[phase]) is not dict:
|
||||||
return
|
return
|
||||||
colors = phase_col[phase[0].upper()]
|
colors = phase_col[phase[0].upper()]
|
||||||
|
|
||||||
stime = getGlobalTimes(self.getData().getWFData())[0]
|
|
||||||
|
|
||||||
mpp = picks['mpp'] - stime
|
mpp = picks['mpp'] - stime
|
||||||
epp = picks['epp'] - stime
|
epp = picks['epp'] - stime
|
||||||
lpp = picks['lpp'] - stime
|
lpp = picks['lpp'] - stime
|
||||||
@ -852,7 +881,6 @@ class MainWindow(QMainWindow):
|
|||||||
mpp, ylims[0], colors[4])
|
mpp, ylims[0], colors[4])
|
||||||
else:
|
else:
|
||||||
raise TypeError('Unknow picktype {0}'.format(picktype))
|
raise TypeError('Unknow picktype {0}'.format(picktype))
|
||||||
self.draw()
|
|
||||||
|
|
||||||
def locateEvent(self):
|
def locateEvent(self):
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
|
@ -40,7 +40,7 @@ class Data(object):
|
|||||||
elif isinstance(evtdata, dict):
|
elif isinstance(evtdata, dict):
|
||||||
evt = readPILOTEvent(**evtdata)
|
evt = readPILOTEvent(**evtdata)
|
||||||
evtdata = evt
|
evtdata = evt
|
||||||
elif isinstance(evtdata, str):
|
elif isinstance(evtdata, basestring):
|
||||||
try:
|
try:
|
||||||
cat = read_events(evtdata)
|
cat = read_events(evtdata)
|
||||||
if len(cat) is not 1:
|
if len(cat) is not 1:
|
||||||
|
@ -127,10 +127,15 @@ def stations_from_pilot(stat_array):
|
|||||||
stations = list()
|
stations = list()
|
||||||
cur_stat = None
|
cur_stat = None
|
||||||
for stat in stat_array:
|
for stat in stat_array:
|
||||||
|
stat = stat.strip()
|
||||||
if stat == cur_stat:
|
if stat == cur_stat:
|
||||||
continue
|
continue
|
||||||
cur_stat = stat
|
cur_stat = stat
|
||||||
stations.append(stat.strip())
|
if stat not in stations:
|
||||||
|
stations.append(stat)
|
||||||
|
else:
|
||||||
|
warnings.warn('station {0} listed at least twice, might corrupt '
|
||||||
|
'phase times', RuntimeWarning)
|
||||||
|
|
||||||
return stations
|
return stations
|
||||||
|
|
||||||
@ -178,9 +183,15 @@ def picksdict_from_picks(evt):
|
|||||||
print(e)
|
print(e)
|
||||||
onsets = {}
|
onsets = {}
|
||||||
mpp = pick.time
|
mpp = pick.time
|
||||||
|
spe = pick.time_errors.uncertainty
|
||||||
|
try:
|
||||||
lpp = mpp + pick.time_errors.upper_uncertainty
|
lpp = mpp + pick.time_errors.upper_uncertainty
|
||||||
epp = mpp - pick.time_errors.lower_uncertainty
|
epp = mpp - pick.time_errors.lower_uncertainty
|
||||||
spe = pick.time_errors.uncertainty
|
except TypeError as e:
|
||||||
|
msg = e.message + ',\n falling back to symmetric uncertainties'
|
||||||
|
warnings.warn(msg)
|
||||||
|
lpp = mpp + spe
|
||||||
|
epp = mpp - spe
|
||||||
phase['mpp'] = mpp
|
phase['mpp'] = mpp
|
||||||
phase['epp'] = epp
|
phase['epp'] = epp
|
||||||
phase['lpp'] = lpp
|
phase['lpp'] = lpp
|
||||||
|
Loading…
Reference in New Issue
Block a user