Skip to content

Commit

Permalink
Completed a sample. Changed AssociationMatrix to use get_last_pushed_…
Browse files Browse the repository at this point in the history
…value #38
  • Loading branch information
JacobAMason committed Apr 8, 2017
1 parent 11f466b commit 025c9b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Snapper/AssociationMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def remove_relationship(self, relationship):
def get_value_matrix(self):
dict_with_values = {}
for key, value in self.relationships.items():
dict_with_values[key] = value.get_correlation_coefficient()
# TODO: Change back to value.get_correlation_coefficient()
dict_with_values[key] = value.get_last_pushed_value()
return dict_with_values

def get_relationships_by_value_range(self, minvalue, maxvalue):
Expand Down
11 changes: 7 additions & 4 deletions Tests/IntegrationTests/SpreadsheetIntegration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_manager_and_sensor_data_from_cvs(filename):
with open(filename, newline='') as csvfile:
csvreader = csv.reader(csvfile)
for row in csvreader:
sensors_data.append(row)
sensors_data.append(list(map(int, row)))

manager = Manager()
for _ in range(len(sensors_data)):
Expand All @@ -28,6 +28,9 @@ def publish_all_sensors(manager, sensors_data):

if __name__ == '__main__':
manager, sensors_data = get_manager_and_sensor_data_from_cvs("test.csv")
print(manager.get_matrix().get_value_matrix())
publish_all_sensors(manager, sensors_data)
print(manager.get_matrix().get_value_matrix())
while True:
try:
print(manager.get_value_matrix())
publish_all_sensors(manager, sensors_data)
except IndexError:
break
4 changes: 2 additions & 2 deletions Tests/IntegrationTests/test.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1,2,3,4,5
5,6,7,8,9
1,2,1,1,2,1,2,3,4,5,1
1,2,1,1,2,1,2,3,4,5,1

0 comments on commit 025c9b7

Please sign in to comment.