def calc_moments(timeseries_file, moment):
 timeseries = np.genfromtxt(timeseries_file)
 m2 = stats.moment(timeseries, 2, axis=0)
 m3 = stats.moment(timeseries, moment, axis=0)
 zero = (m2 == 0)
 return np.where(zero, 0, (m3 / (m2 ** (moment / 2.0))))

def calc_moments ( timeseries_file , moment ) : timeseries = np . genfromtxt ( timeseries_file ) m2 = stats . moment ( timeseries , 2 , axis = 0 ) m3 = stats . moment ( timeseries , moment , axis = 0 ) zero = ( m2 == 0 ) return np . where ( zero , 0 , ( m3 / ( m2 ** ( moment / 2.0 ) ) ) )
returns nth moment of timeseries .