Пример #1
0
    def evaluate(self, x, d1=0, d2=0):
        nx, nf, nT = self.nx, self.nf, self.nT
        ns, ms, ks = self.ns, self.ms, self.ks
        nP = x.shape[0]

        minV = numpy.min
        maxV = numpy.max
        for i in range(nx):
            if minV(x[:,i]) < minV(self.Cx[i]):
                print 'MBI error: min value out of bounds', i, minV(x[:,i]), minV(self.Cx[i])
                #raise Exception('MBI evaluate error: min value out of bounds')
            if maxV(x[:,i]) > maxV(self.Cx[i]):
                print 'MBI error: max value out of bounds', i, maxV(x[:,i]), maxV(self.Cx[i])
                #raise Exception('MBI evaluate error: max value out of bounds')

        t = numpy.zeros((nP,nx),order='F')
        for i in range(nx):
            t[:,i] = MBIlib.inversemap(ks[i], ms[i], nP, x[:,i], self.Cx[i])

        i1, i2 = max(0, d1-1), max(0, d2-1)
        nC, nCx1, nCx2 = self.C.shape[0], self.Cx[i1].shape[0], self.Cx[i2].shape[0]
        return MBIlib.evaluate(d1, d2, nx, nf, nC, nCx1, nCx2, nP, ks, ms, t, self.C, self.Cx[i1], self.Cx[i2])