def randomize(self): """Randomize the layers components.""" super(QuadTreeLayer, self).randomize() cpool = model_constraintpool.ConstraintPool.get_pool() depth_constraint = cpool.get(self, DEPTH_CONSTRAINT) self.depth = model_random.randint_constrained(depth_constraint) border_width_constraint = cpool.get(self, BORDER_WIDTH_CONSTRAINT) self.border_width = model_random.uniform_constrained( border_width_constraint) propability_constraint = cpool.get(self, PROBABILITY_CONSTRAINT) self.propability = model_random.uniform_constrained( propability_constraint) colorgamut_factory = ka_factory.get_factory('colorgamut') colorgamuttype_constraint = cpool.get(self, COLORGAMUTTYPE_CONSTRAINT) self.colorgamut = colorgamut_factory.create_random( colorgamuttype_constraint, self.path) self.colorgamut.randomize() self.tile_colors = [] for dummy in range(self.depth): site_color = self.colorgamut.get_randomized_color(self.path) self.tile_colors.append(site_color)
def randomize(self): """Randomize the layers components.""" cpool = model_constraintpool.ConstraintPool.get_pool() order_constraint = cpool.get(self, ORDER_CONSTRAINT) self.order = model_random.uniform_constrained(order_constraint) radius_constraint = cpool.get(self, RADIUS_CONSTRAINT) self.radius = model_random.uniform_constrained(radius_constraint)
def randomize(self): """Randomize the layers components.""" cpool = model_constraintpool.ConstraintPool.get_pool() order_constraint = cpool.get(self, ORDER_CONSTRAINT) self.order = model_random.uniform_constrained(order_constraint) radius_constraint = cpool.get(self, RADIUS_CONSTRAINT) self.radius = model_random.uniform_constrained(radius_constraint) scale_constraint = cpool.get(self, SCALE_CONSTRAINT) self.scale = model_random.uniform_constrained(scale_constraint) dim_out_constraint = cpool.get(self, DIM_OUT_CONSTRAINT) self.dim_out = model_random.uniform_constrained(dim_out_constraint)
def randomize(self): """Set radian and distance to random values. post: (-1.0*math.pi) <= __return__[0] <= math.pi post: __return__[1] >= 0.0 """ cpool = model_constraintpool.ConstraintPool.get_pool() radian_constraint = cpool.get(self, RADIAN_CONSTRAINT) distance_constraint = cpool.get(self, DISTANCE_CONSTRAINT) radian = model_random.uniform_constrained(radian_constraint) distance = model_random.uniform_constrained(distance_constraint) return model_random.radian_limit(radian), math.fabs(distance)
def randomize(self): """No member variables. Nothing to do.""" cpool = model_constraintpool.ConstraintPool.get_pool() operator_constraint = cpool.get(self, OPERATOR_CONSTRAINT) self.left_operator = random.choice(operator_constraint) self.right_operator = random.choice(operator_constraint) alphablending_constraint = cpool.get(self, ALPHABLENDING_CONSTRAINT) self.left_alphablending = \ model_random.uniform_constrained(alphablending_constraint) self.right_alphablending = \ model_random.uniform_constrained(alphablending_constraint)
def randomize(self): """Randomize tranformations. """ cpool = model_constraintpool.ConstraintPool.get_pool() symmetry_constraint = cpool.get(self, SYMMETRY_CONSTRAINT) #TODO symmetry 0, 25 Binominal self.symmetry = model_random.randint_constrained(symmetry_constraint) Dn_constraint = cpool.get(self, DN_CONSTRAINT) self.Dn = model_random.randint_constrained(Dn_constraint) orbit_constraint = cpool.get(self, ORBIT_CONSTRAINT) self.orbits = model_random.randint_constrained(orbit_constraint) self.random_seed = random.randint(1, 65535) num_transformations_constraint = cpool.get(self, NUM_TRANSFORMATION_CONSTRAINT) self.num_transformations = model_random.randint_constrained(num_transformations_constraint) self._fill_pol_transf() for tix in range(self.num_transformations): #translation -2.0, 2.0 self.pol_transf[tix][0] = model_random.uniform_constrained([-2.0, 2.0]) self.pol_transf[tix][1] = model_random.uniform_constrained([-2.0, 2.0]) #rotation -math.pi, math.pi self.pol_transf[tix][2] = model_random.uniform_constrained([-math.pi, math.pi]) self.pol_transf[tix][3] = model_random.uniform_constrained([-math.pi, math.pi]) #scaling 0.0, 1.0 self.pol_transf[tix][4] = model_random.uniform_constrained([-1.0, 1.0]) self.pol_transf[tix][5] = model_random.uniform_constrained([-1.0, 1.0]) # self._prepare_transient_members() x_stamp_size_constraint = cpool.get(self, X_STAMP_SIZE_CONSTRAINT) self.x_stamp_size = model_random.uniform_constrained(x_stamp_size_constraint) y_stamp_size_constraint = cpool.get(self, Y_STAMP_SIZE_CONSTRAINT) self.y_stamp_size = model_random.uniform_constrained(y_stamp_size_constraint)
def randomize(self): """Randomize""" cpool = model_constraintpool.ConstraintPool.get_pool() x_center_constraint = cpool.get(self, X_CENTER_CONSTRAINT) self.x_center = model_random.uniform_constrained(x_center_constraint) y_center_constraint = cpool.get(self, Y_CENTER_CONSTRAINT) self.y_center = model_random.uniform_constrained(y_center_constraint) steps_constraint = cpool.get(self, STEPS_CONSTRAINT) self.start = model_random.randint_constrained(steps_constraint) self.end = model_random.randint_constrained(steps_constraint) angle_constraint = cpool.get(self, ANGLE_CONSTRAINT) self.angle = model_random.uniform_constrained(angle_constraint) c_constraint = cpool.get(self, C_CONSTRAINT) self.c = model_random.uniform_constrained(c_constraint)
def randomize(self): """Randomize""" cpool = model_constraintpool.ConstraintPool.get_pool() x_center_constraint = cpool.get(self, X_CENTER_CONSTRAINT) self.x_center = model_random.uniform_constrained(x_center_constraint) y_center_constraint = cpool.get(self, Y_CENTER_CONSTRAINT) self.y_center = model_random.uniform_constrained(y_center_constraint) steps_constraint = cpool.get(self, STEPS_CONSTRAINT) self.steps = model_random.randint_constrained(steps_constraint) turns_constraint = cpool.get(self, TURNS_CONSTRAINT) self.turns = model_random.uniform_constrained(turns_constraint) a_constraint = cpool.get(self, A_CONSTRAINT) self.a = model_random.uniform_constrained(a_constraint) b_constraint = cpool.get(self, B_CONSTRAINT) self.b = model_random.uniform_constrained(b_constraint)
def randomize(self): """Randomize the layers components.""" cpool = model_constraintpool.ConstraintPool.get_pool() order_constraint = cpool.get(self, ORDER_CONSTRAINT) self.order = model_random.randint_constrained(order_constraint) radius_constraint = cpool.get(self, RADIUS_CONSTRAINT) self.radius = model_random.uniform_constrained(radius_constraint) scatter_constraint = cpool.get(self, SCATTER_CONSTRAINT) self.scatter = model_random.uniform_constrained(scatter_constraint) start_angle_constraint = cpool.get(self, START_ANGLE_CONSTRAINT) self.start_angle = model_random.uniform_constrained( start_angle_constraint) line_width_constraint = cpool.get(self, LINE_WIDTH_CONSTRAINT) self.line_width = model_random.uniform_constrained( line_width_constraint) self.random_seed = random.randint(1, 65535)
def randomize(self): """Randomize the stamps components.""" cpool = model_constraintpool.ConstraintPool.get_pool() random.shuffle(self.mapping) size_constraint = cpool.get(self, GLYPHFONTSIZE_CONSTRAINT) self.size = model_random.uniform_constrained(size_constraint) family_constraint = cpool.get(self, GLYPHFONTFAMILY_CONSTRAINT) self.family = random.choice(family_constraint) self._randomize_mapping(cpool)
def randomize(self): """Randomize the layers components.""" super(CircularArc, self).randomize() cpool = model_constraintpool.ConstraintPool.get_pool() self.linecolor.randomize() line_width_constraint = cpool.get(self, LINE_WIDTH__CONSTRAINT) self.line_width = model_random.uniform_constrained( line_width_constraint) size_constraint = cpool.get(self, SIZE_CONSTRAINT) self.size = model_random.uniform_constrained(size_constraint) start_angle_constraint = cpool.get(self, START_ANGLE_CONSTRAINT) self.start_angle = model_random.uniform_constrained( start_angle_constraint) angle_constraint = cpool.get(self, ANGLE_CONSTRAINT) self.angle = model_random.uniform_constrained(angle_constraint) sampler_factory = ka_factory.get_factory('sampler') samplertype_constraint = cpool.get(self, SAMPLERTYPE_CONSTRAINT) self.sampler = sampler_factory.create_random(samplertype_constraint, self.path) self.sampler.randomize()
def randomize(self): """Randomize the layers components.""" super(FilledSpline, self).randomize() cpool = model_constraintpool.ConstraintPool.get_pool() line_width_constraint = cpool.get(self, 'line_width') roundness_constraint = cpool.get(self, 'roundness') colorgamut_factory = ka_factory.get_factory('colorgamut') colorgamuttype_constraint = cpool.get(self, COLORGAMUTTYPE_CONSTRAINT) self.colorgamut = colorgamut_factory.create_random( colorgamuttype_constraint, self.path) self.colorgamut.randomize() self.linecolor = self.colorgamut.get_randomized_color(self.path) self.fillcolor = self.colorgamut.get_randomized_color(self.path) self.line_width = model_random.uniform_constrained( line_width_constraint) self.roundness = model_random.uniform_constrained(roundness_constraint) self.center.randomize() sampler_factory = ka_factory.get_factory('sampler') samplertype_constraint = cpool.get(self, SAMPLERTYPE_CONSTRAINT) self.sampler = sampler_factory.create_random(samplertype_constraint, self.path) self.sampler.randomize()
def randomize(self): """Randomize the layers components.""" super(VoronoiDiagramLayer, self).randomize() cpool = model_constraintpool.ConstraintPool.get_pool() number_of_constraint = cpool.get(self, NUMBER_OF_SITES_CONSTRAINT) order_constraint = cpool.get(self, ORDER_CONSTRAINT) self.order = model_random.uniform_constrained(order_constraint) sampler_factory = ka_factory.get_factory('sampler') samplertype_constraint = cpool.get(self, SAMPLERTYPE_CONSTRAINT) self.sampler = sampler_factory.create_random(samplertype_constraint, self.path) self.sampler.randomize() colorgamut_factory = ka_factory.get_factory('colorgamut') colorgamuttype_constraint = cpool.get(self, COLORGAMUTTYPE_CONSTRAINT) self.colorgamut = colorgamut_factory.create_random( colorgamuttype_constraint, self.path) self.colorgamut.randomize() self.sites_point = [] for dummy in range( model_random.randint_constrained(number_of_constraint)): site_point = exon_position.Position(self.path, 0.0, 0.0) site_point.randomize() self.sites_point.append(site_point) self.sites_color = [] for dummy in range( model_random.randint_constrained(number_of_constraint)): site_color = self.colorgamut.get_randomized_color(self.path) self.sites_color.append(site_color) stamp_factory = ka_factory.get_factory('stamp') stamptype_constraint = cpool.get(self, STAMPTYPE_CONSTRAINT) self.stamp = stamp_factory.create_random(stamptype_constraint, self.path, len(self.sites_point)) self.stamp.randomize()