'Convert covariance matrix(-ices) to weights.'

def _cov2wt(self, cov):

    from numpy.dual import inv
    if (len(cov.shape) == 2):
        return inv(cov)
    else:
        weights = numpy.zeros(cov.shape, float)
        for i in range(cov.shape[(-1)]):
            weights[:, :, i] = inv(cov[:, :, i])
        return weights
