Example #1
0
    def create_peakset(self,shape='g'):     
        '''Filter the candidates to get a subset of true peaks'''
        peaks = pywaves.peaks_ridges1d(self._wtset, self._ridgesset, self._scalevals, 
                                      False, self.min_ridge_length, self.min_child_length, 
                                      None, self.min_ridge_sum, self.min_child_sum)

        binsize = np.diff(self._x).mean()
        positions = self._x[peaks[0][1]]
        widths = self._scalevals[peaks[0][0]+1]*2*binsize
        heights = self._y[peaks[0][1]]
        areas = widths*heights
        pks=[]
        for i in range(len(positions)):
            pks.append(Peak(centre=positions[i],width=widths[i],area=areas[i],height=heights[i],shape=shape))
        
        self.peaks = pks
        return pks        
Example #2
0
 def prep_ridge_plotting(self):
     '''get the data needed to make a plot of the search'''
     wt = self._wtset[0]
     
     ridgewtscatter=[]
     for r in self._ridgesset[0]: # r is all ridge candidates
         scaleinds=np.where((r!=32767)&(r>=0)) #scaleinds are those that haven't been rejected (set to 32767)
         posninds=r[scaleinds] #actual ridge positions
         scaleinds_increasingscale=wt.shape[0]-scaleinds[0]-1
         motherind=pywaves.motherridgeind_childridge(r)
         if motherind is None:
             mothertochildplotcoords=None
         else:
             xmother=ridgewtscatter[motherind][0][-1]
             ymother=ridgewtscatter[motherind][1][-1]
             xchild=posninds[0]
             xchild=self._x[xchild]
             ychild=scaleinds_increasingscale[0]
             mothertochildplotcoords=([xmother, xchild], [ymother, ychild])#assume that mother ridges always appear in "ridges" before the children ridges
         #print x[posninds]
         ridgewtscatter+=[(self._x[posninds], scaleinds_increasingscale, wt[(scaleinds_increasingscale, posninds)], mothertochildplotcoords)]
  
     return ridgewtscatter
Example #3
0
 def create_waveset(self):
     '''produces a set of ridges given the data and waveset'''
     self._wtset = pywaves.wavetrans1d(np.atleast_2d(self._y), self._waves, scalevals=self._scalevals)
Example #4
0
 def create_ridgeset(self): 
     '''scans the ridges to find peak candidates'''
     self._ridgesset = pywaves.ridges_wavetrans1d(self._wtset, self._scalevals, 
                                                  self.noiselevel, self.ridge_skip,False,
                                                  self.critical_sep,False)
Example #5
0
 def create_scalegrid(self):  
     '''produces a set of wavelets from the scale parameters'''
     self.sg = pywaves.scalegrid_scalesubset(self.scale_stop,self.scale_start,self.scale_multiplier)
     self._scalevals = pywaves.scale_scalegrid_ind(self.sg)          
     self._waves, self.sc = pywaves.getwavesetfromdatabase(self._scalevals)