WIP autopick parameters
to do: save/load/station+trace selection
This commit is contained in:
		
							parent
							
								
									dc656e5c57
								
							
						
					
					
						commit
						6847bfe8c4
					
				
							
								
								
									
										12
									
								
								QtPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								QtPyLoT.py
									
									
									
									
									
								
							| @ -962,7 +962,6 @@ class MainWindow(QMainWindow): | ||||
|         if event.autopicks: | ||||
|             self.autopicks = event.autopicks | ||||
|             self.drawPicks(picktype='auto') | ||||
|             self.compare_action.setEnabled(True) | ||||
|         self.draw() | ||||
| 
 | ||||
|     def clearWaveformDataPlot(self): | ||||
| @ -1342,8 +1341,14 @@ class MainWindow(QMainWindow): | ||||
|      | ||||
|     def init_array_map(self, index=1): | ||||
|         self.tabs.setCurrentIndex(1) | ||||
|         self.array_layout.removeWidget(self.metadata_widget) | ||||
|         self.array_layout.removeWidget(self.array_map) | ||||
|         if hasattr(self, 'metadata_widget'): | ||||
|             if self.metadata_widget: | ||||
|                 self.metadata_widget.setParent(None) | ||||
|                 self.array_layout.removeWidget(self.metadata_widget) | ||||
|         if hasattr(self, 'array_map'): | ||||
|             if self.array_map: | ||||
|                 self.array_map.setParent(None)         | ||||
|                 self.array_layout.removeWidget(self.array_map) | ||||
|         if not self.array_map: | ||||
|             self.get_metadata() | ||||
|             if not self.metadata: | ||||
| @ -1399,6 +1404,7 @@ class MainWindow(QMainWindow): | ||||
|                 self.fill_eventbox() | ||||
| 
 | ||||
|         if hasattr(self, 'qtl'): | ||||
|             self.qtl.setParent(None) | ||||
|             self.events_layout.removeWidget(self.qtl) | ||||
|         self.qtl = QtGui.QTableWidget() | ||||
|         self.qtl.setColumnCount(6) | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| d96b-dirty | ||||
| dc65-dirty | ||||
|  | ||||
| @ -38,6 +38,7 @@ from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, LOCTOOLS, \ | ||||
|     COMPPOSITION_MAP | ||||
| from pylot.core.util.utils import prepTimeAxis, full_range, scaleWFData, \ | ||||
|     demeanTrace, isSorted, findComboBoxIndex, clims | ||||
| from autoPyLoT import autoPyLoT | ||||
| import icons_rc | ||||
| 
 | ||||
| def getDataType(parent): | ||||
| @ -1269,44 +1270,67 @@ class PickDlg(QDialog): | ||||
| 
 | ||||
|          | ||||
| class TuneAutopicker(QWidget):      | ||||
|     def __init__(self, fig_dict, station, ap, parent=None): | ||||
|     def __init__(self, ap, parent=None): | ||||
|         QtGui.QWidget.__init__(self, parent) | ||||
|         if not station in fig_dict: | ||||
|             print('Station not found') | ||||
|             return | ||||
|         self.ap = ap | ||||
|         self.fd = fig_dict[station] | ||||
|         self.station = 'AH11' | ||||
|         self.fd = None | ||||
|         self.layout = QtGui.QHBoxLayout() | ||||
|         self.parameter_layout = QtGui.QVBoxLayout() | ||||
|         self.setLayout(self.layout) | ||||
|         self.init_figure_tabs() | ||||
|         self.add_parameter() | ||||
|         self.layout.setStretch(0,3) | ||||
|         self.layout.setStretch(1,1)         | ||||
|          | ||||
|         self.add_buttons() | ||||
|         self.set_stretch() | ||||
| 
 | ||||
|     def init_figure_tabs(self): | ||||
|         self.main_tabs = QtGui.QTabWidget() | ||||
|         self.p_tabs = QtGui.QTabWidget() | ||||
|         self.s_tabs = QtGui.QTabWidget() | ||||
|         self.layout.addWidget(self.main_tabs) | ||||
|         self.layout.insertWidget(0, self.main_tabs) | ||||
|         self.init_tab_names() | ||||
|         self.fill_tabs() | ||||
| 
 | ||||
|     def add_parameter(self): | ||||
|         self.parameters = AutoPickParaBox(self.ap) | ||||
|         self.layout.addWidget(self.parameters) | ||||
|         self.parameter_layout.addWidget(self.parameters) | ||||
|         self.layout.insertLayout(1, self.parameter_layout) | ||||
| 
 | ||||
|     def add_buttons(self): | ||||
|         self.pick_button = QtGui.QPushButton('Pick Trace') | ||||
|         self.pick_button.clicked.connect(self.call_picker) | ||||
|         self.parameter_layout.addWidget(self.pick_button) | ||||
| 
 | ||||
|     def call_picker(self): | ||||
|         self.parameters.update_params() | ||||
|         picks, fig_dict = autoPyLoT(self.ap, fnames='None', iplot=2) | ||||
|         self.main_tabs.setParent(None) | ||||
|         self.fd = fig_dict[self.station] | ||||
|         self.init_figure_tabs() | ||||
|         self.set_stretch() | ||||
| 
 | ||||
|     def set_stretch(self): | ||||
|         self.layout.setStretch(0, 3) | ||||
|         self.layout.setStretch(1, 1)         | ||||
|          | ||||
|     def init_tab_names(self): | ||||
|         self.ptb_names = ['aicFig', 'slenght', 'checkZ4S', 'refPpick', 'el_Ppick', 'fm_picker'] | ||||
|         self.stb_names = ['aicARHfig', 'refSpick', 'el_S1pick', 'el_S2pick'] | ||||
| 
 | ||||
|     def fill_tabs(self): | ||||
|         main_fig = self.fd['mainFig'] | ||||
|         self.main_tabs.addTab(main_fig.canvas, 'Overview') | ||||
|         try: | ||||
|             main_fig = self.fd['mainFig'] | ||||
|             self.main_tabs.addTab(main_fig.canvas, 'Overview') | ||||
|         except Exception as e: | ||||
|             self.main_tabs.addTab(QtGui.QWidget(), 'Overview')             | ||||
|         self.main_tabs.addTab(self.p_tabs, 'P') | ||||
|         self.main_tabs.addTab(self.s_tabs, 'S') | ||||
|         self.fill_p_tabs() | ||||
|         self.fill_s_tabs() | ||||
|         main_fig.tight_layout() | ||||
|         try: | ||||
|             main_fig.tight_layout() | ||||
|         except: | ||||
|             pass | ||||
| 
 | ||||
|     def fill_p_tabs(self): | ||||
|         for name in self.ptb_names: | ||||
| @ -1318,7 +1342,6 @@ class TuneAutopicker(QWidget): | ||||
|             except Exception as e: | ||||
|                 id = self.p_tabs.addTab(QtGui.QWidget(), name) | ||||
|                 self.p_tabs.setTabEnabled(id, False) | ||||
|                 print('Could not initiate figure {}.'.format(name)) | ||||
| 
 | ||||
|     def fill_s_tabs(self): | ||||
|         for name in self.stb_names: | ||||
| @ -1330,7 +1353,6 @@ class TuneAutopicker(QWidget): | ||||
|             except Exception as e: | ||||
|                 id = self.s_tabs.addTab(QtGui.QWidget(), name) | ||||
|                 self.s_tabs.setTabEnabled(id, False) | ||||
|                 print('Could not initiate figure {}.'.format(name)) | ||||
|              | ||||
|      | ||||
| class PropertiesDlg(QDialog): | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user