def animate_wiggle_bones(
    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)
    print("freq:", freq)

    for i, b in enumerate(bones):
        b_off = -(off + i / len(bones)) * frame_period / wavelength
        b.rotation_mode = "XYZ"
        sinusoid_driver(b.driver_add("rotation_euler")[0].driver, mag, freq, b_off)
        if not fixed_head and i == 0:  # move head
            cosusoid_driver(
                b.driver_add("location")[2].driver, mag / (freq / (2 * pi)), freq, b_off
            )
            # sinusoid_driver(b.driver_add('rotation_euler')[0].driver, -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