User:Kithira/Course Pages/CSCI 12/Assignment 2/Group 1/Homework 4: Difference between revisions
Content deleted Content added
→Final Project: cleaned it up a bit |
m Replaced deprecated <source> tags with <syntaxhighlight> |
||
(One intermediate revision by one other user not shown) | |||
Line 3:
==== Summation Program plus Filter ====
<
from math import sqrt, pow
def summarize(x, y, z):
Line 15:
val1 = val2
return sumT
</syntaxhighlight>
This code represents the function Summarize, which summarizes each input using <math>|\sqrt{x^2 + y^2 + z^2}{-1}|</math>. Then, these values are summarized for ''i in range(40)'', which gives a value for 1 second. To prevent against data spikes the programs checks the difference between the previous value and the current value, and if the difference is greater than 2 it replaces the current value with the previous value.
Line 21:
==== Core Program ====
<
def getData(file):
infile = open(file)
Line 39:
return total
print getData("/usr/local/share/cs12/Test1.csv")
</syntaxhighlight>
The second part of code is responsible for averaging the values over a minute then adding all the minutes over the course of a week to find a total result that determines the intensity classification. We determined that our test subject was a moderately active person.
|