def _density2D(self, num_points=1024, xmin=None, xmax=None, ymin=None, ymax=None, sigma_max=5): lims = self._updateLimits(self.lims, xmin, xmax, ymin, ymax) (xmin, xmax), (ymin, ymax) = self.autoRanges(sigma_max, lims=lims) x = np.linspace(xmin, xmax, num_points) y = np.linspace(ymin, ymax, num_points) xx, yy = np.meshgrid(x, y) like = self.pdf(xx, yy) return Density2D(x, y, like)
def RSDdensity(FAPbar, f8bar, covfile): incov = loadtxt(covfile) invcov = inv(inv(incov)[1:, 1:]) FAPv = np.arange(0.56, 0.78, 0.003) f8v = np.arange(0.28, 0.63, 0.003) FAP, f8 = np.meshgrid(FAPv, f8v) like = (FAP - FAPbar)**2 * invcov[0, 0] + 2 * (FAP - FAPbar) * ( f8 - f8bar) * invcov[0, 1] + (f8 - f8bar)**2 * invcov[1, 1] density = Density2D(FAPv, f8v, exp(-like / 2)) density.contours = exp(-np.array([1.509, 2.4477])**2 / 2) return density