Stabilized AICPicker: if no minimum was found, try 1st derivative of AIC-CF.
This commit is contained in:
		
							parent
							
								
									ea68b38f7e
								
							
						
					
					
						commit
						85f0445e6b
					
				@ -189,7 +189,7 @@ class AICPicker(AutoPicking):
 | 
				
			|||||||
        #remove offset
 | 
					        #remove offset
 | 
				
			||||||
        offset = abs(min(aic) - min(aicsmooth))
 | 
					        offset = abs(min(aic) - min(aicsmooth))
 | 
				
			||||||
        aicsmooth = aicsmooth - offset
 | 
					        aicsmooth = aicsmooth - offset
 | 
				
			||||||
        #get maximum of 1st derivative of CF (more stable!) as starting point
 | 
					        #get maximum of 1st derivative of AIC-CF (more stable!) as starting point
 | 
				
			||||||
        diffcf = np.diff(aicsmooth)
 | 
					        diffcf = np.diff(aicsmooth)
 | 
				
			||||||
        #find NaN's
 | 
					        #find NaN's
 | 
				
			||||||
        nn = np.isnan(diffcf)
 | 
					        nn = np.isnan(diffcf)
 | 
				
			||||||
@ -200,12 +200,19 @@ class AICPicker(AutoPicking):
 | 
				
			|||||||
        diffcf = tap * diffcf * max(abs(aicsmooth))
 | 
					        diffcf = tap * diffcf * max(abs(aicsmooth))
 | 
				
			||||||
        icfmax = np.argmax(diffcf)
 | 
					        icfmax = np.argmax(diffcf)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        #find minimum in front of maximum
 | 
					        #find minimum in AIC-CF front of maximum
 | 
				
			||||||
        lpickwindow = int(round(self.PickWindow / self.dt))
 | 
					        lpickwindow = int(round(self.PickWindow / self.dt))
 | 
				
			||||||
        for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1): 
 | 
					        for i in range(icfmax - 1, max([icfmax - lpickwindow, 2]), -1): 
 | 
				
			||||||
           if aicsmooth[i - 1] >= aicsmooth[i]:
 | 
					           if aicsmooth[i - 1] >= aicsmooth[i]:
 | 
				
			||||||
              self.Pick = self.Tcf[i]
 | 
					              self.Pick = self.Tcf[i]
 | 
				
			||||||
              break
 | 
					              break
 | 
				
			||||||
 | 
					        #if no minimum could be found:
 | 
				
			||||||
 | 
					        #search in 1st derivative of AIC-CF
 | 
				
			||||||
 | 
					        if self.Pick is None:
 | 
				
			||||||
 | 
					           for i in range(icfmax -1, max([icfmax -lpickwindow, 2]), -1):
 | 
				
			||||||
 | 
					              if diffcf[i -1] >= diffcf[i]:
 | 
				
			||||||
 | 
					                 self.Pick = self.Tcf[i]
 | 
				
			||||||
 | 
					                 break
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        #quality assessment using SNR and slope from CF
 | 
					        #quality assessment using SNR and slope from CF
 | 
				
			||||||
        if self.Pick is not None:
 | 
					        if self.Pick is not None:
 | 
				
			||||||
@ -233,7 +240,6 @@ class AICPicker(AutoPicking):
 | 
				
			|||||||
           if imax == 0:
 | 
					           if imax == 0:
 | 
				
			||||||
              print 'AICPicker: Maximum for slope determination right at the beginning of the window!'
 | 
					              print 'AICPicker: Maximum for slope determination right at the beginning of the window!'
 | 
				
			||||||
              print 'Choose longer slope determination window!'
 | 
					              print 'Choose longer slope determination window!'
 | 
				
			||||||
              pdb.set_trace()
 | 
					 | 
				
			||||||
              return
 | 
					              return
 | 
				
			||||||
           islope = islope[0][0 :imax]
 | 
					           islope = islope[0][0 :imax]
 | 
				
			||||||
           dataslope = self.Data[0].data[islope]
 | 
					           dataslope = self.Data[0].data[islope]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user