def argh(ratio, source, dest_offset=0):

    if len(source) == 0:
        raise StopIteration()

    first_frame = source[0]

    for in_frame in source:
        rel_in_frame = in_frame - first_frame

        first_rel_out_frame = int(math.floor(rel_in_frame * ratio))
        bound_rel_out_frame = int(math.floor((rel_in_frame + 1) * ratio))

        # Confusing, argh:
        # Uncomment this to let the program use e.g. even-numbered frames when 
        # the ratio is 1/2.  Unfortunately, this breaks everything else!  See 
        # testSkipRatioBad in test_rateconverter.py.  You'll also need to use
        # take_last_assignment down in convert_integers_by_iterator_ratio.
        #bound_rel_out_frame = max(
                #int(math.floor((rel_in_frame + 1) * ratio)),
                #first_rel_out_frame + 1)

        for rel_out_frame in xrange(first_rel_out_frame, bound_rel_out_frame):
            yield (in_frame, rel_out_frame + dest_offset)
Given a source of frame numbers and a ratio, gives the reassignments
dataset/ETHPy150Open robmoggach/python-moshion/moshion/extractframes/rateconverter.py/argh