[various] fixes on array_map
This commit is contained in:
parent
fa093ccac6
commit
7187cb337b
11
PyLoT.py
11
PyLoT.py
@ -1293,12 +1293,15 @@ class MainWindow(QMainWindow):
|
|||||||
paths_exist = [os.path.exists(event.path) for event in self.project.eventlist]
|
paths_exist = [os.path.exists(event.path) for event in self.project.eventlist]
|
||||||
if all(paths_exist):
|
if all(paths_exist):
|
||||||
return True
|
return True
|
||||||
|
elif not any(paths_exist):
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
info_str = ''
|
info_str = ''
|
||||||
for event, path_exists in zip(self.project.eventlist, paths_exist):
|
for event, path_exists in zip(self.project.eventlist, paths_exist):
|
||||||
|
if not path_exists:
|
||||||
info_str += '\n{} exists: {}'.format(event.path, path_exists)
|
info_str += '\n{} exists: {}'.format(event.path, path_exists)
|
||||||
print('Unable to find certain event paths:{}'.format(info_str))
|
print('Unable to find certain event paths:{}'.format(info_str))
|
||||||
return False
|
return True
|
||||||
|
|
||||||
def modify_project_path(self, new_rootpath):
|
def modify_project_path(self, new_rootpath):
|
||||||
self.project.rootpath = new_rootpath
|
self.project.rootpath = new_rootpath
|
||||||
@ -3581,6 +3584,9 @@ class MainWindow(QMainWindow):
|
|||||||
if not filename.split('.')[-1] == 'plp':
|
if not filename.split('.')[-1] == 'plp':
|
||||||
filename = fnm[0] + '.plp'
|
filename = fnm[0] + '.plp'
|
||||||
self.project.parameter = self._inputs
|
self.project.parameter = self._inputs
|
||||||
|
settings = QSettings()
|
||||||
|
autosaveXML = get_Bool(settings.value('autosaveXML', True))
|
||||||
|
if autosaveXML:
|
||||||
self.exportEvents()
|
self.exportEvents()
|
||||||
self.project.save(filename)
|
self.project.save(filename)
|
||||||
self.setDirty(False)
|
self.setDirty(False)
|
||||||
@ -3602,6 +3608,9 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
self.metadata.clear_inventory()
|
self.metadata.clear_inventory()
|
||||||
self.project.parameter = self._inputs
|
self.project.parameter = self._inputs
|
||||||
|
settings = QSettings()
|
||||||
|
autosaveXML = get_Bool(settings.value('autosaveXML', True))
|
||||||
|
if autosaveXML:
|
||||||
self.exportEvents()
|
self.exportEvents()
|
||||||
self.project.save()
|
self.project.save()
|
||||||
self.update_obspy_dmt()
|
self.update_obspy_dmt()
|
||||||
|
@ -349,11 +349,11 @@ class Array_map(QtGui.QWidget):
|
|||||||
parallels = np.arange(-90, 90, 5.)
|
parallels = np.arange(-90, 90, 5.)
|
||||||
parallels_small = np.arange(-90, 90, 2.5)
|
parallels_small = np.arange(-90, 90, 2.5)
|
||||||
basemap.drawparallels(parallels_small, linewidth=0.5, zorder=7)
|
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 = np.arange(-180, 180, 5.)
|
||||||
meridians_small = np.arange(-180, 180, 2.5)
|
meridians_small = np.arange(-180, 180, 2.5)
|
||||||
basemap.drawmeridians(meridians_small, linewidth=0.5, zorder=7)
|
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.basemap = basemap
|
||||||
self.figure._tight = True
|
self.figure._tight = True
|
||||||
self.figure.tight_layout()
|
self.figure.tight_layout()
|
||||||
|
@ -67,9 +67,9 @@ def array_map_worker(input_dict):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
dataroot = '/home/marcel'
|
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:
|
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('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')
|
#main('/home/marcel/alparray_m6.5-6.9_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz')
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import os
|
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
|
from pylot.core.util.utils import pick_color
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ from autoPyLoT import autoPyLoT
|
|||||||
from pylot.core.util.thread import Thread
|
from pylot.core.util.thread import Thread
|
||||||
from pylot.core.util.dataprocessing import Metadata
|
from pylot.core.util.dataprocessing import Metadata
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info.major == 3:
|
if sys.version_info.major == 3:
|
||||||
import icons_rc_3 as icons_rc
|
import icons_rc_3 as icons_rc
|
||||||
elif sys.version_info.major == 2:
|
elif sys.version_info.major == 2:
|
||||||
@ -4473,7 +4474,7 @@ class PropertiesDlg(QDialog):
|
|||||||
|
|
||||||
self.setWindowTitle("PyLoT Properties")
|
self.setWindowTitle("PyLoT Properties")
|
||||||
self.tabWidget = QTabWidget()
|
self.tabWidget = QTabWidget()
|
||||||
self.tabWidget.addTab(InputsTab(self), "Inputs")
|
self.tabWidget.addTab(InputsTab(self), "Main")
|
||||||
# self.tabWidget.addTab(OutputsTab(self), "Outputs")
|
# self.tabWidget.addTab(OutputsTab(self), "Outputs")
|
||||||
self.tabWidget.addTab(PhasesTab(self, inputs), "Phases")
|
self.tabWidget.addTab(PhasesTab(self, inputs), "Phases")
|
||||||
self.tabWidget.addTab(GraphicsTab(self), "Graphics")
|
self.tabWidget.addTab(GraphicsTab(self), "Graphics")
|
||||||
@ -4608,6 +4609,7 @@ class InputsTab(PropTab):
|
|||||||
self.structureSelect = QComboBox()
|
self.structureSelect = QComboBox()
|
||||||
self.cutLabel = QLabel
|
self.cutLabel = QLabel
|
||||||
self.cuttimesLayout = QHBoxLayout()
|
self.cuttimesLayout = QHBoxLayout()
|
||||||
|
self.autosaveXML_checkbox = QCheckBox()
|
||||||
self.tstartBox = QSpinBox()
|
self.tstartBox = QSpinBox()
|
||||||
self.tstopBox = QSpinBox()
|
self.tstopBox = QSpinBox()
|
||||||
for spinbox in [self.tstartBox, self.tstopBox]:
|
for spinbox in [self.tstartBox, self.tstopBox]:
|
||||||
@ -4619,6 +4621,8 @@ class InputsTab(PropTab):
|
|||||||
self.cuttimesLayout.addWidget(self.tstopBox, 10)
|
self.cuttimesLayout.addWidget(self.tstopBox, 10)
|
||||||
self.cuttimesLayout.addWidget(QLabel('[s]'), 0)
|
self.cuttimesLayout.addWidget(QLabel('[s]'), 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
|
|
||||||
self.structureSelect.addItems(list(DATASTRUCTURE.keys()))
|
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("Full name for user '{0}': ".format(pylot_user), self.fullNameEdit)
|
||||||
layout.addRow("Data structure: ", self.structureSelect)
|
layout.addRow("Data structure: ", self.structureSelect)
|
||||||
layout.addRow('Cut waveforms between (relative to source origin time if given): ', self.cuttimesLayout)
|
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.setLayout(layout)
|
||||||
self.connectSignals()
|
self.connectSignals()
|
||||||
@ -4641,6 +4646,7 @@ class InputsTab(PropTab):
|
|||||||
self.tstopBox.valueChanged.connect(self.checkSpinboxStart)
|
self.tstopBox.valueChanged.connect(self.checkSpinboxStart)
|
||||||
self.tstartBox.valueChanged.connect(self.setDirty)
|
self.tstartBox.valueChanged.connect(self.setDirty)
|
||||||
self.tstopBox.valueChanged.connect(self.setDirty)
|
self.tstopBox.valueChanged.connect(self.setDirty)
|
||||||
|
self.autosaveXML_checkbox.stateChanged.connect(self.setDirty)
|
||||||
|
|
||||||
def setDirty(self):
|
def setDirty(self):
|
||||||
self.dirty = 2
|
self.dirty = 2
|
||||||
@ -4658,7 +4664,8 @@ class InputsTab(PropTab):
|
|||||||
"user/FullName": self.fullNameEdit.text(),
|
"user/FullName": self.fullNameEdit.text(),
|
||||||
"data/Structure": self.structureSelect.currentText(),
|
"data/Structure": self.structureSelect.currentText(),
|
||||||
"tstart": self.tstartBox.value(),
|
"tstart": self.tstartBox.value(),
|
||||||
"tstop": self.tstopBox.value()}
|
"tstop": self.tstopBox.value(),
|
||||||
|
"autosaveXML": self.autosaveXML_checkbox.isChecked()}
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def resetValues(self, infile):
|
def resetValues(self, infile):
|
||||||
@ -4668,15 +4675,18 @@ class InputsTab(PropTab):
|
|||||||
index = 0
|
index = 0
|
||||||
else:
|
else:
|
||||||
index = 2
|
index = 2
|
||||||
datapath = para.get('datapath')
|
datapath = para.get('datapath') if not para.get('datapath') is None else ''
|
||||||
rootpath = para.get('rootpath')
|
rootpath = para.get('rootpath') if not para.get('rootpath') is None else ''
|
||||||
database = para.get('database')
|
database = para.get('database') if not para.get('database') is None else ''
|
||||||
if isinstance(database, int):
|
if isinstance(database, int):
|
||||||
database = str(database)
|
database = str(database)
|
||||||
path = os.path.join(os.path.expanduser('~'), rootpath, datapath, database)
|
path = os.path.join(os.path.expanduser('~'), rootpath, datapath, database)
|
||||||
values = {"data/dataRoot": self.dataDirEdit.setText("%s" % path),
|
values = {"data/dataRoot": self.dataDirEdit.setText("%s" % path),
|
||||||
"user/FullName": self.fullNameEdit.text(),
|
"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
|
return values
|
||||||
|
|
||||||
|
|
||||||
@ -4726,7 +4736,9 @@ class PhasesTab(PropTab):
|
|||||||
self.pickDefaultsButton = QtGui.QPushButton('Choose default phases...')
|
self.pickDefaultsButton = QtGui.QPushButton('Choose default phases...')
|
||||||
PphasesLabel = QLabel("P Phases to pick")
|
PphasesLabel = QLabel("P Phases to pick")
|
||||||
SphasesLabel = QLabel("S 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()
|
settings = QSettings()
|
||||||
Pphases = settings.value('p_phases')
|
Pphases = settings.value('p_phases')
|
||||||
|
Loading…
Reference in New Issue
Block a user