experimental function to include conditional prior information
    for one or more parameters in a full covariance matrix

def condition_on_par_knowledge(cov,par_knowledge_dict):
    """  experimental function to include conditional prior information
    for one or more parameters in a full covariance matrix
    """

    missing = []
    for parnme in par_knowledge_dict.keys():
        if parnme not in cov.row_names:
            missing.append(parnme)
    if len(missing):
        raise Exception("par knowledge dict parameters not found: {0}".\
                        format(','.join(missing)))
    # build the selection matrix and sigma epsilon
    #sel = cov.zero2d
    #sel = pyemu.Matrix(x=np.zeros((cov.shape[0],1)),row_names=cov.row_names,col_names=['sel'])
    sel = cov.zero2d
    sigma_ep = cov.zero2d
    for parnme,var in par_knowledge_dict.items():
        idx = cov.row_names.index(parnme)
        #sel.x[idx,:] = 1.0
        sel.x[idx,idx] = 1.0
        sigma_ep.x[idx,idx] = var
    #print(sigma_ep.x)
    #q = sigma_ep.inv
    #cov_inv = cov.inv
    print(sel)
    term2 = sel * cov * sel.T
    #term2 += sigma_ep
    #term2 = cov
    print(term2)
    term2 = term2.inv
    term2 *= sel
    term2 *= cov

    new_cov = cov - term2

    return new_cov