Did I find the right examples for you? yes no

All Samples(8)  |  Call(8)  |  Derive(0)  |  Import(0)
Linear map parameters between domains.

Return the parameters of the linear map ``offset + scale*x`` that maps
`old` to `new` such that ``old[i] -> new[i]``, ``i = 0, 1``.

Parameters
----------
old, new : array_like
    Domains. Each domain must (successfully) convert to a 1-d array
    containing precisely two values.(more...)

        def mapparms(old, new) :
    """
    Linear map parameters between domains.

    Return the parameters of the linear map ``offset + scale*x`` that maps
    `old` to `new` such that ``old[i] -> new[i]``, ``i = 0, 1``.

    Parameters
    ----------
    old, new : array_like
        Domains. Each domain must (successfully) convert to a 1-d array
        containing precisely two values.

    Returns
    -------
    offset, scale : scalars
        The map ``L(x) = offset + scale*x`` maps the first domain to the
        second.

    See Also
    --------
    getdomain, mapdomain

    Notes
    -----
    Also works for complex numbers, and thus can be used to calculate the
    parameters required to map any line in the complex plane to any other
    line therein.

    Examples
    --------
    >>> from numpy import polynomial as P
    >>> P.mapparms((-1,1),(-1,1))
    (0.0, 1.0)
    >>> P.mapparms((1,-1),(-1,1))
    (0.0, -1.0)
    >>> i = complex(0,1)
    >>> P.mapparms((-i,-1),(1,i))
    ((1+1j), (1+0j))

    """
    oldlen = old[1] - old[0]
    newlen = new[1] - new[0]
    off = (old[1]*new[0] - old[0]*new[1])/oldlen
    scl = newlen/oldlen
    return off, scl
        


src/s/p/Spherebot-Host-GUI-HEAD/InkscapePortable/App/Inkscape/python/Lib/site-packages/numpy/polynomial/tests/test_polyutils.py   Spherebot-Host-GUI(Download)
        dom2 = [1,3]
        tgt = [1, .5]
        res = pu. mapparms(dom1, dom2)
        assert_almost_equal(res, tgt)
 
        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = [-1 + 1j, 1 - 1j]
        res = pu.mapparms(dom1, dom2)

src/n/u/nupic-linux64-HEAD/lib64/python2.6/site-packages/numpy/polynomial/tests/test_polyutils.py   nupic-linux64(Download)
        dom2 = [1,3]
        tgt = [1, .5]
        res = pu. mapparms(dom1, dom2)
        assert_almost_equal(res, tgt)
 
        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = [-1 + 1j, 1 - 1j]
        res = pu.mapparms(dom1, dom2)

src/m/i/MissionPlanner-HEAD/Lib/site-packages/numpy/polynomial/tests/test_polyutils.py   MissionPlanner(Download)
        dom2 = [1,3]
        tgt = [1, .5]
        res = pu. mapparms(dom1, dom2)
        assert_almost_equal(res, tgt)
 
        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = [-1 + 1j, 1 - 1j]
        res = pu.mapparms(dom1, dom2)

src/n/u/numpy-1.8.1/numpy/polynomial/tests/test_polyutils.py   numpy(Download)
        dom2 = [1, 3]
        tgt = [1, .5]
        res = pu. mapparms(dom1, dom2)
        assert_almost_equal(res, tgt)
 
        # test for complex values
        dom1 = [0 - 1j, 2 + 1j]
        dom2 = [-2, 2]
        tgt = [-1 + 1j, 1 - 1j]
        res = pu.mapparms(dom1, dom2)