[update] some smaller changes in GUI and array_map
This commit is contained in:
parent
492f5b96f2
commit
78eca1b222
20
PyLoT.py
20
PyLoT.py
@ -30,6 +30,8 @@ import platform
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import traceback
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@ -1546,6 +1548,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.dump_deleted_picks(event.path)
|
self.dump_deleted_picks(event.path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('WARNING! Could not save information on deleted picks {}. Reason: {}'.format(event.path, e))
|
print('WARNING! Could not save information on deleted picks {}. Reason: {}'.format(event.path, e))
|
||||||
|
print(traceback.format_exc())
|
||||||
try:
|
try:
|
||||||
self.saveData(event, event.path, outformats)
|
self.saveData(event, event.path, outformats)
|
||||||
event.dirty = False
|
event.dirty = False
|
||||||
@ -1712,7 +1715,6 @@ class MainWindow(QMainWindow):
|
|||||||
self.test_event_button.setChecked(False)
|
self.test_event_button.setChecked(False)
|
||||||
self.get_current_event().setTestEvent(False)
|
self.get_current_event().setTestEvent(False)
|
||||||
self.get_current_event().setRefEvent(ref)
|
self.get_current_event().setRefEvent(ref)
|
||||||
self.fill_eventbox()
|
|
||||||
self.refreshTabs()
|
self.refreshTabs()
|
||||||
if self.tap:
|
if self.tap:
|
||||||
self.tap.fill_eventbox()
|
self.tap.fill_eventbox()
|
||||||
@ -1725,7 +1727,6 @@ class MainWindow(QMainWindow):
|
|||||||
self.ref_event_button.setChecked(False)
|
self.ref_event_button.setChecked(False)
|
||||||
self.get_current_event().setRefEvent(False)
|
self.get_current_event().setRefEvent(False)
|
||||||
self.get_current_event().setTestEvent(test)
|
self.get_current_event().setTestEvent(test)
|
||||||
self.fill_eventbox()
|
|
||||||
self.refreshTabs()
|
self.refreshTabs()
|
||||||
if self.tap:
|
if self.tap:
|
||||||
self.tap.fill_eventbox()
|
self.tap.fill_eventbox()
|
||||||
@ -1771,6 +1772,7 @@ class MainWindow(QMainWindow):
|
|||||||
# Loading an existing project from array_tab leads to two calls of newWF
|
# Loading an existing project from array_tab leads to two calls of newWF
|
||||||
# which will read in data input twice. Therefore current tab is changed to 0
|
# which will read in data input twice. Therefore current tab is changed to 0
|
||||||
# in loadProject before calling this function.
|
# in loadProject before calling this function.
|
||||||
|
self.fill_eventbox()
|
||||||
plotted = False
|
plotted = False
|
||||||
if self.tabs.currentIndex() == 2:
|
if self.tabs.currentIndex() == 2:
|
||||||
self.init_event_table()
|
self.init_event_table()
|
||||||
@ -1793,7 +1795,6 @@ class MainWindow(QMainWindow):
|
|||||||
if self.tabs.currentIndex() == 1:
|
if self.tabs.currentIndex() == 1:
|
||||||
if self._eventChanged[1]:
|
if self._eventChanged[1]:
|
||||||
self.refresh_array_map()
|
self.refresh_array_map()
|
||||||
self.fill_eventbox()
|
|
||||||
if not plotted and self._eventChanged[0]:
|
if not plotted and self._eventChanged[0]:
|
||||||
# newWF(plot=False) = load data without plotting
|
# newWF(plot=False) = load data without plotting
|
||||||
self.newWF(plot=False)
|
self.newWF(plot=False)
|
||||||
@ -2805,7 +2806,9 @@ class MainWindow(QMainWindow):
|
|||||||
' Check deleted picks file in path {} before continuing'
|
' Check deleted picks file in path {} before continuing'
|
||||||
print(msg.format(e, event_path))
|
print(msg.format(e, event_path))
|
||||||
self.safetyCopy(event_path)
|
self.safetyCopy(event_path)
|
||||||
deleted_picks_event = self.deleted_picks[event_path]
|
deleted_picks_event = self.deleted_picks.get(event_path)
|
||||||
|
if deleted_picks_event is None:
|
||||||
|
return
|
||||||
|
|
||||||
for pick in deleted_picks_from_file:
|
for pick in deleted_picks_from_file:
|
||||||
if not pick in deleted_picks_event:
|
if not pick in deleted_picks_event:
|
||||||
@ -3270,11 +3273,11 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
item_test.setCheckState(QtCore.Qt.Unchecked)
|
item_test.setCheckState(QtCore.Qt.Unchecked)
|
||||||
|
|
||||||
column = [item_delete, item_path, item_time, item_lat, item_lon, item_depth, item_mag,
|
row = [item_delete, item_path, item_time, item_lat, item_lon, item_depth, item_mag,
|
||||||
item_nmp, item_nap, item_ref, item_test, item_notes]
|
item_nmp, item_nap, item_ref, item_test, item_notes]
|
||||||
self.project._table.append(column)
|
self.project._table.append(row)
|
||||||
|
|
||||||
self.setItemColor(column, index, event, current_event)
|
self.setItemColor(row, index, event, current_event)
|
||||||
|
|
||||||
if event == current_event:
|
if event == current_event:
|
||||||
scroll_item = item_path
|
scroll_item = item_path
|
||||||
@ -3662,7 +3665,8 @@ class MainWindow(QMainWindow):
|
|||||||
for index, pick in reversed(list(enumerate(event.picks))):
|
for index, pick in reversed(list(enumerate(event.picks))):
|
||||||
if pick.method_id.id.endswith('auto'):
|
if pick.method_id.id.endswith('auto'):
|
||||||
event.picks.pop(index)
|
event.picks.pop(index)
|
||||||
self.refreshEvents()
|
self.plotWaveformDataThread()
|
||||||
|
self.refreshTabs()
|
||||||
|
|
||||||
|
|
||||||
def PyLoTprefs(self):
|
def PyLoTprefs(self):
|
||||||
|
@ -409,7 +409,7 @@ class Array_map(QtGui.QWidget):
|
|||||||
|
|
||||||
levels = np.linspace(self.get_min_from_picks(), self.get_max_from_picks(), nlevel)
|
levels = np.linspace(self.get_min_from_picks(), self.get_max_from_picks(), nlevel)
|
||||||
self.contourf = self.basemap.contour(self.longrid, self.latgrid, self.picksgrid_active, levels,
|
self.contourf = self.basemap.contour(self.longrid, self.latgrid, self.picksgrid_active, levels,
|
||||||
linewidths=self.linewidth, latlon=True, zorder=9, alpha=0.7,
|
linewidths=self.linewidth, latlon=True, zorder=8, alpha=0.7,
|
||||||
cmap=self.get_colormap())
|
cmap=self.get_colormap())
|
||||||
|
|
||||||
def get_colormap(self):
|
def get_colormap(self):
|
||||||
@ -502,7 +502,7 @@ class Array_map(QtGui.QWidget):
|
|||||||
if st in self.marked_stations:
|
if st in self.marked_stations:
|
||||||
color = 'red'
|
color = 'red'
|
||||||
self.annotations.append(self.main_ax.annotate(' %s' % st, xy=(x, y),
|
self.annotations.append(self.main_ax.annotate(' %s' % st, xy=(x, y),
|
||||||
fontsize=self.pointsize/6., fontweight='semibold',
|
fontsize=self.pointsize/4., fontweight='semibold',
|
||||||
color=color, zorder=14))
|
color=color, zorder=14))
|
||||||
self.legend = self.main_ax.legend(loc=1)
|
self.legend = self.main_ax.legend(loc=1)
|
||||||
self.legend.get_frame().set_facecolor((1, 1, 1, 0.75))
|
self.legend.get_frame().set_facecolor((1, 1, 1, 0.75))
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
# small script that creates array maps for each event within a previously generated PyLoT project
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
@ -42,12 +43,14 @@ def array_map_worker(input_dict):
|
|||||||
autopicks = event.getAutopicks()
|
autopicks = event.getAutopicks()
|
||||||
# prepare event and get metadata
|
# prepare event and get metadata
|
||||||
metadata_path = os.path.join(eventdir, 'resp')
|
metadata_path = os.path.join(eventdir, 'resp')
|
||||||
metadata = Metadata(inventory=metadata_path, verbosity=0)
|
metadata = None
|
||||||
for pick_type in ['manual', 'auto']:
|
for pick_type in ['manual', 'auto']:
|
||||||
if pick_type == 'manual' and (not manualpicks or not input_dict['manual']):
|
if pick_type == 'manual' and (not manualpicks or not input_dict['manual']):
|
||||||
continue
|
continue
|
||||||
if pick_type == 'auto' and (not autopicks or not input_dict['auto']):
|
if pick_type == 'auto' and (not autopicks or not input_dict['auto']):
|
||||||
continue
|
continue
|
||||||
|
if not metadata:
|
||||||
|
metadata = Metadata(inventory=metadata_path, verbosity=0)
|
||||||
# create figure to plot on
|
# create figure to plot on
|
||||||
fig = plt.figure(figsize=(16,9))
|
fig = plt.figure(figsize=(16,9))
|
||||||
# create array map object
|
# create array map object
|
||||||
@ -63,6 +66,10 @@ def array_map_worker(input_dict):
|
|||||||
print('Wrote file: {}'.format(fpath_out))
|
print('Wrote file: {}'.format(fpath_out))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main('/home/marcel/alparray_m6.0-6.4_mantle_correlated_v3.plp', f_ext='_correlated_0.5Hz', ncores=40)
|
dataroot = '/home/marcel'
|
||||||
|
infiles=['alparray_all_events_0.03-0.5_mantle_correlated_v3_revised.plp']
|
||||||
|
|
||||||
|
for infile in infiles:
|
||||||
|
main(os.path.join(dataroot, infile), f_ext='_correlated_0.5Hz', ncores=20)
|
||||||
#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')
|
||||||
|
Loading…
Reference in New Issue
Block a user