def testPoint3(self): """ Tests that points can be constructed correctly """ point = Point("test3", 45, 90) self.assertEqual(point.name, "test3") self.assertEqual(point.lat, 45) self.assertEqual(point.lon, 90)
def testPoint2(self): """ Tests that points can be constructed correctly """ point = Point("test2", -42.2808, 83.7430) self.assertEqual(point.name, "test2") self.assertEqual(point.lat, -42.2808) self.assertEqual(point.lon, 83.7430)
def test_addPoint3(self): """ Tests addPoint function """ point = Point("test3", 45, -45) self.app.treeview.addPoint(point) self.assertEqual(self.app.treeview.pointList[-1].name, "test3") self.assertEqual(self.app.treeview.pointList[-1].lat, 45) self.assertEqual(self.app.treeview.pointList[-1].lon, -45) self.assertEqual(self.app.treeview.masterList[-1].name, "test3")
def test_addPoint2(self): """ Tests addPoint function """ point = Point("test2", -42.2808, 83.7430) self.app.treeview.addPoint(point) self.assertEqual(self.app.treeview.pointList[-1].name, "test2") self.assertEqual(self.app.treeview.pointList[-1].lat, -42.2808) self.assertEqual(self.app.treeview.pointList[-1].lon, 83.7430) self.assertEqual(self.app.treeview.masterList[-1].name, "test2")
def addPointToTree(self): """ Adds a point selected by the user in the add point popup to the tree list """ point = Point(self.pointName.get(), float(self.pointLat.get()), float(self.pointLon.get())) numPointsWithName = 0 for existingPoint in self.master.treeview.pointList: if (existingPoint.name == point.name): numPointsWithName = numPointsWithName + 1 if (numPointsWithName > 0): point.name = point.name + " (" + str(numPointsWithName) + ")" self.master.canvas.plotter.plotPoint(point) self.master.treeview.addPoint(point)
def test_calcOrientationVector3(self): """ Tests the calcOrientationVector function for a satellite approximately over Michigan """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) point = Point("test2", 42, -83) # Search for at time when ISS is over the point timeStart = datetime(2019, 12, 8, 0, 0, 0) timeEnd = datetime(2019, 12, 15, 0, 0, 0) tolerance = 200 time = self.app.canvas.plotter.search(sat, 42, -83, timeStart, timeEnd, tolerance) self.app.time = time self.app.canvas.plotter.updateAll() # Get orientation vector vector = self.app.canvas.plotter.calcOrientationVector(sat, point) self.assertTrue(sqrt(vector[0]**2 + vector[1]**2 + vector[2]**2) > 400 and sqrt(vector[0]**2 + vector[1]**2 + vector[2]**2) < 500)
def test_calcOrientationVector2(self): """ Tests the calcOrientationVector function for a satellite directly over (0, 90) """ name = "ISS (ZARYA)" line1 = "1 25544U 98067A 19341.76426397 .00000123 00000-0 10168-4 0 9998" line2 = "2 25544 51.6434 220.7574 0006991 10.3191 120.6360 15.50092039202187" sat = spacecraft(name, line1, line2) point = Point("test2", 0, 90) # Search for at time when ISS is over the point timeStart = datetime(2019, 12, 8, 0, 0, 0) timeEnd = datetime(2019, 12, 15, 0, 0, 0) tolerance = 200 time = self.app.canvas.plotter.search(sat, 0, 90, timeStart, timeEnd, tolerance) self.app.time = time self.app.canvas.plotter.updateAll() # Get orientation vector vector = self.app.canvas.plotter.calcOrientationVector(sat, point) self.assertTrue(abs(vector[0]) < tolerance) self.assertTrue(vector[1] < -400) # y-component should be greater than ISS altitude self.assertTrue(abs(vector[2]) < tolerance)
def test_plotPoint3(self): """ Tests the plotPoint function """ point = Point("test2", 45, -90) self.app.canvas.plotter.plotPoint(point)
def test_plotPoint2(self): """ Tests the plotPoint function """ point = Point("test2", -42.2808, 83.7430) self.app.canvas.plotter.plotPoint(point)