Skip to content

Getting to the dynamic value generator of a Dynamic parameter #66

@jlstevens

Description

@jlstevens

One thing that has frequently aggravates me about param is that there is no way (that I know of) to get at a dynamic value generator e.g a numbergen object. Perhaps there is a proper way to do this, but I have hacked in this method into my copy of param (on the Dynamic class) for the time being:

    def get_generator(self, obj):
        """
        Given a parameterized object, gets the dynamic value generator.
        """
        return super(Dynamic,self).__get__(obj, obj.__class__)

This is still awkward to use, but better than nothing. Say I have an imagen.Gaussian object and I want to fiddle the random number generator used for the orientation. Now I can do:

generator = gaussian.params('orientation').get_generator(gaussian)

Now for instance, I could change the time_fn for this numbergen object.

Any thoughts? Is there already a better way of doing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions