176 open event failure
This commit is contained in:
		
							parent
							
								
									81b95e6a22
								
							
						
					
					
						commit
						cc0b1e0a5b
					
				
							
								
								
									
										26
									
								
								QtPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								QtPyLoT.py
									
									
									
									
									
								
							| @ -36,7 +36,7 @@ from PySide.QtGui import QMainWindow, QInputDialog, QIcon, QFileDialog, \ | |||||||
|     QDialog, QErrorMessage, QApplication, QPixmap, QMessageBox, QSplashScreen, \ |     QDialog, QErrorMessage, QApplication, QPixmap, QMessageBox, QSplashScreen, \ | ||||||
|     QActionGroup, QListWidget, QDockWidget |     QActionGroup, QListWidget, QDockWidget | ||||||
| import numpy as np | import numpy as np | ||||||
| from obspy.core import UTCDateTime | from obspy import UTCDateTime, readEvents | ||||||
| 
 | 
 | ||||||
| from pylot.core.read.data import Data | from pylot.core.read.data import Data | ||||||
| from pylot.core.read.inputs import FilterOptions, AutoPickParameter | from pylot.core.read.inputs import FilterOptions, AutoPickParameter | ||||||
| @ -339,10 +339,9 @@ class MainWindow(QMainWindow): | |||||||
|         return settings.value("data/dataRoot") |         return settings.value("data/dataRoot") | ||||||
| 
 | 
 | ||||||
|     def loadData(self, fname=None): |     def loadData(self, fname=None): | ||||||
|  |         if not self.okToContinue(): | ||||||
|  |                 return | ||||||
|         if fname is None: |         if fname is None: | ||||||
|             try: |  | ||||||
|                 self.data = Data(self, evtdata=self.fname) |  | ||||||
|             except AttributeError: |  | ||||||
|             action = self.sender() |             action = self.sender() | ||||||
|             if isinstance(action, QAction): |             if isinstance(action, QAction): | ||||||
|                 if action.data() is None: |                 if action.data() is None: | ||||||
| @ -351,14 +350,14 @@ class MainWindow(QMainWindow): | |||||||
|                     fname = QFileDialog().getOpenFileName(self, |                     fname = QFileDialog().getOpenFileName(self, | ||||||
|                                                           caption=caption, |                                                           caption=caption, | ||||||
|                                                           filter=filt) |                                                           filter=filt) | ||||||
|                         self.fname = fname[0] |                     fname = fname[0] | ||||||
|                 else: |                 else: | ||||||
|                         self.fname = unicode(action.data().toString()) |                     fname = unicode(action.data().toString()) | ||||||
|                 if not self.okToContinue(): |         event = readEvents(fname)[0] | ||||||
|                     return |         self.setFileName(fname) | ||||||
|         else: |         self.getData().applyEVTData(event, type='event') | ||||||
|             self.fname = fname |         self.convertPicks4PyLoT() | ||||||
|             self.data = Data(self, evtdata=self.fname) |         self.drawPicks() | ||||||
| 
 | 
 | ||||||
|     def getLastEvent(self): |     def getLastEvent(self): | ||||||
|         return self.recentEvents[0] |         return self.recentEvents[0] | ||||||
| @ -694,6 +693,11 @@ class MainWindow(QMainWindow): | |||||||
|                 raise Exception('FATAL: Should never occur!') |                 raise Exception('FATAL: Should never occur!') | ||||||
|         self.getPicks()[station] = stat_picks |         self.getPicks()[station] = stat_picks | ||||||
| 
 | 
 | ||||||
|  |     def convertPicks4PyLoT(self): | ||||||
|  |         evt = self.getData().getEvtData() | ||||||
|  |         for pick in evt.picks: | ||||||
|  |             station = pick.waveform_id.getSEEDstring() | ||||||
|  | 
 | ||||||
|     def drawPicks(self, station=None): |     def drawPicks(self, station=None): | ||||||
|         # if picks to draw not specified, draw all picks available |         # if picks to draw not specified, draw all picks available | ||||||
|         if not station: |         if not station: | ||||||
|  | |||||||
| @ -1 +1 @@ | |||||||
| 0.0.0-gbf11 | 81b9-dirty | ||||||
|  | |||||||
| @ -417,7 +417,10 @@ class Data(object): | |||||||
| 
 | 
 | ||||||
|             :param event: |             :param event: | ||||||
|             """ |             """ | ||||||
|             pass |             if not self.evtdata: | ||||||
|  |                 self.evtdata = event | ||||||
|  |             else: | ||||||
|  |                 raise OverwriteError('Acutal event would be overwritten!') | ||||||
| 
 | 
 | ||||||
|         applydata = {'pick': applyPicks, |         applydata = {'pick': applyPicks, | ||||||
|                      'arrival': applyArrivals, |                      'arrival': applyArrivals, | ||||||
|  | |||||||
| @ -105,10 +105,10 @@ class MPLWidget(FigureCanvas): | |||||||
|                 for level in noiselevel: |                 for level in noiselevel: | ||||||
|                     self.getAxes().plot([time_ax[0], time_ax[-1]], |                     self.getAxes().plot([time_ax[0], time_ax[-1]], | ||||||
|                                         [level, level], '--k') |                                         [level, level], '--k') | ||||||
|  |             self.setPlotDict(n, (station, channel)) | ||||||
|         xlabel = 'seconds since {0}'.format(wfstart) |         xlabel = 'seconds since {0}'.format(wfstart) | ||||||
|         ylabel = '' |         ylabel = '' | ||||||
|         self.updateWidget(xlabel, ylabel, title) |         self.updateWidget(xlabel, ylabel, title) | ||||||
|             self.setPlotDict(n, (station, channel)) |  | ||||||
|         self.setXLims([0, wfend - wfstart]) |         self.setXLims([0, wfend - wfstart]) | ||||||
|         self.setYLims([-0.5, n + 0.5]) |         self.setYLims([-0.5, n + 0.5]) | ||||||
|         if zoomx is not None: |         if zoomx is not None: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user