Exemplo n.º 1
0
    def skip_test_retime_manually(self):

        test_file = os.path.join(common.test_files_dir(),
                                 'retimes/spline02.aaf')
        test_file = os.path.join(common.test_files_dir(),
                                 'retimes/spline04.aaf')
        # compare_speedmap_to_offset_map(test_file)

        # manual testing here

        import matplotlib.pyplot as plt
        import numpy as np

        with aaf2.open(test_file) as f:
            op_group, speed_map, offset_map = find_retime(f)

            target = [[], []]

            p0 = offset_map['PointList'].value[0]
            # p0.dump()
            sp0 = speed_map['PointList'].value[0]
            sp0.dump()

            # p0 = speed_map['PointList'].value[0]

            # for i in range(0, 200):
            #     target[0].append(i)
            #     target[1].append(offset_map.value_at(i))

            for item in offset_map['PointList'].value:
                target[0].append(item.time)
                target[1].append(item.value)

            start = int(p0.time)
            print(p0.time)
            # op_group[1].dump()

            # print(end, p_last.time)
            pos = 0
            error_list = []

            offset_map_gen = generate_offset_map(speed_map, start,
                                                 op_group[0].length)
            calcuated = [[], []]
            for t, v in offset_map_gen:
                calcuated[0].append(t)
                calcuated[1].append(v)
                tar = offset_map.value_at(t)
                error = abs(tar - v)
                print(t, error, tar, pos)
                error_list.append(error)

            print("average error:", sum(error_list) / len(error_list))

            plt.plot(target[0], target[1])
            plt.plot(calcuated[0], calcuated[1])

            plt.show()
Exemplo n.º 2
0
 def test_speedmap_step(self):
     test_file = os.path.join(common.test_files_dir(), 'retimes/step01.aaf')
     error = compare_speedmap_to_offset_map(test_file)
     self.assertTrue(error_ok(error, test_file))
     test_file = os.path.join(common.test_files_dir(), 'retimes/step02.aaf')
     error = compare_speedmap_to_offset_map(test_file)
     self.assertTrue(error_ok(error, test_file))
     test_file = os.path.join(common.test_files_dir(), 'retimes/step03.aaf')
     error = compare_speedmap_to_offset_map(test_file)
     self.assertTrue(error_ok(error, test_file))
Exemplo n.º 3
0
 def test_walk_all(self):
     test_file = os.path.join(common.test_files_dir(), "test_file_01.aaf")
     with AAFFile(test_file) as f:
         common.walk_aaf(f.root)