コード例 #1
0
    def show_loading_window(self) -> None:
        """
        Loads the loading screen for the user.

        :return: None
        """
        # Initialize the report by instantiating LoadingWindow class.
        self.loading_window = LoadingWindow()

        # Attach functionality to signals in LoadingWindow.
        # Signals are generated by the LoadingWindow class when a button is pushed to change views.
        self.loading_window.sigReturnHome.connect(self.show_home)

        self.cleanup() # make sure we sterilize our destination directories

        # Show report view on flight coordinates.
        flightData = importData('../Tests/TestFiles/JSONDUMP_with_illegal.flight')
        self.loading_window.sigTestReport.connect(lambda *args: self.show_report_window("", False, flightData))
        self.loading_window.sigTransferFootage.connect(lambda *args: self.transfer_footage(self.phoneControl))

        # Close the previous screen.
        try:
            self.tracking_window.close()
        except:
            print("Error")

        # Show the loading screen.
        self.loading_window.show()

        print("Window shown")
コード例 #2
0
    def test_velocityColorsComputes_correctSize(self) -> None:
        """
        Test that velocityColors returns array of correct size when inputted data set of 100, then 200, then 800,
        then 1200 data points. For each size, two tests are run.
        One test contains all legal inputs. Another test contains 80% legal inputs.
        Illegal coordinate points in file should not be included in "legalPoints" list in dictionary.

        :return: None
        """

        # Test small data sets
        size = 100
        test_dict = importData('TestFiles/new_size100_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), size - 1)

        test_dict = importData('TestFiles/new_size100_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), 0.8 * size - 1)

        size = 200
        test_dict = importData('TestFiles/new_size200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), size - 1)

        test_dict = importData('TestFiles/new_size200_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), 0.8 * size - 1)

        # Test medium data sets
        size = 600
        test_dict = importData('TestFiles/new_size600_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), size - 1)

        test_dict = importData('TestFiles/new_size600_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), 0.8 * size - 1)

        # Test large data sets
        size = 1200
        test_dict = importData('TestFiles/new_size1200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), size - 1)

        test_dict = importData('TestFiles/new_size1200_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertEqual(len(Graph.velocityColors(test_dict)), 0.8 * size)
コード例 #3
0
    def test_smoothnessValues(self) -> None:
        """
        Test that smoothness function returns expected number.

        :return: None
        """
        size = 100
        test_dict = importData('TestFiles/new_size100_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        smoothness = Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5)
        self.assertEqual(round(smoothness, 2), -17)

        test_dict = importData('TestFiles/new_size100_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        smoothness = Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5)
        self.assertEqual(round(smoothness, 2), -16.24)
コード例 #4
0
    def test_readCoordinates_small_legal(self) -> None:
        """
        Test that coordinates from a small data file are read in correctly.

        :return: None
        """
        test_dict = importData('TestFiles/JSONDUMP.flight')
        self.assertEqual(
            test_dict["coords"],
            [[0, 0, 0, 0], [1, 0, 0, 1], [2, 0, 0, 3], [3, 0, 0, 8]])
コード例 #5
0
    def test_readCoordinates_size1200_allLegal(self) -> None:
        """
        Test that file containing 1200 (x,y,z) points is read in correctly. This contains all legal inputs.
        Illegal coordinate points in file should not be included in "legalPoints" list in dictionary.

        :return: None
        """
        length = 1200
        test_dict = importData('TestFiles/new_size1200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        self.assertEqual(len(test_dict["coords"]), length)
        self.assertEqual(len(test_dict["legalPoints"]), length)
コード例 #6
0
    def test_readCoordinates_small_illegal(self) -> None:
        """
        Test that coordinates from a small data file are read in correctly.

        :return: None
        """
        test_dict = importData('TestFiles/JSONDUMP_with_illegal.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        self.assertEqual(test_dict["coords"],
                         [[0, 0, 0, 0], [1, -10, 15, 5], [2, 0, 0, 1],
                          [3, 0, 0, 3], [4, 0, 0, 8]])
        self.assertEqual(
            test_dict["legalPoints"],
            [[0, 0, 0, 0], [2, 0, 0, 1], [3, 0, 0, 3], [4, 0, 0, 8]])

        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
コード例 #7
0
    def test_smoothnessComputes(self) -> None:
        """
        Test that smoothness function returns a number when inputted data set of 100, then 200, then 800,
        then 1200 data points. For each size, two tests are run.
        One test contains all legal inputs. Another test contains 80% legal inputs.
        Illegal coordinate points in file should not be included in "legalPoints" list in dictionary.

        :return: None
        """
        size = 100
        test_dict = importData('TestFiles/new_size100_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        test_dict = importData('TestFiles/new_size100_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        # Test small data sets
        size = 100
        test_dict = importData('TestFiles/new_size100_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        test_dict = importData('TestFiles/new_size100_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        size = 200
        test_dict = importData('TestFiles/new_size200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        test_dict = importData('TestFiles/new_size200_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        # Test medium data sets
        size = 600
        test_dict = importData('TestFiles/new_size600_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        test_dict = importData('TestFiles/new_size600_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        # Test large data sets
        size = 1200
        test_dict = importData('TestFiles/new_size1200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))

        test_dict = importData('TestFiles/new_size1200_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.log_dimensionless_jerk(test_dict["velocities"], 0.5))
コード例 #8
0
    def test_graphShows_noError(self) -> None:
        """
        Test that graph generates correctly with and with velocity changes shown
        for data set of 100, then 200, then 800, then 1200 data points.
        For each size, two tests are run. One test contains all legal inputs. Another test contains 80% legal inputs.
        Illegal coordinate points in file should not be included in "legalPoints" list in dictionary.

        :return: None
        """
        # Test small data sets
        test_dict = importData('TestFiles/new_size100_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size100_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size200_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size600_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size600_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size1200_legal100.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))

        test_dict = importData('TestFiles/new_size1200_legal80.flight')
        test_dict = Graph.checkCoordinates(test_dict)
        test_dict = Graph.velocityPoints(test_dict)
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, True, 0, test_dict["flightLength"]))
        self.assertIsNotNone(
            Graph.generateGraph(test_dict, False, 0,
                                test_dict["flightLength"]))