def __init__(self, n, source, target, bias, opts=None): MapSeeker.__init__(self, opts) shape = bias.shape if not isinstance(bias, Sparse): bias = Sparse(bias) bias.squeeze() self.bias = bias self._params = (n, source, target) self._space = Sparse(None, shape) self.prep(n, source, target)
def __init__(self, n, source, target, bias, opts=None): MapSeeker.__init__(self, opts) self.bias = bias.getData() self.hexedge=bias.attrib('edge') self.size = self.bias.shape[0] self.width = bias.attrib('width') if self.bias.shape[1]!=6: if self.bias.shape[1]==3: self.bias=hg.nd2d(self.bias, self.width, bias.attrib('blanks')) else: raise StandardError('Hex Nav MSC requires that the bias field be a directed (6D) or non-directed (3D) hexgrid') self._space = Sparse1D(None, self.size) self.map = hg.hexMap(self.size, self.width, self.bias==bias.attrib('blanks')) self.prep(n, source, target)