def split_models(baseline, *models):
    """ Seperate the effect of models from the baseline.
    
    Seperate the effect of model and risidual on the baseline,
    base on precalculated effects of each model.
    It is assumed that the models combine linearly with each
    other and a residual (meaning modelA + modelB + residual = baseline,
    but not modelA * modelB + residual = baseline or other such variations).
    
    Parameters
    ----------
    baseline : ndarray
        An array of the base measurements.
    *models : ndarray
        Arrays of the effects of each model to be removed.
        all models must have the same length as baseline.
    
    Returns
    -------
    tuple of ndarray
        A tuple, with the first component being an ndarray of the residual
        and the second component being an ndarray of the combined model.
        The result statisfies that the sum of the components
        is equal to the baseline.
        
    Examples
    --------
    >>> from pyfac.fac import *  # doctest: +SKIP
    >>> modelA = np.arange(15).reshape(5,3)**2
    >>> modelB = sw.as_3d(np.arange(7,2,-1))
    >>> data = (np.random.randn(5,3)*0.1 + modelA + modelB 
    ...         + sw.pack_3d(np.sin(np.arange(5)*0.5),
    ...                      np.cos(np.arange(5)*0.5),
    ...                      np.tan(np.arange(5)*0.5)))
    >>> split_models(data,modelA,modelB) # doctest: +ELLIPSIS
    (array([[...,...,...],
           [...,...,...],
           [...,...,...],
           [...,...,...],
           [...,...,...]]), array([[  7.,   8.,  11.],
           [ 15.,  22.,  31.],
           [ 41.,  54.,  69.],
           [ 85., 104., 125.],
           [147., 172., 199.]]))
    """
    model = sum(models)
    return baseline - model, model
