'calculate quantiles of Monte Carlo results'

def quantiles(self, idx=None, frac=[0.01, 0.025, 0.05, 0.1, 0.975]):

    if (self.mcres.ndim == 2):
        if (not (idx is None)):
            mcres = self.mcres[:, idx]
        else:
            raise ValueError('currently    only    1    statistic    at    a    time')
    else:
        mcres = self.mcres
    self.frac = frac = np.asarray(frac)
    self.mcressort = mcressort = np.sort(self.mcres)
    return (frac, mcressort[(self.nrepl * frac).astype(int)])
