def testGetBoundingBox(self): validFile = 'tests/WLBG-geog.csv' presPts = PresencePoints(validFile, 'WLBG') bbox = BoundingBox(presPts.points, presPts.epsg) expected = (-76.8933333297525, -76.8579444453814, 39.3381111142888, 39.4326111107889) self.assertEqual(expected, bbox.getBoundingBox())
def studentClustersInClasses(StudentList, ClassroomList): result = [] classroomDic = {} for student in StudentList: for classroom in ClassroomList: box = BoundingBox.getBoundingBox(classroom["latitude"], classroom["longitude"], 10) if (box.hasWithin(student)): if (classroom["name"] not in classroomDic): classroomDic[classroom["name"]] = [] classroomDic[classroom["name"]].append(student) for key, value in classroomDic.items(): if (len(value) > 1): result = result + value return result