diff --git a/PyLoT.py b/PyLoT.py index 2e4917f8..71e63d14 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -1293,12 +1293,15 @@ class MainWindow(QMainWindow): paths_exist = [os.path.exists(event.path) for event in self.project.eventlist] if all(paths_exist): return True + elif not any(paths_exist): + return False else: info_str = '' for event, path_exists in zip(self.project.eventlist, paths_exist): - info_str += '\n{} exists: {}'.format(event.path, path_exists) + if not path_exists: + info_str += '\n{} exists: {}'.format(event.path, path_exists) print('Unable to find certain event paths:{}'.format(info_str)) - return False + return True def modify_project_path(self, new_rootpath): self.project.rootpath = new_rootpath @@ -3581,7 +3584,10 @@ class MainWindow(QMainWindow): if not filename.split('.')[-1] == 'plp': filename = fnm[0] + '.plp' self.project.parameter = self._inputs - self.exportEvents() + settings = QSettings() + autosaveXML = get_Bool(settings.value('autosaveXML', True)) + if autosaveXML: + self.exportEvents() self.project.save(filename) self.setDirty(False) self.saveProjectAsAction.setEnabled(True) @@ -3602,7 +3608,10 @@ class MainWindow(QMainWindow): else: self.metadata.clear_inventory() self.project.parameter = self._inputs - self.exportEvents() + settings = QSettings() + autosaveXML = get_Bool(settings.value('autosaveXML', True)) + if autosaveXML: + self.exportEvents() self.project.save() self.update_obspy_dmt() if not self.project.dirty: diff --git a/pylot/core/util/array_map.py b/pylot/core/util/array_map.py index 77a75fca..b2f3b078 100644 --- a/pylot/core/util/array_map.py +++ b/pylot/core/util/array_map.py @@ -349,11 +349,11 @@ class Array_map(QtGui.QWidget): parallels = np.arange(-90, 90, 5.) parallels_small = np.arange(-90, 90, 2.5) basemap.drawparallels(parallels_small, linewidth=0.5, zorder=7) - basemap.drawparallels(parallels, zorder=7) + basemap.drawparallels(parallels, zorder=7)#, labels=[1, 1, 0, 0]) meridians = np.arange(-180, 180, 5.) meridians_small = np.arange(-180, 180, 2.5) basemap.drawmeridians(meridians_small, linewidth=0.5, zorder=7) - basemap.drawmeridians(meridians, zorder=7) + basemap.drawmeridians(meridians, zorder=7)#, labels=[0, 0, 1, 1]) self.basemap = basemap self.figure._tight = True self.figure.tight_layout() diff --git a/pylot/core/util/generate_array_maps.py b/pylot/core/util/generate_array_maps.py index c70245d9..c974df8d 100755 --- a/pylot/core/util/generate_array_maps.py +++ b/pylot/core/util/generate_array_maps.py @@ -67,9 +67,9 @@ def array_map_worker(input_dict): if __name__ == '__main__': dataroot = '/home/marcel' - infiles=['alparray_all_events_0.03-0.5_mantle_correlated_v3_revised.plp'] + infiles=['alparray_all_events_0.03-0.1_mantle_correlated_v3.plp'] for infile in infiles: - main(os.path.join(dataroot, infile), f_ext='_correlated_0.5Hz', ncores=20) + main(os.path.join(dataroot, infile), f_ext='_correlated_0.1Hz', ncores=10) #main('E:\Shared\AlpArray\\test_aa.plp', f_ext='_correlated_0.5Hz', ncores=1) #main('/home/marcel/alparray_m6.5-6.9_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz') diff --git a/pylot/core/util/gui.py b/pylot/core/util/gui.py index 11967bb8..6119af96 100644 --- a/pylot/core/util/gui.py +++ b/pylot/core/util/gui.py @@ -1,8 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- import os -import pyqtgraph as pg -from PySide import QtCore + +try: + import pyqtgraph as pg +except Exception as e: + print('Warning: Could not import module pyqtgraph.') +try: + from PySide import QtCore +except Exception as e: + print('Warning: Could not import module QtCore.') + from pylot.core.util.utils import pick_color diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index a741a01e..6c8dde50 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -57,6 +57,7 @@ from autoPyLoT import autoPyLoT from pylot.core.util.thread import Thread from pylot.core.util.dataprocessing import Metadata + if sys.version_info.major == 3: import icons_rc_3 as icons_rc elif sys.version_info.major == 2: @@ -4473,7 +4474,7 @@ class PropertiesDlg(QDialog): self.setWindowTitle("PyLoT Properties") self.tabWidget = QTabWidget() - self.tabWidget.addTab(InputsTab(self), "Inputs") + self.tabWidget.addTab(InputsTab(self), "Main") # self.tabWidget.addTab(OutputsTab(self), "Outputs") self.tabWidget.addTab(PhasesTab(self, inputs), "Phases") self.tabWidget.addTab(GraphicsTab(self), "Graphics") @@ -4608,6 +4609,7 @@ class InputsTab(PropTab): self.structureSelect = QComboBox() self.cutLabel = QLabel self.cuttimesLayout = QHBoxLayout() + self.autosaveXML_checkbox = QCheckBox() self.tstartBox = QSpinBox() self.tstopBox = QSpinBox() for spinbox in [self.tstartBox, self.tstopBox]: @@ -4619,6 +4621,8 @@ class InputsTab(PropTab): self.cuttimesLayout.addWidget(self.tstopBox, 10) self.cuttimesLayout.addWidget(QLabel('[s]'), 0) + + from pylot.core.util.structure import DATASTRUCTURE self.structureSelect.addItems(list(DATASTRUCTURE.keys())) @@ -4632,6 +4636,7 @@ class InputsTab(PropTab): layout.addRow("Full name for user '{0}': ".format(pylot_user), self.fullNameEdit) layout.addRow("Data structure: ", self.structureSelect) layout.addRow('Cut waveforms between (relative to source origin time if given): ', self.cuttimesLayout) + layout.addRow('Automatically save events as XML when saving Project: ', self.autosaveXML_checkbox) self.setLayout(layout) self.connectSignals() @@ -4641,6 +4646,7 @@ class InputsTab(PropTab): self.tstopBox.valueChanged.connect(self.checkSpinboxStart) self.tstartBox.valueChanged.connect(self.setDirty) self.tstopBox.valueChanged.connect(self.setDirty) + self.autosaveXML_checkbox.stateChanged.connect(self.setDirty) def setDirty(self): self.dirty = 2 @@ -4658,7 +4664,8 @@ class InputsTab(PropTab): "user/FullName": self.fullNameEdit.text(), "data/Structure": self.structureSelect.currentText(), "tstart": self.tstartBox.value(), - "tstop": self.tstopBox.value()} + "tstop": self.tstopBox.value(), + "autosaveXML": self.autosaveXML_checkbox.isChecked()} return values def resetValues(self, infile): @@ -4668,15 +4675,18 @@ class InputsTab(PropTab): index = 0 else: index = 2 - datapath = para.get('datapath') - rootpath = para.get('rootpath') - database = para.get('database') + datapath = para.get('datapath') if not para.get('datapath') is None else '' + rootpath = para.get('rootpath') if not para.get('rootpath') is None else '' + database = para.get('database') if not para.get('database') is None else '' if isinstance(database, int): database = str(database) path = os.path.join(os.path.expanduser('~'), rootpath, datapath, database) values = {"data/dataRoot": self.dataDirEdit.setText("%s" % path), "user/FullName": self.fullNameEdit.text(), - "data/Structure": self.structureSelect.setCurrentIndex(index)} + "data/Structure": self.structureSelect.setCurrentIndex(index), + "tstart": self.tstartBox.setValue(0), + "tstop": self.tstopBox.setValue(10000.), + "autosaveXML": self.autosaveXML_checkbox.setChecked(True),} return values @@ -4726,7 +4736,9 @@ class PhasesTab(PropTab): self.pickDefaultsButton = QtGui.QPushButton('Choose default phases...') PphasesLabel = QLabel("P Phases to pick") SphasesLabel = QLabel("S Phases to pick") - notes_label = QLabel('Note: Selected phases only apply on manual picking. ') + notes_label = QLabel( + 'Note: Only for manual picking. ' + 'Defaults depend on parameter "Array extent"') settings = QSettings() Pphases = settings.value('p_phases')