Exemple #1
0
 def calcularProbabilidade(self):
     q = 1
     for i in range(len(self.z)):
         #print d, 'A'
         #z, zReal = self.dados[i]  #x, y, theta nao precisa
         p = (Parametros.ZHIT) * funcoesProbabilidade.pHit(self.z[i], self.zReal[i]) + \
             (Parametros.ZSHORT) * funcoesProbabilidade.pShort(self.z[i], self.zReal[i]) + \
             (Parametros.ZMAX) * funcoesProbabilidade.pMax(self.z[i]) + \
             (Parametros.ZRAND) * funcoesProbabilidade.pRand(self.z[i])
         #print p
         q *= p       
     return q
 def aprenderParametrosIntrinsicos(self):
     eHit = []
     eShort = []
     eMax = []
     eRand = []
     Z = []
     ZReal = []
     Zaux = 0
     for i,d in enumerate(self.dados):
         x, y, theta, z = d
         zReal = self.rayCasting(x,y,theta)
         Z[i] = z
         ZReal[i] = zReal
         '''acredito que esteja certo'''
         Zaux += z**2
         
         phit = funcoesProbabilidade.pHit(z, zReal, self.desvioHit, self.alcanceMax)
         pshort = funcoesProbabilidade.pShort(z, zReal, self.lambdaShort)
         pmax = funcoesProbabilidade.pMax(z, self.alcanceMax)
         prand = funcoesProbabilidade.pRand(z, self.alcanceMax)
         
         n = (phit + pshort + pmax + prand)**-1
         
         eHit[i] = n*phit
         eShort[i] = n*pshort
         eMax[i] = n*pmax
         eRand[i] = n*prand
         
     aux = sqrt(Zaux)**-1    # Verificar isso
     self.zHit    =   aux * sum(eHit)
     self.zShort  =   aux * sum(eShort)
     self.zMax    =   aux * sum(eMax)
     self.zRand   =   aux * sum(eRand)
     self.novoDesvioHit = sqrt(1/(sum(eHit))*sum((np.array(eHit)*(np.array(Z) - np.array(ZReal))**2)))
     self.novoLambdaShort = sum(eShort)/(sum(np.array(eShort)*np.array(Z)))
     
     self.saveParametros()
 def calcularProbabilidade(self, Z, zReal):
     prob = (Parametros.ZHIT) * funcoesProbabilidade.pHit(Z, zReal) + \
         (Parametros.ZSHORT) * funcoesProbabilidade.pShort(Z, zReal) + \
         (Parametros.ZMAX) * funcoesProbabilidade.pMax(Z) + \
         (Parametros.ZRAND) * funcoesProbabilidade.pRand(Z)
     return prob