def get_loglike(self, odor, pos_idx): """Return the relevant portion of the source loglikelihood map (i.e., the probability of the source being at any given location in the environment given a specified odor value at a specified position.""" # get idx of this odor odor_idx = nearest(odor, self.odor_domain) # get correct slice of loglikelihood map xidx, yidx, zidx = pos_idx xslice = slice(self.env.nx - 1 - xidx, 2 * self.env.nx - 1 - xidx) yslice = slice(self.env.ny - 1 - yidx, 2 * self.env.ny - 1 - yidx) zslice = slice(self.env.nz - 1 - zidx, 2 * self.env.nz - 1 - zidx) return self.loglike_map[odor_idx][xslice, yslice, zslice]
def get_loglike(self, odor, pos_idx): """Return the relevant portion of the source loglikelihood map (i.e., the probability of the source being at any given location in the environment given a specified odor value at a specified position.""" # get idx of this odor odor_idx = nearest(odor, self.odor_domain) # get correct slice of loglikelihood map xidx, yidx, zidx = pos_idx xslice = slice(self.env.nx - 1 - xidx, 2*self.env.nx - 1 - xidx) yslice = slice(self.env.ny - 1 - yidx, 2*self.env.ny - 1 - yidx) zslice = slice(self.env.nz - 1 - zidx, 2*self.env.nz - 1 - zidx) return self.loglike_map[odor_idx][xslice, yslice, zslice]
def odor(self, odor): self._odor = self.odor_domain[nearest(odor, self.odor_domain)]