New function to get quality classes from uncertainties, plot only automatic picks, if pick qualities are less than 4.
This commit is contained in:
		
							parent
							
								
									bd37b60dcb
								
							
						
					
					
						commit
						f393585831
					
				
							
								
								
									
										20
									
								
								QtPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								QtPyLoT.py
									
									
									
									
									
								
							| @ -64,7 +64,7 @@ from pylot.core.io.data import Data | |||||||
| from pylot.core.io.inputs import FilterOptions, PylotParameter | from pylot.core.io.inputs import FilterOptions, PylotParameter | ||||||
| from autoPyLoT import autoPyLoT | from autoPyLoT import autoPyLoT | ||||||
| from pylot.core.pick.compare import Comparison | from pylot.core.pick.compare import Comparison | ||||||
| from pylot.core.pick.utils import symmetrize_error | from pylot.core.pick.utils import symmetrize_error, getQualityfromUncertainty | ||||||
| from pylot.core.io.phases import picksdict_from_picks | from pylot.core.io.phases import picksdict_from_picks | ||||||
| import pylot.core.loc.nll as nll | import pylot.core.loc.nll as nll | ||||||
| from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents | from pylot.core.util.defaults import FILTERDEFAULTS, SetChannelComponents | ||||||
| @ -1951,13 +1951,19 @@ class MainWindow(QMainWindow): | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|         stat_picks = self.getPicks(type=picktype)[station] |         stat_picks = self.getPicks(type=picktype)[station] | ||||||
| 
 |  | ||||||
|         stime = self.getStime() |         stime = self.getStime() | ||||||
| 
 | 
 | ||||||
|         for phase in stat_picks: |         for phase in stat_picks: | ||||||
|             picks = stat_picks[phase] |             picks = stat_picks[phase] | ||||||
|             if type(stat_picks[phase]) is not dict and type(stat_picks[phase]) is not AttribDict: |             if type(stat_picks[phase]) is not dict and type(stat_picks[phase]) is not AttribDict: | ||||||
|                 return |                 return | ||||||
|  | 
 | ||||||
|  |             # get quality classes | ||||||
|  |             if phase[0] == 'P': | ||||||
|  |                 quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsP']) | ||||||
|  |             elif phase[0] == 'S': | ||||||
|  |                 quality = getQualityfromUncertainty(picks['spe'], self._inputs['timeerrorsS']) | ||||||
|  | 
 | ||||||
|             colors = phase_col[phase[0].upper()] |             colors = phase_col[phase[0].upper()] | ||||||
| 
 | 
 | ||||||
|             mpp = picks['mpp'] - stime |             mpp = picks['mpp'] - stime | ||||||
| @ -1994,7 +2000,8 @@ class MainWindow(QMainWindow): | |||||||
|                     else: |                     else: | ||||||
|                         pw.plot([mpp, mpp], ylims, pen=colors[0], name='{}-Pick (NO PICKERROR)'.format(phase)) |                         pw.plot([mpp, mpp], ylims, pen=colors[0], name='{}-Pick (NO PICKERROR)'.format(phase)) | ||||||
|                 elif picktype == 'auto': |                 elif picktype == 'auto': | ||||||
|                     pw.plot([mpp, mpp], ylims, pen=colors[3]) |                     if quality < 4: | ||||||
|  |                         pw.plot([mpp, mpp], ylims, pen=colors[3]) | ||||||
|                 else: |                 else: | ||||||
|                     raise TypeError('Unknown picktype {0}'.format(picktype)) |                     raise TypeError('Unknown picktype {0}'.format(picktype)) | ||||||
|             else: |             else: | ||||||
| @ -2009,9 +2016,10 @@ class MainWindow(QMainWindow): | |||||||
|                     else: |                     else: | ||||||
|                         ax.plot([mpp, mpp], ylims, colors[6], label='{}-Pick (NO PICKERROR)'.format(phase)) |                         ax.plot([mpp, mpp], ylims, colors[6], label='{}-Pick (NO PICKERROR)'.format(phase)) | ||||||
|                 elif picktype == 'auto': |                 elif picktype == 'auto': | ||||||
|                     ax.plot(mpp, ylims[1], colors[3], |                     if quality < 4: | ||||||
|                             mpp, ylims[0], colors[4]) |                         ax.plot(mpp, ylims[1], colors[3], | ||||||
|                     ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dotted') |                                 mpp, ylims[0], colors[4]) | ||||||
|  |                         ax.vlines(mpp, ylims[0], ylims[1], colors[5], linestyles='dotted') | ||||||
|                 else: |                 else: | ||||||
|                     raise TypeError('Unknown picktype {0}'.format(picktype)) |                     raise TypeError('Unknown picktype {0}'.format(picktype)) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1069,6 +1069,31 @@ def checkZ4S(X, pick, zfac, checkwin, iplot, fig=None): | |||||||
|         ax.set_xlabel('Time [s] since %s' % zdat[0].stats.starttime) |         ax.set_xlabel('Time [s] since %s' % zdat[0].stats.starttime) | ||||||
|     return returnflag |     return returnflag | ||||||
| 
 | 
 | ||||||
|  | def getQualityfromUncertainty(uncertainty, Errors): | ||||||
|  |     '''Script to transform uncertainty into quality classes 0-4 | ||||||
|  |        regarding adjusted time errors Errors. | ||||||
|  |     ''' | ||||||
|  | 
 | ||||||
|  |     if uncertainty == None or uncertainty == 'None': | ||||||
|  |        quality = 4 | ||||||
|  |     else: | ||||||
|  |         if uncertainty <= Errors[0]: | ||||||
|  |             quality = 0 | ||||||
|  |         elif (uncertainty > Errors[0]) and \ | ||||||
|  |              (uncertainty < Errors[1]): | ||||||
|  |             quality = 1 | ||||||
|  |         elif (uncertainty > Errors[1]) and \ | ||||||
|  |              (uncertainty < Errors[2]): | ||||||
|  |             quality = 2 | ||||||
|  |         elif (uncertainty > Errors[2]) and \ | ||||||
|  |              (uncertainty < Errors[3]): | ||||||
|  |             quality = 3 | ||||||
|  |         elif uncertainty > Errors[3]: | ||||||
|  |             quality = 4 | ||||||
|  |         else: | ||||||
|  |             pass | ||||||
|  | 
 | ||||||
|  |     return quality | ||||||
| 
 | 
 | ||||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||||
|     import doctest |     import doctest | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user