python - Averaging unevenly sampled data -


i have data consist of radial distance ground, sampled evenly every d_theta. gaussian smoothing on it, make size of smoothing window constant in x, rather constant number of points. way this?

i made function it, slow , haven't put in parts calculate edges yet.

if helps faster, guess can assume floor flat , use calculate how many points sample, rather using actual x-values.

here have attempted far:

bs = [gaussian(2*n-1,n/2) n in range (1,500)] #bring computation of bs = [b/b.sum() b in bs]                      #gaussian outside speed  def uneven_gauss_smoothing(xvals,yvals,sigma):     newy = []     i, xval in enumerate (xvals):          #find how big window should have chosen sigma          #(or .5*sigma, whatever):         wheres = np.where(xvals> xval + sigma )[0]         iright = wheres[0] -i if len(wheres) else 100          if - iright < 0 :              newy.append(0)          #not implemented yet             continue         if + iright >= len(xvals):             newy.append(0)          #not implemented             continue         else:             #weighted average gaussian curve:             newy.append((yvals[i-iright:i+iright+1]*bs[iright]).sum())     return np.array(newy) 

sorry it's bit of mess--it incredibly frustrating debug ended using first solution (usually 1 difficult read) came mind of problems popped up. work in it's limited way.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -