Protein
Generate either a convex or concave hull based on specified alpha and num_points. Hulls are created by radially distributing random points, then optimizing a perimeter based on the specified alpha. Shapes can be convex by setting relatively lower alpha and higher num_points. Hull coordinates are then converted to grid based shapes, where pixels within the hull perimeter are assigned a value of 1, and 0 otherwise.
- class Dock2D.DatasetGeneration.Protein.Protein(bulk, hull=None)
- __init__(bulk, hull=None)
- Parameters
bulk – protein shape bulk
hull – coordinates for the convex/concave hull
- classmethod generateConcave(size, alpha, num_points, occupancy=0.8, debug=False)
Generate concave hull coordinates and convert to grid based shape filled with 1 inside the shape, 0 otherwise.
- Parameters
size – the dimensions of the box containing the shape
alpha – the level of concavity used to generate convex hulls
num_points – number of points randomly radially distributed to generate the hull
occupancy – distance to span the the point distributions, 0.8 of size 50 gives 40pixels.
- Returns
concave protein shape bulk
- Dock2D.DatasetGeneration.Protein.get_random_points(num_points, xspan, yspan, debug=False)
Generate coordinate points uniformly distributed inside the ellipse inscribed in the rectangle defined by xspan and yspan.
- Parameters
num_points – number of points used to generate hulls
xspan – distance to span points in the x dimension
yspan – distance to span points in the y dimension
- Returns
points distribution
- Dock2D.DatasetGeneration.Protein.hull2array(hull, array, xspan, yspan)
Convert a hull to a grid based shape. All grid pixels are filled with 1 inside the shape, 0 otherwise.
- Parameters
hull – convex or concave hull points
array – grid to convert hull to gridshape
xspan – distance to span grid points in the x dimension
yspan – distance to span grid points in the y dimension
- Returns
bulk hull converted to a grid