数値配列の正規化
2015/8/11
Python2.7.4
数値配列を0~1の範囲に正規化
def normalize(plotdata):
"""
data = [1.24,1.2,2.68,2.44.・・・]
"""
center = (max(plotdata)+min(plotdata))/2
for i in range(len(plotdata)):
plotdata[i] = plotdata[i] - center
a = 1.0/max(plotdata)
for i in range(len(plotdata)):
plotdata[i] = (plotdata[i]*a)/2+0.5
return plotdata