def resample(curves): n = len(curves) newSample = [] for c in curves: targetDof = c.dof['avg'] randCurve = curves[random.randint(0, n-1)] sourceDof = randCurve.dof['avg'] newCurve = CorrCurves(frameRate = randCurve.frameRate) def scale(seq): return (seq / sourceDof) * targetDof newCurve.sab['avg'] = scale(randCurve.sab['avg']) newCurve.ssa['avg'] = scale(randCurve.ssa['avg']) newCurve.ssb['avg'] = scale(randCurve.ssb['avg']) newCurve.dof['avg'] = targetDof newSample.append(newCurve) return newSample
def averageCurves(curves): return CorrCurves.average(curves)