Merge branch 'develop'

This commit is contained in:
Marcel Paffrath 2017-06-29 15:18:38 +02:00
commit 583f39dd17
41 changed files with 100380 additions and 71020 deletions

View File

@ -247,25 +247,42 @@ class MainWindow(QMainWindow):
self.tabs.setCurrentIndex(0) self.tabs.setCurrentIndex(0)
quitIcon = self.style().standardIcon(QStyle.SP_MediaStop) quitIcon = self.style().standardIcon(QStyle.SP_MediaStop)
saveIcon = self.style().standardIcon(QStyle.SP_DriveHDIcon)
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
helpIcon = self.style().standardIcon(QStyle.SP_DialogHelpButton) helpIcon = self.style().standardIcon(QStyle.SP_DialogHelpButton)
newIcon = self.style().standardIcon(QStyle.SP_FileIcon)
newFolderIcon = self.style().standardIcon(QStyle.SP_FileDialogNewFolder) newFolderIcon = self.style().standardIcon(QStyle.SP_FileDialogNewFolder)
# create resource icons # create resource icons
locactionicon = QIcon() newIcon = QIcon()
locactionicon.addPixmap(QPixmap(':/icons/locactionicon.png')) newIcon.addPixmap(QPixmap(':/icons/newfile.png'))
manupicksicon = QIcon() addIcon = QIcon()
manupicksicon.addPixmap(QPixmap(':/icons/manupicsicon.png')) addIcon.addPixmap(QPixmap(':/icons/add.png'))
autopicksicon = QIcon() saveIcon = QIcon()
autopicksicon.addPixmap(QPixmap(':/icons/autopicsicon.png')) saveIcon.addPixmap(QPixmap(':/icons/save.png'))
saveasIcon = QIcon()
saveasIcon.addPixmap(QPixmap(':/icons/saveas.png'))
saveProjectIcon = QIcon()
saveProjectIcon.addPixmap(QPixmap(':/icons/saveproject.png'))
saveProjectAsIcon = QIcon()
saveProjectAsIcon.addPixmap(QPixmap(':/icons/saveprojectas.png'))
openIcon = QIcon()
openIcon.addPixmap(QPixmap(':/icons/openfile.png'))
openProjectIcon = QIcon()
openProjectIcon.addPixmap(QPixmap(':/icons/openproject.png'))
openLocIcon = QIcon()
openLocIcon.addPixmap(QPixmap(':/icons/openloc.png'))
openEventIcon = QIcon()
openEventIcon.addPixmap(QPixmap(':/icons/openpick.png'))
openEventsIcon = QIcon()
openEventsIcon.addPixmap(QPixmap(':/icons/openpicks.png'))
saveEventsIcon = QIcon()
saveEventsIcon.addPixmap(QPixmap(':/icons/savepicks.png'))
prefIcon = QIcon()
prefIcon.addPixmap(QPixmap(':/icons/preferences.png'))
paraIcon = QIcon()
paraIcon.addPixmap(QPixmap(':/icons/parameter.png'))
self.autopicksicon_small = QIcon() self.autopicksicon_small = QIcon()
self.autopicksicon_small.addPixmap(QPixmap(':/icons/autopicksicon_small.png')) self.autopicksicon_small.addPixmap(QPixmap(':/icons/autopicksicon_small.png'))
self.manupicksicon_small = QIcon() self.manupicksicon_small = QIcon()
self.manupicksicon_small.addPixmap(QPixmap(':/icons/manupicksicon_small.png')) self.manupicksicon_small.addPixmap(QPixmap(':/icons/manupicksicon_small.png'))
saveProjectIcon = QIcon()
saveProjectIcon.addPixmap(QPixmap(':/icons/Library-icon.png'))
loadpiloticon = QIcon() loadpiloticon = QIcon()
loadpiloticon.addPixmap(QPixmap(':/icons/Matlab_PILOT_icon.png')) loadpiloticon.addPixmap(QPixmap(':/icons/Matlab_PILOT_icon.png'))
p_icon = QIcon() p_icon = QIcon()
@ -283,7 +300,7 @@ class MainWindow(QMainWindow):
e_icon = QIcon() e_icon = QIcon()
e_icon.addPixmap(QPixmap(':/icons/key_E.png')) e_icon.addPixmap(QPixmap(':/icons/key_E.png'))
autotune_icon = QIcon() autotune_icon = QIcon()
autotune_icon.addPixmap(QPixmap(':/icons/autopick_button.png')) autotune_icon.addPixmap(QPixmap(':/icons/tune.png'))
autopylot_icon = QIcon() autopylot_icon = QIcon()
autopylot_icon.addPixmap(QPixmap(':/icons/autopylot_button')) autopylot_icon.addPixmap(QPixmap(':/icons/autopylot_button'))
locate_icon = QIcon() locate_icon = QIcon()
@ -297,7 +314,7 @@ class MainWindow(QMainWindow):
self.openProjectAction = self.createAction(self, "&Open project ...", self.openProjectAction = self.createAction(self, "&Open project ...",
self.loadProject, self.loadProject,
QKeySequence.Open, QKeySequence.Open,
openIcon, openProjectIcon,
"Load project file") "Load project file")
self.saveProjectAction = self.createAction(self, "&Save project ...", self.saveProjectAction = self.createAction(self, "&Save project ...",
self.saveProject, self.saveProject,
@ -308,7 +325,7 @@ class MainWindow(QMainWindow):
self.saveProjectAsAction = self.createAction(self, "Save project as ...", self.saveProjectAsAction = self.createAction(self, "Save project as ...",
self.saveProjectAs, self.saveProjectAs,
QKeySequence.SaveAs, QKeySequence.SaveAs,
saveProjectIcon, saveProjectAsIcon,
"Save project file as...") "Save project file as...")
self.saveProjectAsAction.setEnabled(False) self.saveProjectAsAction.setEnabled(False)
# newEventAction = self.createAction(self, "&New event ...", # newEventAction = self.createAction(self, "&New event ...",
@ -318,7 +335,7 @@ class MainWindow(QMainWindow):
self.openmanualpicksaction = self.createAction(self, "Load event ...", self.openmanualpicksaction = self.createAction(self, "Load event ...",
self.load_data, self.load_data,
"Ctrl+M", "Ctrl+M",
manupicksicon, openEventIcon,
"Load event information for " "Load event information for "
"the displayed event.") "the displayed event.")
self.openmanualpicksaction.setEnabled(False) self.openmanualpicksaction.setEnabled(False)
@ -327,7 +344,7 @@ class MainWindow(QMainWindow):
self.openautopicksaction = self.createAction(self, "Load event information &automatically ... ", self.openautopicksaction = self.createAction(self, "Load event information &automatically ... ",
self.load_multiple_data, self.load_multiple_data,
"Ctrl+A", "Ctrl+A",
autopicksicon, openEventsIcon,
"Load event data automatically " "Load event data automatically "
"for for all events.") "for for all events.")
self.openautopicksaction.setEnabled(False) self.openautopicksaction.setEnabled(False)
@ -335,7 +352,7 @@ class MainWindow(QMainWindow):
self.loadlocationaction = self.createAction(self, "Load &location ...", self.loadlocationaction = self.createAction(self, "Load &location ...",
self.load_loc, "Ctrl+L", self.load_loc, "Ctrl+L",
locactionicon, openLocIcon,
"Load location information on " "Load location information on "
"the displayed event.") "the displayed event.")
self.loadlocationaction.setEnabled(False) self.loadlocationaction.setEnabled(False)
@ -349,17 +366,17 @@ class MainWindow(QMainWindow):
self.saveManualPicksAction = self.createAction(self, "Save &picks ...", self.saveManualPicksAction = self.createAction(self, "Save &picks ...",
self.saveData, "Ctrl+P", self.saveData, "Ctrl+P",
saveIcon, "Save event pick data.") saveEventsIcon, "Save event pick data.")
self.disableSaveManualPicksAction() self.disableSaveManualPicksAction()
self.addEventDataAction = self.createAction(self, "Add &events ...", self.addEventDataAction = self.createAction(self, "Add &events ...",
self.add_events, self.add_events,
"Ctrl+E", newFolderIcon, "Ctrl+E", addIcon,
"Add event data") "Add event data")
prefsEventAction = self.createAction(self, "Preferences", prefsEventAction = self.createAction(self, "Preferences",
self.PyLoTprefs, self.PyLoTprefs,
QKeySequence.Preferences, QKeySequence.Preferences,
QIcon(None), prefIcon,
"Edit PyLoT app preferences.") "Edit PyLoT app preferences.")
quitAction = self.createAction(self, "&Quit", quitAction = self.createAction(self, "&Quit",
QCoreApplication.instance().quit, QCoreApplication.instance().quit,
@ -367,7 +384,7 @@ class MainWindow(QMainWindow):
"Close event and quit PyLoT") "Close event and quit PyLoT")
self.parameterAction = self.createAction(self, "Parameter", self.parameterAction = self.createAction(self, "Parameter",
self.setParameter, self.setParameter,
None, QIcon(None), None, paraIcon,
"Modify Parameter") "Modify Parameter")
self.filterAction = self.createAction(self, "&Filter ...", self.filterAction = self.createAction(self, "&Filter ...",
self.filterWaveformData, self.filterWaveformData,
@ -377,7 +394,7 @@ class MainWindow(QMainWindow):
desired seismic phase.""", True) desired seismic phase.""", True)
filterEditAction = self.createAction(self, "&Filter parameter ...", filterEditAction = self.createAction(self, "&Filter parameter ...",
self.adjustFilterOptions, self.adjustFilterOptions,
"Alt+F", QIcon(None), "Alt+F", filter_icon,
"""Adjust filter parameters.""") """Adjust filter parameters.""")
self.selectPAction = self.createAction(self, "&P", self.alterPhase, self.selectPAction = self.createAction(self, "&P", self.alterPhase,
"Alt+P", "Alt+P",
@ -426,11 +443,15 @@ class MainWindow(QMainWindow):
fileToolBar = self.addToolBar("FileTools") fileToolBar = self.addToolBar("FileTools")
fileToolActions = (self.newProjectAction, self.addEventDataAction, fileToolActions = (self.newProjectAction, self.addEventDataAction,
self.openProjectAction, self.saveProjectAction, self.openProjectAction, self.saveProjectAction,
self.saveProjectAsAction, self.openmanualpicksaction, self.saveProjectAsAction)
self.openautopicksaction, self.loadlocationaction,
self.loadpilotevent, self.saveManualPicksAction)
fileToolBar.setObjectName("FileTools") fileToolBar.setObjectName("FileTools")
self.addActions(fileToolBar, fileToolActions) self.addActions(fileToolBar, fileToolActions)
eventToolActions = (self.openmanualpicksaction, self.openautopicksaction,
self.saveManualPicksAction, self.loadlocationaction,
self.loadpilotevent)
eventToolBar = self.addToolBar("EventTools")
eventToolBar.setObjectName("EventTools")
self.addActions(eventToolBar, eventToolActions)
# phaseToolBar = self.addToolBar("PhaseTools") # phaseToolBar = self.addToolBar("PhaseTools")
# phaseToolActions = (self.selectPAction, self.selectSAction) # phaseToolActions = (self.selectPAction, self.selectSAction)
@ -2401,7 +2422,7 @@ class MainWindow(QMainWindow):
self.setDirty(True) self.setDirty(True)
def setDirty(self, value): def setDirty(self, value):
self.saveProjectAction.setEnabled(bool(self.get_current_event().picks)) self.saveProjectAction.setEnabled(value)
self.saveProjectAsAction.setEnabled(True) self.saveProjectAsAction.setEnabled(True)
self.project.setDirty(value) self.project.setDirty(value)
self.dirty = value self.dirty = value

View File

@ -1,15 +1,29 @@
<RCC> <RCC>
<qresource> <qresource>
<file>icons/Library-icon.png</file>
<file>icons/pylot.ico</file> <file>icons/pylot.ico</file>
<file>icons/pylot.png</file> <file>icons/pylot.png</file>
<file>icons/manupicsicon.png</file> <file>icons/newfile.png</file>
<file>icons/autopicsicon.png</file> <file>icons/open.png</file>
<file>icons/autopylot_button.png</file> <file>icons/openproject.png</file>
<file>icons/add.png</file>
<file>icons/save.png</file>
<file>icons/saveas.png</file>
<file>icons/saveproject.png</file>
<file>icons/saveprojectas.png</file>
<file>icons/manupicksicon_small.png</file> <file>icons/manupicksicon_small.png</file>
<file>icons/autopicksicon_small.png</file> <file>icons/autopicksicon_small.png</file>
<file>icons/autopick_button.png</file> <file>icons/tune.png</file>
<file>icons/locactionicon.png</file> <file>icons/autopylot_button.png</file>
<file>icons/pick.png</file>
<file>icons/waveform.png</file>
<file>icons/openpick.png</file>
<file>icons/openpicks.png</file>
<file>icons/openpick.png</file>
<file>icons/openpicks.png</file>
<file>icons/savepicks.png</file>
<file>icons/preferences.png</file>
<file>icons/parameter.png</file>
<file>icons/openloc.png</file>
<file>icons/compare_button.png</file> <file>icons/compare_button.png</file>
<file>icons/locate_button.png</file> <file>icons/locate_button.png</file>
<file>icons/Matlab_PILOT_icon.png</file> <file>icons/Matlab_PILOT_icon.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 50 KiB

BIN
icons/add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 31 KiB

BIN
icons/autopylot_button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 25 KiB

BIN
icons/newfile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
icons/open.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
icons/openfile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
icons/openloc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

BIN
icons/openpick.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
icons/openpicks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
icons/openproject.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
icons/parameter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
icons/pick.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
icons/preferences.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
icons/save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
icons/saveas.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
icons/savepicks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
icons/saveproject.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
icons/saveprojectas.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
icons/tune.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
icons/waveform.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

160158
icons_rc.py

File diff suppressed because it is too large Load Diff

View File

@ -188,11 +188,47 @@ class Data(object):
# try exporting event via ObsPy # try exporting event via ObsPy
else: else:
# check for stations picked automatically as well as manually
# Prefer manual picks!
evtdata_copy = self.get_evt_data().copy()
evtdata_org = self.get_evt_data()
for i in range(len(evtdata_org.picks)):
if evtdata_org.picks[i].method_id == 'manual':
mstation = evtdata_org.picks[i].waveform_id.station_code
mstation_ext = mstation + '_'
for k in range(len(evtdata_copy.picks)):
if evtdata_copy.picks[k].waveform_id.station_code == mstation or \
evtdata_copy.picks[k].waveform_id.station_code == mstation_ext and \
evtdata_copy.picks[k].method_id == 'auto':
del evtdata_copy.picks[k]
break
lendiff = len(evtdata_org.picks) - len(evtdata_copy.picks)
if lendiff is not 0:
print("Manual as well as automatic picks available. Prefered the {} manual ones!".format(lendiff))
if fnext == '.obs':
try: try:
self.get_evt_data().write(fnout + fnext, format=evtformat) evtdata_copy.write(fnout + fnext, format=evtformat)
# write header afterwards
evid = str(evtdata_org.resource_id).split('/')[1]
header = '# EQEVENT: Label: EQ%s Loc: X 0.00 Y 0.00 Z 10.00 OT 0.00 \n' % evid
nllocfile = open(fnout + fnext)
l = nllocfile.readlines()
nllocfile.close()
l.insert(0, header)
nllocfile = open(fnout + fnext, 'w')
nllocfile.write("".join(l))
nllocfile.close()
except KeyError as e: except KeyError as e:
raise KeyError('''{0} export format raise KeyError('''{0} export format
not implemented: {1}'''.format(evtformat, e)) not implemented: {1}'''.format(evtformat, e))
if fnext == '.cnv':
try:
evtdata_org.write(fnout + fnext, format=evtformat)
except KeyError as e:
raise KeyError('''{0} export format
not implemented: {1}'''.format(evtformat, e))
def getComp(self): def getComp(self):
""" """

View File

@ -35,6 +35,7 @@ from PySide.QtGui import QAction, QApplication, QCheckBox, QComboBox, \
from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot from PySide.QtCore import QSettings, Qt, QUrl, Signal, Slot
from PySide.QtWebKit import QWebView from PySide.QtWebKit import QWebView
from obspy import Stream, UTCDateTime from obspy import Stream, UTCDateTime
from obspy.core.util import AttribDict
from pylot.core.io.data import Data from pylot.core.io.data import Data
from pylot.core.io.inputs import FilterOptions, PylotParameter from pylot.core.io.inputs import FilterOptions, PylotParameter
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \ from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin, \
@ -1360,7 +1361,9 @@ class PickDlg(QDialog):
'S': ('m', 'm--', 'r-', 'rv', 'r^', 'r', 'm:') 'S': ('m', 'm--', 'r-', 'rv', 'r^', 'r', 'm:')
} }
if self.getPicks(picktype): if self.getPicks(picktype):
if phase is not None and type(self.getPicks(picktype)[phase]) is dict: if phase is not None:
if (type(self.getPicks(picktype)[phase]) is dict
or type(self.getPicks(picktype)[phase]) is AttribDict):
picks = self.getPicks(picktype)[phase] picks = self.getPicks(picktype)[phase]
colors = phase_col[phase[0].upper()] colors = phase_col[phase[0].upper()]
elif phase is None: elif phase is None: