def sample(self, wig, resolution):
        
        # parameter checking
            
        try:
            chroms=wig.get_chroms()
        except AttributeError:
            raise Exception("Argument 'wig' must be given")
        
        sampWig=Wig()
        for chrom in chroms:
            try:
                standardchrom=self.standard_chroms[chrom]
            except KeyError:
                standardchrom=chrom
            
            try:
                start  = wig[chrom][0][0]
                end = wig[chrom][0][-1]
            except IndexError:
                continue
            
            samp=[array('l',[]),array('d',[])]
            cor = wig[chrom][0]
            val = wig[chrom][1]
            init = 0
            prev = -1000
            for sc in xrange(start, end, resolution):
                # get the closest one to the sampled point and save
                gotya = bisect_left(cor[init:], sc)
                
                if prev == (init+gotya): continue
                else: prev = (init+gotya)
                
                try:
                    samp[0].append(cor[init+gotya])
                    samp[1].append(val[init+gotya])
                    init += gotya
                except IndexError:
                    continue
        
            #added to sampWig only if there are some point(s)
            if samp[0]: sampWig.wig[standardchrom]=samp
                
        return sampWig
Returns the tab size for the given caption, bitmap and button state.
dataset/ETHPy150Open taoliu/taolib/Assoc/sampler.py/WigSamplerFast.sample--crossover with--dataset/ETHPy150Open ContinuumIO/ashiba/enaml/enaml/wx/wx_upstream/aui/tabart.py/VC8TabArt.GetTabSize