Objects capable of generating a two-dimensional array of values.
Such patterns can be used as input to machine learning, neural network, or compuatational neuroscience algorithms, or for any other purpose where a two-dimensional pattern may be needed. Any new PatternGenerator classes can be derived from these, and can then be combined with the existing classes easily.
Bases: imagen.patterngenerator.Composite
Angle composed of two line segments.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Pop the state of all generators
Push the state of all generators
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.__init__.SineGrating
Circular pattern for testing responses to differences in contrast.
The pattern contains a sine grating ring surrounding a sine grating disk, each with parameters (orientation, size, scale and offset) that can be changed independently.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a sine grating pattern (two-dimensional sine wave).
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Archimedean spiral. Successive turnings of the spiral have a constant separation distance.
Spiral is defined by polar equation r=size*angle plotted in Gaussian plane.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Sigmoid multiplicatively combined with a difference of Log Gaussians, such that one part of the plane can be the mirror image of the other, and the peaks of the gaussians are movable.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.__init__.PowerSpectrum
Extends PowerSpectrum to provide a temporal buffer, yielding a 2D representation of a fixed-width spectrogram.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.Composite
Grating pattern made from overlaid spirals.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Pop the state of all generators
Push the state of all generators
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.__init__.Arc
2D arc pattern generator (centered at the middle of the arc).
Draws an arc (partial ring) of the specified size (radius*2), with middle at radian 0.0 and starting at arc_length/2 and ending at -arc_length/2. The pattern is centered at the middle of the arc.
See the Disk class for a note about the Gaussian fall-off.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: param.parameterized.Parameterized
A class hierarchy for callable objects that can generate 2D patterns.
Once initialized, PatternGenerators can be called to generate a value or a matrix of values from a 2D function, typically accepting at least x and y.
A PatternGenerator’s Parameters can make use of Parameter’s precedence attribute to specify the order in which they should appear, e.g. in a GUI. The precedence attribute has a nominal range of 0.0 to 1.0, with ordering going from 0.0 (first) to 1.0 (last), but any value is allowed.
The orientation and layout of the pattern matrices is defined by the SheetCoordinateSystem class, which see.
Note that not every parameter defined for a PatternGenerator will be used by every subclass. For instance, a Constant pattern will ignore the x, y, orientation, and size parameters, because the pattern does not vary with any of those parameters. However, those parameters are still defined for all PatternGenerators, even Constant patterns, to allow PatternGenerators to be scaled, rotated, translated, etc. uniformly.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D rectangle pattern, with Gaussian smoothing around the edges.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.ChannelGenerator
PatternGenerator that sweeps a supplied PatternGenerator in a direction perpendicular to its orientation. Each time step, the supplied PatternGenerator is sweeped further at a fixed speed, and after reset_period time steps a new pattern is drawn.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Two-dimensional difference of Gaussians pattern.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.CompositeBase
PatternGenerator that accepts a list of other PatternGenerators. To create a new pattern, asks each of the PatternGenerators in the list to create a pattern, then it combines the patterns to create a single pattern that it returns.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Constructs combined pattern out of the individual ones.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Pop the state of all generators
Push the state of all generators
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.Composite
Asterisk-like object composed of radial rectangular lines. Also makes crosses and tripods.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Pop the state of all generators
Push the state of all generators
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.CompositeBase
PatternGenerator that selects from a list of other PatternGenerators.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Get channel data from the current generator. use_cached is not supported at the moment, though it must be forced to be True in the current_generator in order to avoid generating the same data twice (the first time by self() and the second with current_generator.channels() ).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Abstract base class for patterns supporting multiple channels natively.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.ChannelGenerator
Create a multi-channel PatternGenerator from a list of PatternGenerators, with the specified channel_transforms applied.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D Exponential pattern generator.
Exponential decay based on distance from a central peak, i.e. exp(-d), where d is the distance from the center (assuming size=1.0 and aspect_ratio==1.0). More generally, the size and aspect ratio determine the scaling of x and y dimensions:
yscale=size/2 xscale=yscale*aspect_ratio
The exponential is then computed for the given (x,y) values as:
exp(-sqrt((x/xscale)^2 - (y/yscale)^2))
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Concentric rectangular hyperbolas with Gaussian fall-off which share the same asymptotes. abs(x^2/a^2 - y^2/a^2) = 1, where a mod size = 0
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D line pattern generator.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D Log Gaussian pattern generator allowing standard gaussian patterns but with the added advantage of movable peaks.
The spread governs decay rates from the peak of the Gaussian, mathematically this is the sigma term.
The center governs the peak position of the Gaussian, mathematically this is the mean term.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D squarewave (symmetric or asymmetric) grating pattern generator.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D Gabor pattern generator.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Constant pattern on in half of the plane, and off in the rest, with optional Gaussian smoothing.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
PatternGenerator that combines or selects from a list of other PatternGenerators.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.__init__.Arc
2D curve pattern generator.
Based on Arc, but centered on a tangent point midway through the arc, rather than at the center of a ring, and with curvature controlled directly rather than through the overall size of the pattern.
Depending on the size_type, the size parameter can control either the width of the pattern, keeping this constant regardless of curvature, or the length of the curve, keeping that constant instead (as for a long thin object being bent).
Specifically, for size_type==’constant_length’, the curvature parameter determines the ratio of height to width of the arc, with positive curvature for concave shape and negative for convex. The size parameter determines the width of the curve.
For size_type==’constant_width’, the curvature parameter determines the portion of curve radian to 2pi, and the curve radius is changed accordingly following the formula:
size=2pi*radius*curvature
Thus, the size parameter determines the total length of the curve. Positive curvature stands for concave shape, and negative for convex.
See the Disk class for a note about the Gaussian fall-off.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.Composite
Grating pattern made from alternating smooth circular segments (pie-shapes).
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Pop the state of all generators
Push the state of all generators
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Concentric rings with linearly increasing radius. Gaussian fall-off at the edges.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D rectangle pattern generator with no smoothing, for use when drawing patterns pixel by pixel.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
A sector of a circle with Gaussian fall-off, with size determining the arc length.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Constant pattern generator, i.e., a solid, uniform field of the same value.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Two-dimensional sigmoid pattern, dividing the plane into positive and negative halves with a smoothly sloping transition between them.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Sigmoid multiplicatively combined with a difference of Gaussians, such that one part of the plane can be the mirror image of the other.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D Gaussian pattern generator.
The sigmas of the Gaussian are calculated from the size and aspect_ratio parameters:
ysigma=size/2 xsigma=ysigma*aspect_ratio
The Gaussian is then computed for the given (x,y) values as:
exp(-x^2/(2*xsigma^2) - y^2/(2*ysigma^2)
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D sine grating pattern generator.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D arc pattern generator.
Draws an arc (partial ring) of the specified size (radius*2), starting at radian 0.0 and ending at arc_length. The orientation can be changed to choose other start locations. The pattern is centered at the center of the ring.
See the Disk class for a note about the Gaussian fall-off.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Outputs the spectral density of a rolling interval of the input signal each time it is called. Over time, the results could be arranged into a spectrogram, e.g. for an audio signal.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D ring pattern generator.
See the Disk class for a note about the Gaussian fall-off.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
2D disk pattern generator.
An elliptical disk can be obtained by adjusting the aspect_ratio of a circular disk; this transforms a circle into an ellipse by stretching the circle in the y (vertical) direction.
The Gaussian fall-off at a point P is an approximation for non-circular disks, since the point on the ellipse closest to P is taken to be the same point as the point on the circle before stretching that was closest to P.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Pattern generators for audio signals.
Bases: imagen.TimeSeries
Requires an audio file in any format accepted by audiolab (wav, aiff, flac).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Overload if special behaviour is required when a series ends.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
alias of float64
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.audio.AudioFile
Returns a rolling spectrogram, i.e. the spectral density over time of a rolling window of the input audio signal, for all files in the specified folder.
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Overload if special behaviour is required when a series ends.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
alias of float64
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.Spectrogram
Extends Spectrogram to provide a response over an octave scale.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.PowerSpectrum
Outputs a cochlear decomposition as a set of frequency responses of linear band-pass filters. Employs Lyons Cochlear Model to do so.
R. F. Lyon, “A computational model of filtering, detection and compression in the cochlea.” in Proc. of the IEEE Int. Conf. Acoust., Speech, Signal Processing, Paris, France, May 1982.
Specific implementation details can be found in:
Malcolm Slaney, “Lyon’s Cochlear Model, in Advanced Technology Group, Apple Technical Report #13”, 1988.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
alias of float64
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.audio.LyonsCochlearModel
Employs Lyons Cochlear Model to return a Cochleoogram, i.e. the response over time along the cochlea.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
alias of float64
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.audio.LogSpectrogram
Extends OctaveSpectrogram with a simple model of outer ear amplification. One can set both the range to amplify and the amount.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Hanning window.
The Hanning window is a taper formed by using a weighted cosine.
bartlett, blackman, hamming, kaiser
The Hanning window is defined as
The Hanning was named for Julius van Hann, an Austrian meteorologist. It is also known as the Cosine Bell. Some authors prefer that it be called a Hann window, to help avoid confusion with the very similar Hamming window.
Most references to the Hanning window come from the signal processing literature, where it is used as one of many windowing functions for smoothing values. It is also known as an apodization (which means “removing the foot”, i.e. smoothing discontinuities at the beginning and end of the sampled signal) or tapering function.
[1] | Blackman, R.B. and Tukey, J.W., (1958) The measurement of power spectra, Dover Publications, New York. |
[2] | E.R. Kanasewich, “Time Sequence Analysis in Geophysics”, The University of Alberta Press, 1975, pp. 106-108. |
[3] | Wikipedia, “Window function”, http://en.wikipedia.org/wiki/Window_function |
[4] | W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling, “Numerical Recipes”, Cambridge University Press, 1986, page 425. |
>>> np.hanning(12)
array([ 0. , 0.07937323, 0.29229249, 0.57115742, 0.82743037,
0.97974649, 0.97974649, 0.82743037, 0.57115742, 0.29229249,
0.07937323, 0. ])
Plot the window and its frequency response:
>>> from numpy.fft import fft, fftshift
>>> window = np.hanning(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Hann window")
<matplotlib.text.Text object at 0x...>
>>> plt.ylabel("Amplitude")
<matplotlib.text.Text object at 0x...>
>>> plt.xlabel("Sample")
<matplotlib.text.Text object at 0x...>
>>> plt.show()
>>> plt.figure()
<matplotlib.figure.Figure object at 0x...>
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
>>> response = 20 * np.log10(mag)
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Frequency response of the Hann window")
<matplotlib.text.Text object at 0x...>
>>> plt.ylabel("Magnitude [dB]")
<matplotlib.text.Text object at 0x...>
>>> plt.xlabel("Normalized frequency [cycles per sample]")
<matplotlib.text.Text object at 0x...>
>>> plt.axis('tight')
(-0.5, 0.5, -100.0, ...)
>>> plt.show()
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Utilities for converting images between various color spaces, such as:
- RGB (for display on computer monitor red, green, and blue channels)
- HSV (allowing manipulation of the hue, saturation, and value),
- LMS (estimates of human long, medium, and short cone responses),
- LCH (CIE perceptually uniform luminance, chroma (saturation), and hue)
- LAB (CIE opponent black/white, red/green, blue/yellow axes)
- XYZ (CIE interchange format)
See http://en.wikipedia.org/wiki/Color_space for more detailed descriptions.
To use these utilities, users should instantiate one of these two classes:
Declare a set of color spaces to allow external code to work the same for any combination of color spaces. Specifically, declares:
image color space (the space in which a dataset of images has been stored),
e.g. to transform images to a different working dataset, and
analysis color space (space in which analyses will be performed)
These values can be set using:
color_conversion.image_space="XYZ" # e.g. RGB, XYZ, LMS
color_conversion.working_space="RGB" # e.g. RGB, LMS
color_conversion.analysis_space="HSV" # e.g. HSV, LCH
The other code in this file is primarily implementation for these two classes, and will rarely need to be used directly.
Bases: param.parameterized.Parameterized
Low-level color conversion. The ‘convert’ method handles color conversion to and from (and through) XYZ, and supports RGB, LCH, LMS and HSV.
Convert image or color “what” from “from_” colorpace to “to” colorspace. E.g.: convert("rgb", "hsv", X), where X is a numpy dstack or a color tuple.
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
alias of float32
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: param.parameterized.Parameterized
High-level color conversion class designed to support color space transformations along a pipeline common in color vision modelling: image (dataset colorspace) -> working (working colorspace) -> [higher stages] -> analysis
Utility conversion function that transforms data from the analysis color space to the display space (currently hard-set to RGB) for visualization.
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Old patterns not intended for new code.
These patterns are expected to be deleted eventually.
Bases: imagen.image.GenericImage
2D Image generator that reads the image from a file.
Grayscale versions of the image are always available, converted from the color version if necessary. For color images, three-channel color values are available through the channels() method. See Image’s Image class for details of supported image file formats.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Subclassed to delete the cached image when matrix dimensions are changed.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Constant pattern generator, i.e., a solid, uniform field of the same value.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Two 2D rectangle pattern generator.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.CompositeBase
PatternGenerator that accepts a list of other PatternGenerators. To create a new pattern, asks each of the PatternGenerators in the list to create a pattern, then it combines the patterns to create a single pattern that it returns.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Constructs combined pattern out of the individual ones.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Pop the state of all generators
Push the state of all generators
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
PatternGenerator that sweeps a supplied PatternGenerator in a direction perpendicular to its orientation.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Change the dimensions of the matrix into which the pattern will be drawn. Users of this class should call this method rather than changing the bounds, xdensity, and ydensity parameters directly. Subclasses can override this method to update any internal data structures that may depend on the matrix dimensions.
Restore the state of the output functions saved by state_push.
Save the state of the output functions, to be restored with state_pop.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.patterngenerator.PatternGenerator
Two Gaussian pattern generators with a variable intersection point, appearing as a corner or cross.
duration: The temporal duration to animate in the units defined on the global time function.
offset: The temporal offset from which the animation is generated given the supplied pattern
timestep: The time interval between successive frames. The duration must be an exact multiple of the timestep.
label: A label string to override the label of the global time function (if not None).
unit: The unit string to override the unit value of the global time function (if not None).
time_fn: The global time function object that is shared across the time-varying objects that are being sampled.
Note that the offset, timestep and time_fn only affect patterns parameterized by time-dependent number generators. Otherwise, the frames are generated by successive call to the pattern which may or may not be varying (e.g to view the patterns contained within a Selector).
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual channels’ arrays (key: 0,1,..N-1).
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Function to draw a pattern that will then be scaled and rotated.
Instead of implementing __call__ directly, PatternGenerator subclasses will typically implement this helper function used by __call__, because that way they can let __call__ handle the scaling and rotation for them. Alternatively, __call__ itself can be reimplemented entirely by a subclass (e.g. if it does not need to do any scaling or rotation), in which case this function will be ignored.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Query the number of channels implemented by the PatternGenerator. In case of single-channel generators this will return 1; in case of multichannel, it will return the number of channels (eg, in the case of RGB images it would return ‘3’, Red-Green-Blue, even though the OrderedDict returned by channels() will have 4 elements – the 3 channels + their average).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.