def animate_running_back_leg(
    arma, bones, mag_deg, freq, off=0, wavelength=1, remove_iks=True, fixed_head=True
):
    """
    mag_deg = sum of magnitudes across al bones
    freq = flaps per second
    off = global time offset
    wavelength = how many flaps fit into one creature
    """

    # remove any iks, we will be overriding them
    if remove_iks:
        for b in bones:
            for c in b.constraints:
                if hasattr(c, "target"):
                    butil.delete(c.target)
                b.constraints.remove(c)

    mag = np.deg2rad(mag_deg) / len(bones)
    frame_period = int(bpy.context.scene.render.fps / freq)

    def number_finder(s):
        rr = re.findall("[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?", s)
        return int(rr[0])

    left = 1000
    right = -1000
    for b in bones:
        rr = number_finder(b.name)
        left = min(left, rr)
        right = min(right, rr)

    for i, b in enumerate(bones):
        rr = number_finder(b.name)
        b_off = -(off + (1 / 2 * (rr == right))) * frame_period / wavelength
        b.rotation_mode = "XYZ"
        sinusoid_driver(b.driver_add("rotation_euler")[0].driver, 3 * mag, freq, b_off)
        # sinusoid_driver(b.driver_add('rotation_euler')[1].driver, 3 * mag, freq, b_off)
        b.driver_add("location")[2].driver.expression = "-0.1"
        # sinusoid_driver(b.driver_add('location')[0].driver, 5 * mag, freq, b_off)
        # sinusoid_driver(b.driver_add('location')[2].driver, 0.1 * mag, freq, b_off)

    mag_deg = sum of magnitudes across al bones
    freq = flaps per second
    off = global time offset
    wavelength = how many flaps fit into one creature
    
infinigen/assets/objects/creatures/util/animation/run_cycle.py