ioam/imagen — pull request #30 by Tobias-Fischer (2014-07-15 11:10:18+00:00)
Title: Patterncoordinator errata + SmartSweeper

This pull request addresses several issues in PatternCoordinator. Furthermore, a new PatternGenerator "SmartSweeper" for motion is introduced.

## Addressed issues in PatternCoordinator
### Change inherent_features from a dict to a list
Here, inherent_features has been changed from a dict to a list. If a feature is listed in inherent_features, the corresponding feature coordinator is not added to _feature_coordinators_to_apply. This avoids confusion about the former value of inherent_features, which was only meaningful in PatternCoordinatorImages, but not in PatternCoordinator itself.
In PatternCoordinatorImages, a new variable placeholder_mapping has been introduced. This maps a placeholder in the filename_template to its replacement.

### Allow supplying a path to a dataset
Rather than supplying a JSON file which specifies an image dataset, this pull request adds the possibility for providing a path to a dataset. By default, all png files within the provided directory are then used.
Furthermore, filename_template can now contain glob elements such as * which are evaluated.

### Change to FeatureCoordinators
Rather than modifying an existing PatternGenerator, the implementation of FeatureCoordinators has been changed to return a new PatternGenerator. In practise, a copy of the supplied PatternGenerator is made and then modified and returned.
This change is neccessary to allow the supplied PatternGenerator to be passed through another PatternGenerator, e.g. a MotionCoordinator might use SmartSweeper with the supplied PatternGenerator passed to the SmartSweeper.

### Introduce names to numbergen objects for time_dependent=True
When time_dependent=True, the numbergen objects must get passed a name. This has been done here for the present FeatureCoordinators.

### Bugfix: use get_value_generator when overwriting parameters
So far, parameters of the PatternGenerators were set as follows:
pattern.x += numbergen.UniformRandom(...)
This evaluates to
pattern.x = pattern.x + numbergen.UniformRandom(...)

However, pattern.x never returns a numbergen object, but always float (even if it is set to a numbergen object).

The correct way to set parameters is instead:
pattern.x = pattern.get_value_generator('x') + numbergen.UniformRandom(...)

## SmartSweeper
SmartSweeper is a more correct implementation of Translator. E.g. if you have a numbergen randomly setting orientation of a Gaussian and you pass it into a Translator, the orientation will keep changing during each sweep phase! This is clearly not what one wants to achieve. SmartSweeper however allows this behavior. It does so by setting a new time_fn on the supplied pattern generator, which is "slowed down" by dividing by reset_period.
Documentation will be added later.