本文整理汇总了Python中grid.Grid方法的典型用法代码示例。如果您正苦于以下问题:Python grid.Grid方法的具体用法?Python grid.Grid怎么用?Python grid.Grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grid
的用法示例。
在下文中一共展示了grid.Grid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _define_grid
# 需要导入模块: import grid [as 别名]
# 或者: from grid import Grid [as 别名]
def _define_grid(self):
"""
Generate a grid/mesh to the problem
"""
if self._dimension == 1:
return grid.Grid((Problem.GRID_SIZE, self.dimension + 1))
else:
# TODO create Grid2d class and replace the following with it
return grid.Grid((Problem.GRID_SIZE, Problem.GRID_SIZE, len(self.tension)))
示例2: __init__
# 需要导入模块: import grid [as 别名]
# 或者: from grid import Grid [as 别名]
def __init__(self):
Tile.configure()
if len(sys.argv)>1 and sys.argv[1] == '-l':
self.grid = eval(gamesave.load_game_state(gamesave.SAVEDIR+gamesave.LASTSAVE))
else:
self.grid = Grid()
self.turn = 0
self.gameover = False
示例3: _setupGrid
# 需要导入模块: import grid [as 别名]
# 或者: from grid import Grid [as 别名]
def _setupGrid(self):
def do_them(lines, width=self.line_width, grid2=False):
for line in lines:
color = QtGui.QColor()
color.setNamedColor(line.style)
pen = QtGui.QPen(color, width)
pen.setJoinStyle(QtCore.Qt.RoundJoin)
pen.setCapStyle(QtCore.Qt.RoundCap)
start = self.mapFromLonLat(QtCore.QPointF(line.coordinates[0][1], line.coordinates[0][0]))
for pt in range(1, len(line.coordinates)):
end = self.mapFromLonLat(QtCore.QPointF(line.coordinates[pt][1], line.coordinates[pt][0]))
ln = QtGui.QGraphicsLineItem(QtCore.QLineF(start, end))
ln.setPen(pen)
ln.setZValue(0)
self.addItem(ln)
if grid2:
self._gridGroup2.addToGroup(ln)
else:
self._gridGroup.addToGroup(ln)
start = end
return
self.lines = Grid()
do_them(self.lines.lines)
self.grid_lines = len(self.lines.lines)
lines = Grid_Boundary()
if len(lines.lines) > 0:
lines.lines[0].style = self.colors['grid_boundary']
do_them(lines.lines, width=0)
if self.existing_grid2:
lines2 = Grid(grid2=True)
do_them(lines2.lines, grid2=True)
示例4: setUp
# 需要导入模块: import grid [as 别名]
# 或者: from grid import Grid [as 别名]
def setUp(self):
self.grid = Grid("/Users/dean/Desktop/og/bo.jpg", pix_multi=.014, diamond=True, colorful=ColorType.kANALOGOUS,
working_res=1600, enlarge=1600)
示例5: __init__
# 需要导入模块: import grid [as 别名]
# 或者: from grid import Grid [as 别名]
def __init__(self, params, fname, replace=False, partitions=100):
self.replace = replace
self.mu = params['mu']
self.cov = params['cov']
self.n = params['n']
self.Z = [N/np.sum(self.n) for N in self.n]
self.data = self.generate_data(fname=fname)
self.grid_obj = Grid(self.data, partitions)
self.grid = self.grid_obj.axis
self.dist = self.compute_distribution()
示例6: create_reg_images
# 需要导入模块: import grid [as 别名]
# 或者: from grid import Grid [as 别名]
def create_reg_images(photo_path, pix_multi, diamond, color,
working_res, enlarge, pool, output_path):
grid = Grid(photo_path, pix=0, pix_multi=pix_multi, diamond=diamond,
colorful=color, working_res=working_res, enlarge=enlarge)
total_updates = 20
step_size = util.clamp_int(int(math.ceil(grid.rows/(1.0*total_updates))), 1, 10000)
ending_index = step_size*total_updates
# diff = grid.rows - step_size*total_updates
todos = []
for i in range(total_updates+1):
s_index = step_size*i
e_index = s_index + step_size
todos.append((s_index, e_index, output_path))
is_continue = False if e_index >= grid.rows else True
if not is_continue:
break
# double check that we are not doing double work
try:
pool = ThreadPool(8)
pool.map(grid.grid_start_end_thread, todos)
pool.close()
pool.join()
except (KeyboardInterrupt, SystemExit):
pool.terminate()
grid.save(output_path)
#
#
# print 100in
# grid.grid_start_end(0, grid.rows)
# grid.save(output_path)
# if e_index < grid.rows:
# s_index = ending_index
# e_index = grid.rows
# grid.grid_start_end(s_index, e_index)
# grid.save(output_path)
# print 100