本文整理汇总了Python中polygon.Polygon.sample方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.sample方法的具体用法?Python Polygon.sample怎么用?Python Polygon.sample使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.sample方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sigma_format
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import sample [as 别名]
if not h5file.root.__contains__(sigma_format(sigma)):
sigma_group = h5file.createGroup(h5file.root, sigma_format(sigma))
else:
sigma_group = h5file.root._v_children[sigma_format(sigma)]
for sides in range(3, 8):
if not sigma_group.__contains__(sides_format(sides)):
sides_group = h5file.createGroup(sigma_group, sides_format(sides))
else:
sides_group = sigma_group._v_children[sides_format(sides)]
for i in range(polygons_per_setting):
poly_group = h5file.createGroup(sides_group, '%03d' %i)
poly_group._v_attrs.sigma = sigma
poly_group._v_attrs.num_sides = sides
table = h5file.createTable(poly_group,'sensor_data',Point2D)
p = Polygon(num_sides = sides, regular = False)
data = p.sample(400, sigma = sigma)
row = table.row
for point in data:
row['x'] = point[0]
row['y'] = point[1]
row.append()
table.flush()
corners_table = h5file.createTable(poly_group,'real_corners',Point2D)
row = corners_table.row
for point in p.corners:
row['x'] = point[0]
row['y'] = point[1]
row.append()
corners_table.flush()