def test_scale_factors():
    """
    Scale factor quantizer:

    Index method:

        >>> sf = ScaleFactor(scale_factors=[1.0, 2.0, 4.0])
        >>> sf.index(0.0), sf.index(0.5), sf.index(1.0)
        (0, 0, 0)
        >>> sf.index(1.5), sf.index(2.0)
        (1, 1)
        >>> sf.index(3.0), sf.index(4.0), sf.index(5.0)
        (2, 2, 2)
        >>> sf.index([-1.0, 0.0, 1.0])
        0
        >>> sf.index([-2.0, -1.0, 0.0, 1.0, 2.0])
        1
        >>> sf.index([-1000.0, 1000.0])
        2

   Encoder:

        >>> sf.quantizer = Uniform(low=-1.0, high=1.0, N=3)
        >>> sf.encode([-1.0, 0.0, 1.0])
        (0, array([0, 1, 2], dtype=uint8))
        >>> sf.encode([-2.0, -1.0, 0.0, 1.0, 2.0])
        (1, array([0, 0, 1, 2, 2], dtype=uint8))
        >>> sf.encode([-1000.0, 1000.0])
        (2, array([0, 2], dtype=uint8))
    """
