def get_linear(from_interval, to_interval):
    """ Get linear transformation that maps one interval to another

    Parameters
    ----------
    from_interval : ndarray, tuple or list
        sequence of len=2 (llim, ulim) that defines the domain-interval
    to_interval : ndarray, tuple or list
        sequence of len=2 that defines the image-interval

    Returns
    -------
    function
        linear transformation
    """
    # compute coeffs of the mapping
    llim, ulim = from_interval
    new_llim, new_ulim = to_interval
    slope = (new_ulim - new_llim) / (ulim - llim)
    intercept = new_llim - slope * llim

    # define the map
    def linear(x):
        """ Transformation
        """
        return slope * x + intercept

    return linear