def __make_sources(self, xx=0.5, yy=0.5, rad=None, domain='rect'): from scipy.spatial import cKDTree as kdt from scipy.spatial import Delaunay as triag from iutils.random import darts from iutils.random import darts_rect if rad is None: rad = self.init_rad if domain == 'circ': sources = darts(self.init_num, xx, yy, self.init_rad, self.source_dst) elif domain == 'rect': sources = darts_rect(self.init_num, xx, yy, 2 * rad, 2 * rad, self.source_dst) else: raise ValueError('domain must be "rect" or "circ".') tree = kdt(sources) self.sources = sources self.tree = tree self.tri = triag(self.sources, incremental=False, qhull_options='QJ Qc') self.num_sources = len(self.sources) return len(sources)
def _append_tmp_sources(self): from scipy.spatial import cKDTree as kdt from scipy.spatial import Delaunay as triag sources = row_stack([self.sources] + self.tmp_sources) tree = kdt(sources) self.sources = sources self.tree = tree self.tmp_sources = [] self.tri = triag(self.sources, incremental=False, qhull_options='QJ Qc') self.num_sources = len(self.sources) return len(sources)
def _append_tmp_sources(self): from scipy.spatial import cKDTree as kdt from scipy.spatial import Delaunay as triag sources = row_stack([self.sources]+self.tmp_sources) tree = kdt(sources) self.sources = sources self.tree = tree self.tmp_sources = [] self.tri = triag( self.sources, incremental=False, qhull_options='QJ Qc' ) self.num_sources = len(self.sources) return len(sources)
def __make_sources(self, xx=0.5, yy=0.5, rad=None, domain='rect'): from scipy.spatial import cKDTree as kdt from scipy.spatial import Delaunay as triag from dddUtils.random import darts from dddUtils.random import darts_rect if rad is None: rad = self.init_rad if domain=='circ': sources = darts( self.init_num, xx, yy, self.init_rad, self.source_dst ) elif domain=='rect': sources = darts_rect( self.init_num, xx, yy, 2*rad, 2*rad, self.source_dst ) else: raise ValueError('domain must be "rect" or "circ".') tree = kdt(sources) self.sources = sources self.tree = tree self.tri = triag( self.sources, incremental=False, qhull_options='QJ Qc' ) self.num_sources = len(self.sources) return len(sources)