# get attribute from wave (without graphing)
<h3>attribute</h3>
<ul>
<li>max ampltude</li>
<li>average ampltude</li>
<li>max slope (four points away)</li>
<li>percentage of peaks above the peaks' average ampltude</li>
<li>standard diviation</li>
<li><b>situation</b></li>
</ul>
<h3>code</h3>
``` python=
import csv
import pandas
#from scatterPlot import *
timeSlice =5
recordRate =100
threeAxisesAccData =pandas.read_csv("_fall.xlsx - Raw Data.csv").values
attributeVectorList =[]
sumOfMagSq =0
maxAmpl =0
avg =0
maxSlope =0
latestTwentyData =[]
peakList =[]
counter =0
for singleData in threeAxisesAccData:
mag =sum(singleData[i]*singleData[i] for i in range(1, 4))**0.5
#sum of mag square to compute 標準差
sumOfMagSq +=mag**2
#maxAmpl
if mag > maxAmpl:
maxAmpl =mag#
#peak: a mag greater than 10 before and 10 after can called a peak
#would do the peak avg finally and compare numbers of peaks gtr or smlr than peak avg
latestTwentyData.append(mag)
if len(latestTwentyData) >= 20:
if latestTwentyData[9] == max(latestTwentyData):
peakList.append(mag)
latestTwentyData.pop(0)
#avg: divided by num finally
avg +=mag#
#maxSlope
if counter > 3:
slope =0.25*recordRate*abs(latestTwentyData[-1]-latestTwentyData[-5])
if counter > 3 and slope > maxSlope:
maxSlope =slope#
counter +=1
##################### when one time slice passed #####################
if counter >= timeSlice*recordRate:
counter =0
peakAvg =sum(peakList)/len(peakList)
peakAboveRate =0
for peak in peakList:
if peak >= peakAvg:
peakAboveRate +=1
peakAboveRate /=len(peakList)#
avg /=(timeSlice*recordRate)
stdDiviation =sumOfMagSq/(timeSlice*recordRate)-avg**2#
attributeVectorList.append((maxAmpl, avg, maxSlope, peakAboveRate, stdDiviation, "fall"))
sumOfMagSq, maxAmpl, avg, maxSlope, latestTwentyData, peakList =0, 0, 0, 0, [], []
#######################################################################
print(attributeVectorList)
```