def parse_amc()

in fairmotion/data/asfamc.py [0:0]


def parse_amc(file_path, joints, skel):
    with open(file_path) as f:
        content = f.read().splitlines()

    for idx, line in enumerate(content):
        if line == ":DEGREES":
            content = content[idx + 1 :]
            break

    motion = motion_class.Motion(skel=skel)
    frames = []
    idx = 0
    line, idx = read_line(content, idx)
    assert line[0].isnumeric(), line
    EOF = False
    frame = 0
    translation_data = []
    while not EOF:
        # joint_degree = {}
        while True:
            line, idx = read_line(content, idx)
            if line is None:
                EOF = True
                break
            if line[0].isnumeric():
                break
            line_idx = 1
            if "root" in line[0]:
                degree = np.array([float(line[i]) for i in range(4, 7)])
                joints[line[0]].coordinate = np.array(
                    [float(line[i]) for i in range(1, 4)]
                )
            else:
                degree = []
                for lm in joints[line[0]].limits:
                    if lm[0] != lm[1]:
                        degree.append(float(line[line_idx]))
                        line_idx += 1
                    else:
                        degree.append(0)
            joints[line[0]].degree = np.deg2rad(np.array(degree).squeeze())
        pose_data = []
        set_rotation(joints["root"])
        for key in joints.keys():
            if joints[key].matrix is None:
                pose_data.append(constants.eye_T())
            else:
                pose_data.append(
                    conversions.Rp2T(
                        joints[key].matrix.squeeze(),
                        joints[key].coordinate.squeeze(),
                    )
                )

        fps = 60
        motion.add_one_frame(pose_data)
        frame += 1
    return motion