def alt_sg_coeffs(window_length, polyorder, pos):
 if (pos is None):
  pos = (window_length // 2)
 t = np.arange(window_length)
 unit = (t == pos).astype(int)
 h = np.polyval(np.polyfit(t, unit, polyorder), t)
 return h

def alt_sg_coeffs ( window_length , polyorder , pos ) : if ( pos is None ) : pos = ( window_length // 2 ) t = np . arange ( window_length ) unit = ( t == pos ) . astype ( int ) h = np . polyval ( np . polyfit ( t , unit , polyorder ) , t ) return h
this is an alternative implementation of the sg coefficients .