Package topo :: Package patterns :: Module basic :: Class SeparatedComposite
[hide private]
[frames] | no frames]

Class SeparatedComposite

source code

                                  object --+            
                                           |            
base.parameterizedobject.ParameterizedObject --+        
                                               |        
          base.patterngenerator.PatternGenerator --+    
                                                   |    
                                           Composite --+
                                                       |
                                                      SeparatedComposite

Generalized version of the Composite PatternGenerator that enforces spacing constraints between pattern centers.

Currently supports minimum spacing, but can be generalized to support maximum spacing also (and both at once).



Nested Classes [hide private]

Inherited from base.parameterizedobject.ParameterizedObject: __metaclass__

Instance Methods [hide private]
 
__distance_valid(self, g0, g1)
Returns true if the distance between the (x,y) locations of two generators g0 and g1 is greater than a minimum separation.
source code
 
_advance_pattern_generators(self, generators)
Advance the parameters for each generator for this presentation.
source code

Inherited from Composite: __init__, function

Inherited from base.patterngenerator.PatternGenerator: __call__

Inherited from base.parameterizedobject.ParameterizedObject: __getstate__, __repr__, __setstate__, __str__, as_uninitialized, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, verbose, warning

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from base.parameterizedobject.ParameterizedObject: params, print_param_defaults

Class Variables [hide private]
  min_separation = <topo.base.parameterclasses.Number object at ...
Minimum distance to enforce between all pairs of pattern centers.
  max_trials = <topo.base.parameterclasses.Integer object at 0x9...
Number of times to try for a new pattern location that meets the criteria.

Inherited from Composite: generators, operator, size

Inherited from base.patterngenerator.PatternGenerator: bounds, mask, offset, orientation, output_fn, position, scale, x, xdensity, y, ydensity

Inherited from base.parameterizedobject.ParameterizedObject: name, print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__distance_valid(self, g0, g1)

source code 

Returns true if the distance between the (x,y) locations of two generators g0 and g1 is greater than a minimum separation.

Can be extended easily to support other criteria.

_advance_pattern_generators(self, generators)

source code 

Advance the parameters for each generator for this presentation.

Picks a position for each generator that is accepted by __distance_valid for all combinations. Returns a new list of the generators, with some potentially omitted due to failure to meet the constraints.

Overrides: Composite._advance_pattern_generators

Class Variable Details [hide private]

min_separation

Minimum distance to enforce between all pairs of pattern centers.

Useful for ensuring that multiple randomly generated patterns do not overlap spatially. Note that as this this value is increased relative to the area in which locations are chosen, the likelihood of a pattern appearing near the center of the area will decrease. As this value approaches the available area, the corners become far more likely to be chosen, due to the distances being greater along the diagonals.

Value:
Number(default= 0.0, bounds= (0, None), softbounds= (0.0, 1.0), doc= """
        Minimum distance to enforce between all pairs of pattern centers.

        Useful for ensuring that multiple randomly generated patterns
        do not overlap spatially.  Note that as this this value is
        increased relative to the area in which locations are chosen,
        the likelihood of a pattern appearing near the center of the
        area will decrease.  As this value approaches the available
...

max_trials

Number of times to try for a new pattern location that meets the criteria.

This is an essentially arbitrary timeout value that helps prevent an endless loop in case the requirements cannot be met.

Value:
Integer(default= 50, bounds= (0, None), softbounds= (0, 100), precedence=-1, doc= \
"""
        Number of times to try for a new pattern location that meets the criteria.
        
        This is an essentially arbitrary timeout value that helps
        prevent an endless loop in case the requirements cannot be
        met.""")